File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 11;; Properties
22
33(define-constant ERR_ASSERTION_FAILED (err u1001 ))
4+ (define-constant ERR_UNWRAP_FAILURE (err u1002 ))
45
56(define-constant deployer tx-sender )
7+ (define-constant dust_limit_error_code u502 )
68
79;; This is a test utility, not an assertion. It randomly mints sbtc-tokens to
810;; users, supporting other tests.
9597 (ok true )
9698 )
9799 )
100+ )
101+
102+ (define-public (test-initiate-withdrawal-dust-amount
103+ (amount uint )
104+ (recipient { version : (buff 1 ), hashbytes : (buff 32 ) })
105+ (max-fee uint )
106+ )
107+ (if
108+ (or
109+ (is-eq amount u0 )
110+ (> amount DUST_LIMIT)
111+ (<
112+ (unwrap-panic
113+ (contract-call? .sbtc-token get-balance-available tx-sender )
114+ )
115+ (+ amount max-fee)
116+ )
117+ )
118+ (ok false )
119+ (let
120+ (
121+ (withdrawal-request-result
122+ (initiate-withdrawal-request amount recipient max-fee)
123+ )
124+ )
125+ (asserts!
126+ (and
127+ (is-err withdrawal-request-result)
128+ (is-eq
129+ (unwrap-err! withdrawal-request-result ERR_UNWRAP_FAILURE)
130+ dust_limit_error_code
131+ )
132+ )
133+ ERR_ASSERTION_FAILED
134+ )
135+ (ok true )
136+ )
137+ )
98138)
You can’t perform that action at this time.
0 commit comments