-
Notifications
You must be signed in to change notification settings - Fork 677
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { clarunit } from "clarunit"; | ||
clarunit(simnet); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(define-constant mock-pox-reward-wallet-1 { version: 0x06, hashbytes: 0x0011223344556699001122334455669900112233445566990011223344556699 }) | ||
(define-constant mock-pox-reward-wallet-invalid { version: 0x06, hashbytes: 0x00112233445566990011223344556699001122334455669900112233445566 }) | ||
(define-constant mock-pox-hashbytes-invalid 0x00112233445566990011223344556699001122334455669900112233445566) | ||
|
||
(define-public (test-mock-set-stx-account) | ||
(begin | ||
(unwrap! (contract-call? .pox-4 mock-set-stx-account 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5 {locked: u1, unlock-height: u2100, unlocked: u0}) (err u111)) | ||
(asserts! (is-eq u1 (get locked (contract-call? .pox-4 get-stx-account 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5))) (err u111)) | ||
(ok true))) | ||
|
||
(define-public (test-get-mocked-stx-account) | ||
(begin | ||
(asserts! (is-eq u0 (get unlock-height (contract-call? .pox-4 get-stx-account 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5))) (err u111)) | ||
(ok true))) | ||
|
||
(define-public (test-burn-height-to-reward-cycle) | ||
(begin | ||
(asserts! (is-eq u1 (contract-call? .pox-4 burn-height-to-reward-cycle u2099)) (err u111)) | ||
(ok true))) | ||
|
||
(define-public (test-reward-cycle-to-burn-height) | ||
(begin | ||
(asserts! (is-eq u0 (contract-call? .pox-4 reward-cycle-to-burn-height u0)) (err u111)) | ||
(ok true))) | ||
|
||
(define-public (test-get-stacker-info-none) | ||
(begin | ||
(asserts! (is-none (contract-call? .pox-4 get-stacker-info tx-sender)) (err u111)) | ||
(ok true))) | ||
|
||
(define-public (test-invalid-pox-addr-version) | ||
(let | ||
((actual (contract-call? .pox-4 check-pox-addr-version 0x07))) | ||
(asserts! (not actual) (err u111)) | ||
(ok true))) | ||
|
||
(define-public (test-invalid-pox-addr-hashbytes-length) | ||
(let | ||
((actual (contract-call? .pox-4 check-pox-addr-hashbytes 0x00 mock-pox-hashbytes-invalid))) | ||
(asserts! (not actual) (err u111)) | ||
(ok true))) | ||
|
||
(define-public (test-invalid-lock-height-too-low) | ||
(let | ||
((actual (contract-call? .pox-4 check-pox-lock-period u0))) | ||
(asserts! (not actual) (err u111)) | ||
(ok true))) | ||
|
||
(define-public (test-invalid-lock-height-too-high) | ||
(let | ||
((actual (contract-call? .pox-4 check-pox-lock-period u13))) | ||
(asserts! (not actual) (err u111)) | ||
(ok true))) | ||
|
||
(define-public (test-get-total-ustx-stacked) | ||
(begin | ||
;; @continue | ||
(asserts! (is-eq (contract-call? .pox-4 get-total-ustx-stacked u1) u0) (err u111)) | ||
(ok true))) |