Skip to content

Commit

Permalink
feat: add stxer simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
friedger committed Jul 20, 2024
1 parent 8d5e7d2 commit 9496a7e
Show file tree
Hide file tree
Showing 8 changed files with 1,994 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
/coverage_report
history.txt
coverage.lcov
node_modules
8 changes: 4 additions & 4 deletions contracts/extensions/ccd002-treasury-v3.clar
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
(impl-trait .stacking-trait.stacking-trait)
(impl-trait .ccd002-trait.ccd002-treasury-trait)
;; MAINNET: 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait
(use-trait ft-trait 'ST1NXBK3K5YYMD6FD41MVNP3JS1GABZ8TRVX023PT.sip-010-trait-ft-standard.sip-010-trait)
(use-trait ft-trait 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)
;; MAINNET: 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait.nft-trait
(use-trait nft-trait 'ST1NXBK3K5YYMD6FD41MVNP3JS1GABZ8TRVX023PT.nft-trait.nft-trait)
(use-trait nft-trait 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait.nft-trait)

;; CONSTANTS

Expand Down Expand Up @@ -159,7 +159,7 @@
})
;; MAINNET: 'SP000000000000000000002Q6VF78.pox-4
;; TESTNET: 'ST000000000000000000002AMW42H.pox-4
(match (as-contract (contract-call? 'ST000000000000000000002AMW42H.pox-4 delegate-stx maxAmount to none none))
(match (as-contract (contract-call? 'SP000000000000000000002Q6VF78.pox-4 delegate-stx maxAmount to none none))
success (ok success)
err (err (to-uint err))
)
Expand All @@ -176,7 +176,7 @@
})
;; MAINNET: 'SP000000000000000000002Q6VF78.pox-4
;; TESTNET: 'ST000000000000000000002AMW42H.pox-4
(match (as-contract (contract-call? 'ST000000000000000000002AMW42H.pox-4 revoke-delegate-stx))
(match (as-contract (contract-call? 'SP000000000000000000002Q6VF78.pox-4 revoke-delegate-stx))
success (begin (print success) (ok true))
err (err (to-uint err))
)
Expand Down
8 changes: 4 additions & 4 deletions contracts/proposals/ccip019-pox-4-stacking.clar
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@

;; allow MIA in treasuries
;; MAINNET: 'SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.miamicoin-token-v2
(try! (contract-call? .ccd002-treasury-mia-mining-v3 set-allowed 'ST1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8WRH7C6H.miamicoin-token-v2 true))
(try! (contract-call? .ccd002-treasury-mia-mining-v3 set-allowed 'SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.miamicoin-token-v2 true))

;; transfer funds to new treasury extensions
(try! (contract-call? .ccd002-treasury-mia-mining-v2 withdraw-stx miaBalance .ccd002-treasury-mia-mining-v3))

;; delegate stack the STX in the mining treasuries (up to 50M STX each)
;; MAINNET: SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP.pox4-fast-pool-v3
(try! (contract-call? .ccd002-treasury-mia-mining-v3 delegate-stx u50000000000000 'ST1XQXW9JNQ1W4A7PYTN3HCHPEY7SHM6KPA085ES6))
(try! (contract-call? .ccd002-treasury-mia-mining-v3 delegate-stx u50000000000000 'SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP.pox4-fast-pool-v3))

;; add treasuries to ccd005-city-data
(try! (contract-call? .ccd005-city-data add-treasury miaId .ccd002-treasury-mia-mining-v3 "mining-v3"))
Expand Down Expand Up @@ -224,12 +224,12 @@
(
;; MAINNET: mia cycle 82 / first block BTC 838,250 STX 145,643
;; cycle 2 / u4500 used in tests
(cycle82Hash (unwrap! (get-block-hash u4500) none))
(cycle82Hash (unwrap! (get-block-hash u145643) none))
(cycle82Data (at-block cycle82Hash (contract-call? .ccd007-citycoin-stacking get-stacker MIA_ID u2 userId)))
(cycle82Amount (get stacked cycle82Data))
;; MAINNET: mia cycle 83 / first block BTC 840,350 STX 147,282
;; cycle 3 / u6600 used in tests
(cycle83Hash (unwrap! (get-block-hash u6600) none))
(cycle83Hash (unwrap! (get-block-hash u147282) none))
(cycle83Data (at-block cycle83Hash (contract-call? .ccd007-citycoin-stacking get-stacker MIA_ID u3 userId)))
(cycle83Amount (get stacked cycle83Data))
;; mia vote calculation
Expand Down
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "city-coins",
"version": "1.0.0",
"description": "Run unit tests on this project.",
"type": "module",
"private": true,
"scripts": {
"test": "vitest run ccip022",
"test:report": "vitest run -- --coverage --costs",
"test:watch": "chokidar \"tests/**/*.ts\" \"contracts/**/*.clar\" -c \"npm run test:report\""
},
"author": "",
"license": "ISC",
"dependencies": {
"@hirosystems/clarinet-sdk": "^2.3.2",
"@stacks/network": "^6.16.0",
"@stacks/transactions": "^6.12.0",
"c32check": "^2.0.0",
"chokidar-cli": "^3.0.0",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vitest": "^1.3.1",
"vitest-environment-clarinet": "^2.0.0"
}
}
Loading

0 comments on commit 9496a7e

Please sign in to comment.