clarity-lang / book

Clarity of Mind is both an introductory as well as a reference book for the Clarity smart contract language.
http://book.clarity-lang.org
Creative Commons Attribution Share Alike 4.0 International
70 stars 49 forks source link

Fix/criadoperez #8

Closed criadoperez closed 2 years ago

criadoperez commented 2 years ago
  1. Updated clarinet version to 0.24
  2. When creating a new project using clarinet, default names are now "testnet", "mainnet" and "devnet". I changed the old name of "Development" to the new standard "devnet".

@MarvinJanssen should also "mocknet" be changed to "testnet"?

MarvinJanssen commented 2 years ago

Thanks, I assume all tests still pass? Not sure on the rename of mocknet to testnet, they are two different things. Is that the latest naming convention for Clarinet? They changed it once before.

criadoperez commented 2 years ago

Yes, the latest naming convention for Clarinet is : "tesnet", "mainnet" and "devnet". I have currently only changes "Development" to "devnet". Let me know if you want the others renamed also.

Yes, all test that exists have passed (Sip009-nft doesnt have a test file):

[tiny-market]$ clarinet test

Running file:///home/alejandro/clarity-lang-book/projects/tiny-market/tests/tiny-market_test.ts
* Can list an NFT for sale for STX ... ok (33ms)
* Can list an NFT for sale for any SIP010 fungible token ... ok (51ms)
* Cannot list an NFT for sale if the expiry is in the past ... ok (34ms)
* Cannot list an NFT for sale for nothing ... ok (53ms)
* Cannot list an NFT for sale that the sender does not own ... ok (142ms)
* Maker can cancel a listing ... ok (124ms)
* Non-maker cannot cancel listing ... ok (138ms)
* Can get listings that have not been cancelled ... ok (57ms)
* Cannot get listings that have been cancelled or do not exist ... ok (45ms)
* Can fulfil an active listing with STX ... ok (45ms)
* Can fulfil an active listing with SIP010 fungible tokens ... ok (67ms)
* Cannot fulfil own listing ... ok (55ms)
* Cannot fulfil an unknown listing ... ok (37ms)
* Cannot fulfil an expired listing ... ok (61ms)
* Cannot fulfil a listing with a different NFT contract reference ... ok (59ms)
* Cannot fulfil an active STX listing with SIP010 fungible tokens ... ok (74ms)
* Cannot fulfil an active SIP010 fungible token listing with STX ... ok (69ms)
* Cannot fulfil an active SIP010 fungible token listing with a different SIP010 fungible token contract reference ... ok (63ms)
* Cannot fulfil an active STX listing with insufficient balance ... ok (57ms)
* Cannot fulfil an active SIP010 fungible token listing with insufficient balance ... ok (77ms)
* Intended taker can fulfil active listing ... ok (147ms)
* Unintended taker cannot fulfil active listing ... ok (179ms)
* Can fulfil multiple active listings in any order ... ok (331ms)

test result: ok. 23 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (3325ms)
[timelocked-wallet]$ clarinet test

Running file:///home/alejandro/clarity-lang-book/projects/timelocked-wallet/tests/smart-claimant_test.ts
* Disburses tokens once it can claim the time-locked wallet balance ... ok (34ms)
Running file:///home/alejandro/clarity-lang-book/projects/timelocked-wallet/tests/timelocked-wallet_test.ts
* Allows the contract owner to lock an amount ... ok (24ms)
* Does not allow anyone else to lock an amount ... ok (16ms)
* Cannot lock more than once ... ok (44ms)
* Unlock height cannot be in the past ... ok (46ms)
* Allows the beneficiary to bestow the right to claim to someone else ... ok (37ms)
* Does not allow anyone else to bestow the right to claim to someone else (not even the contract owner) ... ok (47ms)
* Allows the beneficiary to claim the balance when the block-height is reached ... ok (37ms)
* Does not allow the beneficiary to claim the balance before the block-height is reached ... ok (28ms)
* Does not allow anyone else to claim the balance when the block-height is reached ... ok (26ms)

test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (1935ms)
[multisig-vault]$ clarinet test

Running file:///home/alejandro/clarity-lang-book/projects/multisig-vault/tests/multisig-vault_test.ts
* Allows the contract owner to initialise the vault ... ok (13ms)
* Does not allow anyone else to initialise the vault ... ok (13ms)
* Cannot start the vault more than once ... ok (20ms)
* Cannot require more votes than members ... ok (22ms)
* Allows members to vote ... ok (73ms)
* Does not allow non-members to vote ... ok (59ms)
* Can retrieve a member's vote for a principal ... ok (40ms)
* Principal that meets the vote threshold can withdraw the vault balance ... ok (67ms)
* Principals that do not meet the vote threshold cannot withdraw the vault balance ... ok (54ms)
* Members can change votes at-will, thus making an eligible recipient uneligible again ... ok (75ms)

test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (1319ms)
[counter]$ clarinet test

Running file:///home/alejandro/clarity-lang-book/projects/counter/tests/counter_test.ts
* get-count returns u0 for principals that never called count-up before ... ok (12ms)
* count-up counts up for the tx-sender ... ok (16ms)
* counters are specific to the tx-sender ... ok (35ms)

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (1299ms)