mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-01-12 16:53:21 +08:00
new sample contracts that use the native fungible token type (for testing asset movement in clarity-cli)
This commit is contained in:
5
sample-contracts/tokens-ft-mint.clar
Normal file
5
sample-contracts/tokens-ft-mint.clar
Normal file
@@ -0,0 +1,5 @@
|
||||
(begin
|
||||
(as-contract
|
||||
(contract-call? 'S1G2081040G2081040G2081040G208105NK8PE5.tokens mint! u100)
|
||||
)
|
||||
)
|
||||
16
sample-contracts/tokens-ft.clar
Normal file
16
sample-contracts/tokens-ft.clar
Normal 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)
|
||||
Reference in New Issue
Block a user