Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marvinjanssen/upgradable-fungible-token-concept
https://github.com/marvinjanssen/upgradable-fungible-token-concept
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/marvinjanssen/upgradable-fungible-token-concept
- Owner: MarvinJanssen
- Created: 2024-05-18T19:22:52.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T02:52:10.000Z (6 months ago)
- Last Synced: 2024-05-22T03:43:43.448Z (6 months ago)
- Language: Clarity
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Upgradable fungible token standard
To try it out in `clarinet console`:
```clarity
;; Activate the token by performing initial upgrade
(contract-call? .upgradable-fungible-token upgrade .upgradable-fungible-token-impl);; Implementation detail, set some token price
(contract-call? .upgradable-fungible-token-impl owner-set-price-per-token u23);; Switch to some user
::set_tx_sender ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5;; User buys some tokens
(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.upgradable-fungible-token-impl buy-tokens u100);; User transfers some tokens
(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.upgradable-fungible-token transfer-memo u20 tx-sender 'ST3AM1A56AK2C1XAFJ4115ZSV26EB49BVQ10MGCS0 0x112233 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.upgradable-fungible-token-impl);; Switch back to contract owner
::set_tx_sender ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM;; Upgrade to an implementation with pause feature
(contract-call? .upgradable-fungible-token upgrade .upgradable-fungible-token-impl-pausing);; Pause the token
(contract-call? .upgradable-fungible-token-impl-pausing owner-set-paused true);; Switch to some user
::set_tx_sender ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5;; User transfers some tokens, trying to use old implementation
(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.upgradable-fungible-token transfer-memo u20 tx-sender 'ST3AM1A56AK2C1XAFJ4115ZSV26EB49BVQ10MGCS0 0x112233 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.upgradable-fungible-token-impl);; User transfers some tokens using current implementation
(contract-call? 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.upgradable-fungible-token transfer-memo u20 tx-sender 'ST3AM1A56AK2C1XAFJ4115ZSV26EB49BVQ10MGCS0 0x112233 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.upgradable-fungible-token-impl-pausing)
```