plu-ts
implementation of the "vesting" contract example;
the contract succeeds if the following two conditions are met:
- the transaction is signed by the
PPubKeyHash
defined in the UTxO datum; - the transaction lower bound is
Finite
and greather than the datumdeadline
field
the contract source code can be found at src/contract.ts
;
the repository includes a series of scripts to interact with the contract:
compiles the contract defined in src/contract.ts
and saves the result in a file caled testnet/vesting.plutus.json
following the cardano-cli
format.
run using
npm run vesting:compile
Alternatively you can use the
genKeys
script
requires the PRIVATE_TESTNET_PATH
environment variable.
the private-testnet
folder assumes a structure like the one of the woofpool/cardano-private-testnet-setup
run using
npm run vesting:setup
generates two pairs of keys and two addresses in the ./testnet
folder
run using
npm run vesting:genKeys
creates an utxo on the contract with the testnet/payment2.vkey
credentials as beneficiary and a deadline setted to 10 seconds after the execution of the script
run using
npm run vesting:create
tries to spend the first utxo on the contract using testnet/payment2.skey
as requiredSigner
the transaction might fail if the deadline is not met
run using
npm run vesting:claim
creates a trasaction using all testnet/address1.addr
and testnet/address2.addr
as input going to the testnet faucet.
run using
npm run vesting:returnFaucet