Skip to content

Commit

Permalink
Merge pull request #27 from LovelaceAcademy/add-m11
Browse files Browse the repository at this point in the history
Add M11 - A Vesting Contract II
  • Loading branch information
klarkc authored Oct 15, 2023
2 parents 1b086e1 + 40180bf commit 3d631c6
Show file tree
Hide file tree
Showing 57 changed files with 18,759 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ To run anyting on this repository, you'll need to have:
- Untyped vs Typed Validation Scripts
- Testing with Plutip

## [Module 10 - A Vesting Contract I](modules/M10-a-vesting-contract)
## [Module 10 - A Vesting Contract I](modules/M10-a-vesting-contract-i)

- Script Context
- Handling Time (Slots)
- Building the contract and tests

## Module 11 - A Vesting Contract II
## [Module 11 - A Vesting Contract II](modules/M11-a-vesting-contract-ii)

- Building the UI
- Building the Vesting Contract UI

## Module 12 - (Non/)Fungible Tokens
- Parameterized contracts (Plutus and CTL)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: M10 - A Vesting Contract
title: M10 - A Vesting Contract I
author: Walker Leite
---
# Introduction
Expand All @@ -26,8 +26,6 @@ To run this presentation type (you will need [nix](https://nixos.org)):

- Bulding smart contracts (module 6);
- Cardano-Transaction-Lib (module 8);
- Halogen (modules 7 and 8);
- Although not required, [variants](https://github.com/natefaubion/purescript-variant) will be useful for [halogen-formless](https://github.com/thomashoneyman/purescript-halogen-formless).

# Script Context

Expand Down Expand Up @@ -119,15 +117,15 @@ data Extended a = NegInf | Finite a | PosInf
## Bootstrap

```
mkdir modules/M10-a-vesting-contract/{contract,dapp}
mkdir modules/M10-a-vesting-contract-i/{contract,dapp}

(
cd modules/M10-a-vesting-contract/contract
cd modules/M10-a-vesting-contract-i/contract
nix flake init -t github:LovelaceAcademy/nix-templates#hor-plutus
)

(
cd modules/M10-a-vesting-contract/dapp
cd modules/M10-a-vesting-contract-i/dapp
nix flake init -t github:LovelaceAcademy/nix-templates#pix-ctl-full
)
```
47 changes: 47 additions & 0 deletions modules/M11-a-vesting-contract-ii/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: M11 - A Vesting Contract II
author: Walker Leite
---
# Introduction

## Getting Started

In this module we'll build the vesting contract UI

To run this presentation type (you will need [nix](https://nixos.org)):

```sh
../../slide README.md
```

### Community Support

- [LovelaceAcademy Discord](https://discord.gg/fWP9eGdfZ8)
- [StackExchange](https://cardano.stackexchange.com/) (:bulb: use the tag lovelace-academy)
- [Plutonomicon Discord](https://discord.gg/gGFdGaUE)

[![Module Video](https://img.youtube.com/vi/bRhs0lxg3J8/0.jpg)](https://www.youtube.com/watch?v=bRhs0lxg3J8&list=PLHJ1yaDcSSaflXUWFHQV2L5FeyFt7fjN7)

## What you should know

- Vesting contract contract (module 10)
- Halogen (modules 7 and 8);
- Although not required, [variants](https://github.com/natefaubion/purescript-variant) will be useful for [halogen-formless](https://github.com/thomashoneyman/purescript-halogen-formless).

# Breakthrough: Building the Vesting Contract UI

## Description

> As a donator I want to lock an ADA value in a contract, to be rewarded to a given beneficiary according a given deadline
> As the beneficiary I want to reclaim the locked ADA value only after the deadline
## Bootstrap

```bash
cp -Rf modules/M10-a-vesting-contract-i modules/M11-a-vesting-contract-ii
```

## Links

- [DaisyUI](https://daisyui.com/)
1 change: 1 addition & 0 deletions modules/M11-a-vesting-contract-ii/contract/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/result
217 changes: 217 additions & 0 deletions modules/M11-a-vesting-contract-ii/contract/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions modules/M11-a-vesting-contract-ii/contract/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
inputs.horizon-wave-ocean.url = "git+https://gitlab.homotopic.tech/horizon/wave-ocean/horizon-wave-ocean-platform";
inputs.nixpkgs.follows = "horizon-wave-ocean/nixpkgs";
inputs.utils.url = "github:ursi/flake-utils";

outputs = { self, utils, ... }@inputs:
utils.apply-systems
{
inherit inputs;
# TODO support additional systems on hor
# horizon-platform is only supporting linux
systems = [ "x86_64-linux" ];
}
({ pkgs, system, ... }:
let
hsPkgs =
with pkgs.haskell.lib;
inputs.horizon-wave-ocean.legacyPackages.${system}.extend (hfinal: hprev:
{
vesting-contract = disableLibraryProfiling (hprev.callCabal2nix "vesting-contract" ./. { });
});
script = pkgs.runCommand "script"
{
buildInputs = [ hsPkgs.vesting-contract ];
}
''vesting-contract > $out'';
script-check = pkgs.runCommand "script-check" { }
''cat ${script}; touch $out'';
in
{
packages.default = hsPkgs.vesting-contract;
packages.script = script;

devShells.default = hsPkgs.vesting-contract.env.overrideAttrs (attrs: {
buildInputs = with pkgs; attrs.buildInputs ++ [
cabal-install
];
});

checks.default = script-check;
});

# --- Flake Local Nix Configuration ----------------------------
nixConfig = {
# This sets the flake to use nix cache.
# Nix should ask for permission before using it,
# but remove it here if you do not want it to.
extra-substituters = [
"https://klarkc.cachix.org?priority=99"
"https://cache.iog.io"
"https://cache.zw3rk.com"
"https://cache.nixos.org"
"https://hercules-ci.cachix.org"
];
extra-trusted-public-keys = [
"klarkc.cachix.org-1:R+z+m4Cq0hMgfZ7AQ42WRpGuHJumLLx3k0XhwpNFq9U="
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
"loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"hercules-ci.cachix.org-1:ZZeDl9Va+xe9j+KqdzoBZMFJHVQ42Uu/c/1/KMC5Lw0="
];
allow-import-from-derivation = "true";
};
}
Loading

0 comments on commit 3d631c6

Please sign in to comment.