mirror of
https://github.com/zhigang1992/liquid-stacking.git
synced 2026-01-12 17:23:23 +08:00
Merge branch 'whitelist-mint-helper' of github.com:lisalab-io/liquid-stacking into feat/regtest-whitelist
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,3 +14,4 @@ node_modules
|
||||
contracts_modules
|
||||
plan.json
|
||||
config.json*
|
||||
.DS_Store
|
||||
|
||||
@@ -45,6 +45,15 @@ contract_id = "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.stx-transfer-proxy"
|
||||
[[project.requirements]]
|
||||
contract_id = "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.public-pools-strategy"
|
||||
|
||||
[[project.requirements]]
|
||||
contract_id = "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint"
|
||||
|
||||
[[project.requirements]]
|
||||
contract_id = "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01"
|
||||
|
||||
[[project.requirements]]
|
||||
contract_id = "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait"
|
||||
|
||||
# [contracts.lisa-dao]
|
||||
# path = "contracts/lisa-dao.clar"
|
||||
# epoch = 2.4
|
||||
@@ -85,9 +94,9 @@ epoch = 2.4
|
||||
path = "contracts/traits/extension-trait.clar"
|
||||
epoch = 2.4
|
||||
|
||||
[contracts.proposal-trait]
|
||||
path = "contracts/traits/proposal-trait.clar"
|
||||
epoch = 2.4
|
||||
# [contracts.proposal-trait]
|
||||
# path = "contracts/traits/proposal-trait.clar"
|
||||
# epoch = 2.4
|
||||
|
||||
[contracts.proxy-trait]
|
||||
path = "contracts/traits/proxy-trait.clar"
|
||||
@@ -217,13 +226,13 @@ epoch = 2.4
|
||||
path = "contracts/extensions/lqstx-mint-endpoint.clar"
|
||||
epoch = 2.4
|
||||
|
||||
[contracts.lqstx-mint-endpoint-v1-01]
|
||||
path = "contracts/deployed/lqstx-mint-endpoint-v1-01.clar"
|
||||
epoch = 2.4
|
||||
# [contracts.lqstx-mint-endpoint-v1-01]
|
||||
# path = "contracts/deployed/lqstx-mint-endpoint-v1-01.clar"
|
||||
# epoch = 2.4
|
||||
|
||||
[contracts.lqstx-mint-endpoint]
|
||||
path = "contracts/deployed/lqstx-mint-endpoint.clar"
|
||||
epoch = 2.4
|
||||
# [contracts.lqstx-mint-endpoint]
|
||||
# path = "contracts/deployed/lqstx-mint-endpoint.clar"
|
||||
# epoch = 2.4
|
||||
|
||||
# [contracts.lqstx-mint-registry]
|
||||
# path = "contracts/aux/lqstx-mint-registry.clar"
|
||||
@@ -333,6 +342,18 @@ epoch = 2.4
|
||||
path = "contracts/aux/endpoint-whitelist-helper.clar"
|
||||
epoch = 2.4
|
||||
|
||||
[contracts.lip002]
|
||||
path = "contracts/proposals/lip002.clar"
|
||||
epoch = 2.4
|
||||
|
||||
[contracts.auto-whitelist-mint-helper]
|
||||
path = "contracts/extensions/auto-whitelist-mint-helper.clar"
|
||||
epoch = 2.4
|
||||
|
||||
[contracts.lip003]
|
||||
path = "contracts/proposals/lip003.clar"
|
||||
epoch = 2.4
|
||||
|
||||
# [repl.analysis]
|
||||
# passes = ["check_checker"]
|
||||
# check_checker = { trusted_sender = false, trusted_caller = false, callee_filter = false }
|
||||
|
||||
24
README.md
24
README.md
@@ -34,9 +34,8 @@ are in the form `(err uint)` and they are unique across all contracts.
|
||||
### Error table
|
||||
|
||||
<!--errors-->
|
||||
|
||||
| Contract | Constant | Value | Description |
|
||||
| ------------------------------- | -------------------------------- | ----------- | ----------- |
|
||||
|---------------------------------|----------------------------------|-------------|-------------|
|
||||
| lisa-dao | err-unauthorised | (err u1000) | |
|
||||
| lqstx-mint-endpoint | err-unauthorised | (err u1000) | |
|
||||
| lqstx-mint-endpoint-v1-01 | err-unauthorised | (err u1000) | |
|
||||
@@ -86,24 +85,44 @@ are in the form `(err uint)` and they are unique across all contracts.
|
||||
| pox-fast-pool-v2 | err-too-early | (err u500) | |
|
||||
| pox-pools-1-cycle-v2 | err-non-positive-amount | (err u500) | |
|
||||
| fastpool-member1 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member1 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member10 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member10 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member2 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member2 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member3 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member3 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member4 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member4 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member5 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member5 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member6 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member6 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member7 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member7 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member8 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member8 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member9 | err-unauthorised | (err u5000) | |
|
||||
| fastpool-member9 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member1 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member1 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member10 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member10 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member2 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member2 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member3 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member3 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member4 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member4 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member5 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member5 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member6 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member6 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member7 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member7 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member8 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member8 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member9 | err-unauthorised | (err u5000) | |
|
||||
| xverse-member9 | err-unauthorised | (err u5000) | |
|
||||
| pox-pools-1-cycle-v2 | err-no-stacker-info | (err u501) | |
|
||||
| pox-pools-1-cycle-v2 | err-no-user-info | (err u502) | |
|
||||
@@ -136,7 +155,6 @@ are in the form `(err uint)` and they are unique across all contracts.
|
||||
| token-vesting | err-event-not-vested | (err u9002) | |
|
||||
| token-vesting | err-event-already-claimed | (err u9003) | |
|
||||
| token-vesting | err-recipient-exists | (err u9004) | |
|
||||
|
||||
<!--errors-->
|
||||
|
||||
## References
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
;; SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
(impl-trait .proposal-trait.proposal-trait)
|
||||
(impl-trait 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait.proposal-trait)
|
||||
|
||||
(define-public (execute (sender principal))
|
||||
(begin
|
||||
(try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lisa-dao set-extensions (list
|
||||
{ extension: .lqstx-mint-endpoint, enabled: false }
|
||||
{ extension: .lqstx-mint-endpoint-v1-01, enabled: true }
|
||||
{ extension: 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint, enabled: false }
|
||||
{ extension: 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01, enabled: true }
|
||||
{ extension: 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-vault, enabled: true }
|
||||
{ extension: .treasury, enabled: true }
|
||||
{ extension: .token-vesting, enabled: true }
|
||||
@@ -41,8 +41,8 @@
|
||||
)))
|
||||
|
||||
;; Enable whitelist
|
||||
(try! (contract-call? .lqstx-mint-endpoint-v1-01 set-use-whitelist true))
|
||||
(try! (contract-call? .lqstx-mint-endpoint-v1-01 set-whitelisted-many
|
||||
(try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01 set-use-whitelist true))
|
||||
(try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01 set-whitelisted-many
|
||||
(list
|
||||
'SP3BQ65DRM8DMTYDD5HWMN60EYC0JFS5NC2V5CWW7
|
||||
'SP2VZBR9GCVM33BN0WXA05VJP6QV7CJ3Z3SQKJ5HH
|
||||
@@ -57,7 +57,7 @@
|
||||
true
|
||||
true
|
||||
)))
|
||||
(try! (contract-call? .lqstx-mint-endpoint-v1-01 set-paused false))
|
||||
(try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01 set-paused false))
|
||||
(ok true)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
)
|
||||
|
||||
(define-public (rebase (strategies (list 20 <strategy-trait>)))
|
||||
(let ((total-stx (- (+ (stx-get-balance 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-vault) (try! (fold sum-strategy-amounts strategies (ok u0)))) (contract-call? .lqstx-mint-endpoint-v1-01 get-mint-requests-pending-amount))))
|
||||
(let ((total-stx (- (+ (stx-get-balance 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-vault) (try! (fold sum-strategy-amounts strategies (ok u0)))) (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01 get-mint-requests-pending-amount))))
|
||||
(try! (is-dao-or-extension))
|
||||
(as-contract (try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-lqstx set-reserve total-stx)))
|
||||
(ok total-stx)
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
(define-public (finalize-mint (request-id uint))
|
||||
(begin
|
||||
(try! (rebase))
|
||||
(as-contract (try! (contract-call? .lqstx-mint-endpoint-v1-01 finalize-mint request-id)))
|
||||
(as-contract (try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01 finalize-mint request-id)))
|
||||
(try! (rebase))
|
||||
(ok true)))
|
||||
|
||||
(define-public (finalize-burn (request-id uint))
|
||||
(begin
|
||||
(try! (rebase))
|
||||
(as-contract (try! (contract-call? .lqstx-mint-endpoint-v1-01 finalize-burn request-id)))
|
||||
(as-contract (try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01 finalize-burn request-id)))
|
||||
(try! (rebase))
|
||||
(ok true)))
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
(let (
|
||||
(sender tx-sender)
|
||||
(send-token (try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-lqstx transfer amount sender (as-contract tx-sender) none)))
|
||||
(request-data (as-contract (try! (contract-call? .lqstx-mint-endpoint-v1-01 request-burn sender amount)))))
|
||||
(request-data (as-contract (try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01 request-burn sender amount)))))
|
||||
(match (finalize-burn (get request-id request-data))
|
||||
ok-value (ok { request-id: (get request-id request-data), status: FINALIZED })
|
||||
err-value (ok request-data))))
|
||||
|
||||
45
contracts/extensions/auto-whitelist-mint-helper.clar
Normal file
45
contracts/extensions/auto-whitelist-mint-helper.clar
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
;; SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
;; snapshot block height for cycle #80 and #81
|
||||
(define-constant stacks-snapshot-height1 u144186) ;; btc height 836387
|
||||
(define-constant stacks-snapshot-height2 u142306) ;; btc height 834056
|
||||
|
||||
(define-constant fastpool-pox-address {version: 0x04, hashbytes: 0x83ed66860315e334010bbfb76eb3eef887efee0a}) ;; bc1qs0kkdpsrzh3ngqgth7mkavlwlzr7lms2zv3wxe
|
||||
(define-constant xverse-pox-address {version: 0x04, hashbytes: 0xdb14133a9dbb1d0e16b60513453e48b6ff2847a9}) ;; bc1qmv2pxw5ahvwsu94kq5f520jgkmljs3af8ly6tr
|
||||
|
||||
(define-read-only (is-eligible-pox-address (pox-address { version: (buff 1), hashbytes: (buff 32) }))
|
||||
(or (is-eq pox-address fastpool-pox-address) (is-eq pox-address xverse-pox-address))
|
||||
)
|
||||
|
||||
(define-read-only (is-whitelisted (who principal))
|
||||
(contract-call? .lqstx-mint-endpoint-v1-02 is-whitelisted-or-mint-for-all who)
|
||||
)
|
||||
|
||||
(define-private (set-whitelisted (who principal))
|
||||
(contract-call? .lqstx-mint-endpoint-v1-02 set-whitelisted who true)
|
||||
)
|
||||
|
||||
(define-read-only (was-stacking-in-eligible-pool-height (who principal) (height uint))
|
||||
(at-block (unwrap! (get-block-info? id-header-hash height) false)
|
||||
(is-eligible-pox-address (get pox-addr (unwrap! (contract-call? 'SP000000000000000000002Q6VF78.pox-3 get-stacker-info who) false)))
|
||||
)
|
||||
)
|
||||
|
||||
(define-read-only (was-stacking-in-eligible-pool (who principal))
|
||||
(or
|
||||
(was-stacking-in-eligible-pool-height who stacks-snapshot-height1)
|
||||
(was-stacking-in-eligible-pool-height who stacks-snapshot-height2)
|
||||
)
|
||||
)
|
||||
|
||||
(define-public (request-mint (amount uint))
|
||||
(begin
|
||||
(and
|
||||
(not (is-whitelisted tx-sender))
|
||||
(was-stacking-in-eligible-pool tx-sender)
|
||||
(try! (set-whitelisted tx-sender))
|
||||
)
|
||||
(contract-call? .lqstx-mint-endpoint-v1-02 request-mint amount)
|
||||
)
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
;; SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
(use-trait proposal-trait .proposal-trait.proposal-trait)
|
||||
(use-trait proposal-trait 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait.proposal-trait)
|
||||
|
||||
(define-constant err-unauthorised (err u1000))
|
||||
(define-constant err-not-operator (err u1001))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
;; lisa dao
|
||||
|
||||
(use-trait proposal-trait .proposal-trait.proposal-trait)
|
||||
(use-trait proposal-trait 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait.proposal-trait)
|
||||
(use-trait extension-trait .extension-trait.extension-trait)
|
||||
|
||||
(define-constant err-unauthorised (err u1000))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
;; SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
(impl-trait .proposal-trait.proposal-trait)
|
||||
(impl-trait 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait.proposal-trait)
|
||||
|
||||
(define-public (execute (sender principal))
|
||||
(begin
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
;; SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
(impl-trait .proposal-trait.proposal-trait)
|
||||
(impl-trait 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait.proposal-trait)
|
||||
|
||||
(define-public (execute (sender principal))
|
||||
(begin
|
||||
@@ -39,8 +39,8 @@
|
||||
true
|
||||
true
|
||||
)))
|
||||
(try! (contract-call? .lqstx-mint-endpoint set-paused true))
|
||||
(try! (contract-call? .lqstx-mint-endpoint-v1-01 set-paused true))
|
||||
(try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint set-paused true))
|
||||
(try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01 set-paused true))
|
||||
(try! (contract-call? .lqstx-mint-endpoint-v1-02 set-paused false))
|
||||
|
||||
(try! (contract-call? .endpoint-whitelist-helper-v1-02 set-authorised-operator 'SP3BQ65DRM8DMTYDD5HWMN60EYC0JFS5NC2V5CWW7 true))
|
||||
|
||||
14
contracts/proposals/lip002.clar
Normal file
14
contracts/proposals/lip002.clar
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
;; SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
(impl-trait 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait.proposal-trait)
|
||||
|
||||
(define-public (execute (sender principal))
|
||||
(begin
|
||||
(try! (contract-call? .li-stx-mint-nft mint u2 u0 'SP3BQ65DRM8DMTYDD5HWMN60EYC0JFS5NC2V5CWW7))
|
||||
(try! (contract-call? .li-stx-mint-nft mint u3 u0 'SP3BQ65DRM8DMTYDD5HWMN60EYC0JFS5NC2V5CWW7))
|
||||
(try! (contract-call? .li-stx-mint-nft mint u4 u0 'SPFJVM9Y1A4KJ31T8ZBDESZH36YGPDAZ9WXEFC53))
|
||||
(try! (contract-call? .li-stx-mint-nft mint u5 u0 'SP2VZBR9GCVM33BN0WXA05VJP6QV7CJ3Z3SQKJ5HH))
|
||||
(ok true)
|
||||
)
|
||||
)
|
||||
11
contracts/proposals/lip003.clar
Normal file
11
contracts/proposals/lip003.clar
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
;; SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
(impl-trait 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait.proposal-trait)
|
||||
|
||||
(define-public (execute (sender principal))
|
||||
(begin
|
||||
(try! (contract-call? 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lisa-dao set-extension .auto-whitelist-mint-helper true))
|
||||
(ok true)
|
||||
)
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
;; SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
(impl-trait .proposal-trait.proposal-trait)
|
||||
(impl-trait 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait.proposal-trait)
|
||||
|
||||
(define-public (execute (sender principal))
|
||||
(begin
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
;; SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
(impl-trait .proposal-trait.proposal-trait)
|
||||
(impl-trait 'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.proposal-trait.proposal-trait)
|
||||
|
||||
(define-public (execute (sender principal))
|
||||
(begin
|
||||
|
||||
@@ -205,11 +205,44 @@ plan:
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-vault.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: rebase-strategy-trait
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.rebase-strategy-trait.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: stx-transfer-proxy
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.stx-transfer-proxy.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: token-lqstx
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-lqstx.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: token-vlqstx
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-vlqstx.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lqstx-mint-endpoint
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lqstx-mint-endpoint-v1-01
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lqstx-mint-endpoint-v1-01.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: pox-pools-1-cycle-v2
|
||||
emulated-sender: SP001SFSMC2ZY76PD4M68P3WGX154XCH7NE3TYMX
|
||||
path: "./.cache/requirements/SP001SFSMC2ZY76PD4M68P3WGX154XCH7NE3TYMX.pox-pools-1-cycle-v2.clar"
|
||||
clarity-version: 2
|
||||
epoch: "2.4"
|
||||
- id: 3
|
||||
transactions:
|
||||
- emulated-contract-publish:
|
||||
contract-name: xverse-member1
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
@@ -240,9 +273,6 @@ plan:
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.xverse-member5.clar"
|
||||
clarity-version: 2
|
||||
epoch: "2.4"
|
||||
- id: 3
|
||||
transactions:
|
||||
- emulated-contract-publish:
|
||||
contract-name: xverse-member6
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
@@ -269,29 +299,24 @@ plan:
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.public-pools-strategy.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: stx-transfer-proxy
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.stx-transfer-proxy.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: token-lqstx
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-lqstx.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: token-vlqstx
|
||||
emulated-sender: SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH
|
||||
path: "./.cache/requirements/SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-vlqstx.clar"
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lqstx-mint-endpoint-v1-01
|
||||
contract-name: li-stx-burn-nft
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/deployed/lqstx-mint-endpoint-v1-01.clar
|
||||
path: contracts/aux/li-stx-burn-nft.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: proposal-trait
|
||||
contract-name: li-stx-mint-nft
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/traits/proposal-trait.clar
|
||||
path: contracts/aux/li-stx-mint-nft.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lqstx-mint-endpoint-v1-02
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/extensions/lqstx-mint-endpoint.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: auto-whitelist-mint-helper
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/extensions/auto-whitelist-mint-helper.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: operators
|
||||
@@ -318,21 +343,6 @@ plan:
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/traits/commission-trait.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: li-stx-burn-nft
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/aux/li-stx-burn-nft.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: li-stx-mint-nft
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/aux/li-stx-mint-nft.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lqstx-mint-endpoint-v1-02
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/extensions/lqstx-mint-endpoint.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: endpoint-whitelist-helper-v1-02
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
@@ -358,6 +368,9 @@ plan:
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/strategies/public-pools/fastpool-member.clar
|
||||
clarity-version: 2
|
||||
epoch: "2.4"
|
||||
- id: 4
|
||||
transactions:
|
||||
- emulated-contract-publish:
|
||||
contract-name: fastpool-member3
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
@@ -368,9 +381,6 @@ plan:
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/strategies/public-pools/fastpool-member.clar
|
||||
clarity-version: 2
|
||||
epoch: "2.4"
|
||||
- id: 4
|
||||
transactions:
|
||||
- emulated-contract-publish:
|
||||
contract-name: fastpool-member5
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
@@ -396,21 +406,21 @@ plan:
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/strategies/public-pools/fastpool-member.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: rebase-strategy-trait
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/deployed/rebase-strategy-trait.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lqstx-mint-endpoint
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/deployed/lqstx-mint-endpoint.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lip001
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/proposals/lip001.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lip002
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/proposals/lip002.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lip003
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/proposals/lip003.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: lisa-rebase
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
@@ -456,6 +466,11 @@ plan:
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/deployed/rebase-1.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: rebase-strategy-trait
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/deployed/rebase-strategy-trait.clar
|
||||
clarity-version: 2
|
||||
- emulated-contract-publish:
|
||||
contract-name: rebase-strategy-trait-v1-01
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
@@ -481,6 +496,9 @@ plan:
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/traits/sip-010-trait.clar
|
||||
clarity-version: 2
|
||||
epoch: "2.4"
|
||||
- id: 5
|
||||
transactions:
|
||||
- emulated-contract-publish:
|
||||
contract-name: sip-010-transferable-trait
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
@@ -496,9 +514,6 @@ plan:
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
path: contracts/extensions/token-vesting.clar
|
||||
clarity-version: 2
|
||||
epoch: "2.4"
|
||||
- id: 5
|
||||
transactions:
|
||||
- emulated-contract-publish:
|
||||
contract-name: token-wlqstx
|
||||
emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
ClarityValue,
|
||||
contractPrincipalCV,
|
||||
makeUnsignedSTXTokenTransfer,
|
||||
getNonce,
|
||||
} from '@stacks/transactions';
|
||||
import type { StacksNetworkName } from '@stacks/network';
|
||||
import { initSimnet } from '@hirosystems/clarinet-sdk';
|
||||
@@ -29,16 +30,70 @@ const manifestFile = './Clarinet.toml';
|
||||
const simnetDeployFile = 'deployments/default.simnet-plan.yaml';
|
||||
const lisaDaoContractName = 'lisa-dao';
|
||||
|
||||
const contractsToSkip = ['regtest-boot', 'token-vesting', 'simnet-boot'];
|
||||
const contractsToSkip = [
|
||||
"regtest-boot",
|
||||
"token-vesting",
|
||||
"simnet-boot",
|
||||
"extension-trait",
|
||||
"proposal-trait",
|
||||
"lisa-dao",
|
||||
"lqstx-mint-registry",
|
||||
"proxy-trait",
|
||||
"strategy-trait",
|
||||
"lqstx-vault",
|
||||
"stx-transfer-proxy",
|
||||
"token-lqstx",
|
||||
"token-vlqstx",
|
||||
"lqstx-mint-endpoint-v1-01",
|
||||
"operators",
|
||||
"fastpool-member1",
|
||||
"fastpool-member10",
|
||||
"fastpool-member2",
|
||||
"fastpool-member3",
|
||||
"fastpool-member4",
|
||||
"fastpool-member5",
|
||||
"fastpool-member6",
|
||||
"fastpool-member7",
|
||||
"fastpool-member8",
|
||||
"fastpool-member9",
|
||||
"xverse-member1",
|
||||
"xverse-member10",
|
||||
"xverse-member2",
|
||||
"xverse-member3",
|
||||
"xverse-member4",
|
||||
"xverse-member5",
|
||||
"xverse-member6",
|
||||
"xverse-member7",
|
||||
"xverse-member8",
|
||||
"xverse-member9",
|
||||
"public-pools-strategy",
|
||||
"public-pools-strategy-manager",
|
||||
"token-lisa",
|
||||
"boot",
|
||||
"commission-trait",
|
||||
"lisa-rebase",
|
||||
"lisa-transfer-proxy",
|
||||
"rebase-strategy-trait",
|
||||
"lqstx-mint-endpoint",
|
||||
"lqstx-transfer-proxy",
|
||||
"nft-trait",
|
||||
"rebase-1",
|
||||
"rebase-strategy-trait-v1-01",
|
||||
"sip-010-extensions-trait",
|
||||
"sip-010-trait",
|
||||
"sip-010-transferable-trait",
|
||||
"stx-transfer-many-proxy",
|
||||
"treasury",
|
||||
];
|
||||
|
||||
const network = getNetwork();
|
||||
const mainnetDeploy = isMainnet();
|
||||
const address = getStacksAddress();
|
||||
const pubKeys = getStacksPubkeys();
|
||||
let nonce = 0;
|
||||
const feeMultiplier = 10000; // transaction bytes * feeMultiplier
|
||||
const feeAddition = 1; // add a flat amount on top
|
||||
const feeCap = 0; //15 * 1000000; // 15 STX
|
||||
let nonce = -1; // set to -1 to fetch from network
|
||||
const feeMultiplier = 1000; // transaction bytes * feeMultiplier
|
||||
const feeAddition = 0; // add a flat amount on top
|
||||
const feeCap = 7 * 1000000; // 7 STX
|
||||
|
||||
const testnetAddressReplacements = {
|
||||
// zero address
|
||||
@@ -59,9 +114,16 @@ const testnetAddressReplacements = {
|
||||
SPGAB1P3YV109E22KXFJYM63GK0G21BYX50CQ80B: 'ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB',
|
||||
};
|
||||
|
||||
const fundingTransactions = {
|
||||
SP12BFYTH3NJ6N63KE0S50GHSYV0M91NGQND2B704: 10 * 1000000,
|
||||
SP1ZPTDQ3801C1AYEZ37NJWNDZ3HM60HC2TCFP228: 10 * 1000000,
|
||||
SPGAB1P3YV109E22KXFJYM63GK0G21BYX50CQ80B: 10 * 1000000
|
||||
};
|
||||
|
||||
const multisigSpendConditionByteLength = 66; // don't change
|
||||
|
||||
let tempTotalFee = 0n;
|
||||
let includesBootContract = false;
|
||||
|
||||
type PlanItem = {
|
||||
contractName: string;
|
||||
@@ -157,7 +219,7 @@ async function createMultisigDeployTransaction(
|
||||
assertSigner(tx.auth.spendingCondition, checkSigner);
|
||||
let calculatedFee =
|
||||
(tx.serialize().byteLength + multisigSpendConditionByteLength * pubKeys.length) *
|
||||
feeMultiplier +
|
||||
feeMultiplier +
|
||||
feeAddition;
|
||||
if (feeCap > 0 && calculatedFee > feeCap) calculatedFee = feeCap;
|
||||
tx.setFee(calculatedFee);
|
||||
@@ -200,10 +262,11 @@ async function createMultisigStxTransaction(
|
||||
assertSigner(tx.auth.spendingCondition, signer);
|
||||
let calculatedFee =
|
||||
(tx.serialize().byteLength + multisigSpendConditionByteLength * pubKeys.length) *
|
||||
feeMultiplier +
|
||||
feeMultiplier +
|
||||
feeAddition;
|
||||
if (feeCap > 0 && calculatedFee > feeCap) calculatedFee = feeCap;
|
||||
tx.setFee(calculatedFee);
|
||||
verboseLog(`Created STX transfer to ${recipient} to the amount of ${amount}, calculated fee is ${calculatedFee}`);
|
||||
tempTotalFee += BigInt(calculatedFee);
|
||||
return tx;
|
||||
}
|
||||
@@ -252,12 +315,12 @@ async function createMultisigBootTransaction(
|
||||
assertSigner(tx.auth.spendingCondition, signer);
|
||||
let calculatedFee =
|
||||
(tx.serialize().byteLength + multisigSpendConditionByteLength * pubKeys.length) *
|
||||
feeMultiplier +
|
||||
feeMultiplier +
|
||||
feeAddition;
|
||||
if (feeCap > 0 && calculatedFee > feeCap) calculatedFee = feeCap;
|
||||
tx.setFee(calculatedFee);
|
||||
tempTotalFee += BigInt(calculatedFee);
|
||||
verboseLog(`Created boot transaction`);
|
||||
verboseLog(`Created boot transaction, calculated fee is ${calculatedFee}`);
|
||||
return tx;
|
||||
}
|
||||
|
||||
@@ -287,7 +350,24 @@ function findStxBootstrapAmountAtom(items: any[]): bigint | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
deployPlan()
|
||||
async function fetchNonce() {
|
||||
if (nonce !== -1)
|
||||
return;
|
||||
const addressString = addressToString(address);
|
||||
let currentNonce = 0n;
|
||||
try {
|
||||
currentNonce = await getNonce(addressString, network);
|
||||
}
|
||||
catch (error) {
|
||||
console.log('Failed to fetch current nonce - might happen on devnet');
|
||||
throw error;
|
||||
}
|
||||
verboseLog(`${addressString} account nonce is ${currentNonce}`);
|
||||
nonce = Number(currentNonce);
|
||||
}
|
||||
|
||||
fetchNonce()
|
||||
.then(deployPlan)
|
||||
.then(plan =>
|
||||
plan.filter(item => {
|
||||
if (contractsToSkip.indexOf(item.contractName) !== -1) {
|
||||
@@ -296,6 +376,8 @@ deployPlan()
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (item.contractName === "boot")
|
||||
includesBootContract = true;
|
||||
return true;
|
||||
})
|
||||
)
|
||||
@@ -339,22 +421,40 @@ deployPlan()
|
||||
plan.push(bytesToHex(addPubkeyFields(fundingTx, pubKeys).serialize()));
|
||||
}
|
||||
|
||||
const bootTx = await createMultisigBootTransaction(
|
||||
addressString,
|
||||
lisaDaoContractName,
|
||||
'construct',
|
||||
[contractPrincipalCV(addressString, 'boot')],
|
||||
feeMultiplier,
|
||||
nonce++,
|
||||
pubKeys.length,
|
||||
pubKeys,
|
||||
network,
|
||||
address,
|
||||
bootstrapStxAmount ?? 0n,
|
||||
`${addressString}.${lisaDaoContractName}`
|
||||
);
|
||||
for (const [recipient, amount] of Object.entries(fundingTransactions)) {
|
||||
const fundingTx = await createMultisigStxTransaction(
|
||||
BigInt(amount),
|
||||
recipient,
|
||||
feeMultiplier,
|
||||
nonce++,
|
||||
pubKeys.length,
|
||||
pubKeys,
|
||||
address
|
||||
);
|
||||
plan.push(bytesToHex(addPubkeyFields(fundingTx, pubKeys).serialize()));
|
||||
}
|
||||
|
||||
plan.push(bytesToHex(addPubkeyFields(bootTx, pubKeys).serialize()));
|
||||
if (includesBootContract) {
|
||||
const bootTx = await createMultisigBootTransaction(
|
||||
addressString,
|
||||
lisaDaoContractName,
|
||||
'construct',
|
||||
[contractPrincipalCV(addressString, 'boot')],
|
||||
feeMultiplier,
|
||||
nonce++,
|
||||
pubKeys.length,
|
||||
pubKeys,
|
||||
network,
|
||||
address,
|
||||
bootstrapStxAmount ?? 0n,
|
||||
`${addressString}.${lisaDaoContractName}`
|
||||
);
|
||||
|
||||
plan.push(bytesToHex(addPubkeyFields(bootTx, pubKeys).serialize()));
|
||||
}
|
||||
else {
|
||||
verboseLog('Skipping boot transaction because plan does not include boot contract');
|
||||
}
|
||||
return plan;
|
||||
})
|
||||
.then(plan => {
|
||||
|
||||
@@ -17,9 +17,7 @@ import {
|
||||
import { bytesToHex } from '@stacks/common';
|
||||
import fs from "fs";
|
||||
import { getStacksAddress, getStacksPrivateKeys, getStacksPubkeys } from "./config.ts";
|
||||
import { assertSigner, equalByteArrays, readPlan, verboseLog } from "./utils.ts";
|
||||
|
||||
const planFile = "plan.json";
|
||||
import { planFile, assertSigner, equalByteArrays, readPlan, verboseLog } from "./utils.ts";
|
||||
|
||||
const privateKeys = getStacksPrivateKeys();
|
||||
const address = getStacksAddress();
|
||||
|
||||
Reference in New Issue
Block a user