new sample contracts that use the native fungible token type (for testing asset movement in clarity-cli)

This commit is contained in:
Jude Nelson
2021-04-20 14:07:34 -04:00
parent d569273955
commit 5a5212169b
2 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
(begin
(as-contract
(contract-call? 'S1G2081040G2081040G2081040G208105NK8PE5.tokens mint! u100)
)
)

View File

@@ -0,0 +1,16 @@
(define-fungible-token tokens)
(define-private (get-balance (account principal))
(ft-get-balance tokens account))
(define-private (token-credit! (account principal) (amount uint))
(ft-mint? tokens amount account))
(define-public (token-transfer (to principal) (amount uint))
(ft-transfer? tokens amount tx-sender to))
(define-public (mint! (amount uint))
(token-credit! tx-sender amount))
(token-credit! tx-sender u10300)
(token-transfer 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR u10000)
(token-transfer 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G u300)