diff --git a/Clarinet.toml b/Clarinet.toml index 1cb40af..d486d7f 100644 --- a/Clarinet.toml +++ b/Clarinet.toml @@ -305,6 +305,10 @@ path = "contracts_modules/alex_v1/traits/trait-sip-010.clar" path = "contracts/proposals/lip001.clar" epoch = 2.4 +[contracts.endpoint-whitelist-helper-v1-02] +path = "contracts/aux/endpoint-whitelist-helper.clar" +epoch = 2.4 + # [repl.analysis] # passes = ["check_checker"] # check_checker = { trusted_sender = false, trusted_caller = false, callee_filter = false } diff --git a/contracts/aux/endpoint-whitelist-helper.clar b/contracts/aux/endpoint-whitelist-helper.clar new file mode 100644 index 0000000..94af283 --- /dev/null +++ b/contracts/aux/endpoint-whitelist-helper.clar @@ -0,0 +1,32 @@ +(define-constant err-unauthorised (err u3000)) + +(define-map authorised-operators principal bool) +(map-set authorised-operators tx-sender true) + +(define-read-only (is-dao-or-extension) + (ok (asserts! (or (is-eq tx-sender .lisa-dao) (contract-call? .lisa-dao is-extension contract-caller)) err-unauthorised)) +) + +(define-read-only (is-authorised-operator (who principal)) + (default-to false (map-get? authorised-operators who)) +) + +;; governance calls + +(define-public (set-authorised-operator (who principal) (enabled bool)) + (begin + (try! (is-dao-or-extension)) + (ok (map-set authorised-operators who enabled)) + ) +) + +;; priviliged calls +(define-public (set-use-whitelist (enabled bool)) + (begin + (asserts! (is-authorised-operator tx-sender) err-unauthorised) + (contract-call? .lqstx-mint-endpoint-v1-02 set-use-whitelist enabled))) + +(define-public (set-whitelisted-many (addresses (list 1000 principal)) (enabled (list 1000 bool))) + (begin + (asserts! (is-authorised-operator tx-sender) err-unauthorised) + (contract-call? .lqstx-mint-endpoint-v1-02 set-whitelisted-many addresses enabled))) \ No newline at end of file diff --git a/contracts/proposals/lip001.clar b/contracts/proposals/lip001.clar index 22b3e92..efd4824 100644 --- a/contracts/proposals/lip001.clar +++ b/contracts/proposals/lip001.clar @@ -6,12 +6,12 @@ (define-public (execute (sender principal)) (begin (try! (contract-call? .lisa-dao set-extensions (list + { extension: .lqstx-mint-endpoint, enabled: false } { extension: .lqstx-mint-endpoint-v1-01, enabled: false } { extension: .lqstx-mint-endpoint-v1-02, enabled: true } { extension: .lisa-rebase, enabled: false } { extension: .rebase-1, enabled: false } - { extension: .lisa-rebase-v1-02, enabled: true } - { extension: .rebase-1-v1-02, enabled: true } + { extension: .endpoint-whitelist-helper-v1-02, enabled: true } ))) (try! (contract-call? .token-lqstx dao-set-name "LiSTX")) @@ -39,7 +39,17 @@ 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? .lqstx-mint-endpoint-v1-02 set-paused false)) + + (try! (contract-call? .endpoint-whitelist-helper-v1-02 set-authorised-operator 'SP3BQ65DRM8DMTYDD5HWMN60EYC0JFS5NC2V5CWW7 true)) + (try! (contract-call? .endpoint-whitelist-helper-v1-02 set-authorised-operator 'SP2VZBR9GCVM33BN0WXA05VJP6QV7CJ3Z3SQKJ5HH true)) + (try! (contract-call? .endpoint-whitelist-helper-v1-02 set-authorised-operator 'SP12BFYTH3NJ6N63KE0S50GHSYV0M91NGQND2B704 true)) + (try! (contract-call? .endpoint-whitelist-helper-v1-02 set-authorised-operator 'SPGAB1P3YV109E22KXFJYM63GK0G21BYX50CQ80B true)) + (try! (contract-call? .endpoint-whitelist-helper-v1-02 set-authorised-operator 'SPFJVM9Y1A4KJ31T8ZBDESZH36YGPDAZ9WXEFC53 true)) + (try! (contract-call? .endpoint-whitelist-helper-v1-02 set-authorised-operator 'SPHFAXDZVFHMY8YR3P9J7ZCV6N89SBET203ZAY25 true)) + (ok true) ) ) diff --git a/deployments/default.simnet-plan.yaml b/deployments/default.simnet-plan.yaml index 5af8ed9..9c6efbd 100644 --- a/deployments/default.simnet-plan.yaml +++ b/deployments/default.simnet-plan.yaml @@ -328,6 +328,21 @@ plan: 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 + path: contracts/aux/endpoint-whitelist-helper.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 @@ -343,16 +358,6 @@ plan: emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM path: contracts/proxies/lisa-transfer-proxy.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: lqstx-transfer-proxy emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM @@ -363,14 +368,14 @@ plan: emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM path: contracts/mocks/mock-proposal.clar clarity-version: 2 + epoch: "2.4" + - id: 4 + transactions: - emulated-contract-publish: contract-name: mock-strategy emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM path: contracts/mocks/mock-strategy.clar clarity-version: 2 - epoch: "2.4" - - id: 4 - transactions: - emulated-contract-publish: contract-name: mock-strategy-manager emulated-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM