|
2 | 2 | ;; PROPERTY-BASED TESTS |
3 | 3 | ;; ============================================ |
4 | 4 |
|
5 | | -(define-public (test-register (csw <csw-trait>)) |
| 5 | +(define-public (test-register-valid-csw (csw <csw-trait>)) |
6 | 6 | (let ( |
7 | 7 | (csw-contract (contract-of csw)) |
8 | 8 | ) |
|
12 | 12 | (is-some (map-get? csw-to-index csw-contract)) |
13 | 13 | ;; The tx-sender is not the owner of the csw. |
14 | 14 | (not (is-eq (unwrap-panic (contract-call? csw get-owner)) tx-sender)) |
| 15 | + ;; Discard invalid csw implementations. |
| 16 | + (not |
| 17 | + (is-eq |
| 18 | + (contract-hash? (contract-of csw)) |
| 19 | + (contract-hash? .smart-wallet-standard) |
| 20 | + ) |
| 21 | + ) |
15 | 22 | ) |
16 | 23 | ;; Discard invalid inputs. |
17 | 24 | (ok false) |
|
43 | 50 | ) |
44 | 51 | ) |
45 | 52 |
|
| 53 | +(define-public (test-register-invalid-csw (csw <csw-trait>)) |
| 54 | + (let ( |
| 55 | + (csw-contract (contract-of csw)) |
| 56 | + ) |
| 57 | + (if |
| 58 | + (or |
| 59 | + ;; The csw is already registered. |
| 60 | + (is-some (map-get? csw-to-index csw-contract)) |
| 61 | + ;; The tx-sender is not the owner of the csw. |
| 62 | + (not (is-eq (unwrap-panic (contract-call? csw get-owner)) tx-sender)) |
| 63 | + ;; Discard valid csw implementations. |
| 64 | + (is-eq |
| 65 | + (contract-hash? (contract-of csw)) |
| 66 | + (contract-hash? .smart-wallet-standard) |
| 67 | + ) |
| 68 | + ) |
| 69 | + ;; Discard invalid inputs. |
| 70 | + (ok false) |
| 71 | + (let ( |
| 72 | + (index-before (var-get csw-index)) |
| 73 | + (has-primary-csw-before (is-some (map-get? primary-csw tx-sender))) |
| 74 | + (register-error (unwrap-err! (csw-register csw) (err u998))) |
| 75 | + ) |
| 76 | + (asserts! (is-eq (err register-error) ERR-INVALID-CSW-CONTRACT) (err u999)) |
| 77 | + (ok true) |
| 78 | + ) |
| 79 | + ) |
| 80 | + ) |
| 81 | +) |
| 82 | + |
46 | 83 | (define-public (test-transfer (csw <csw-trait>) (recipient principal)) |
47 | 84 | (let ( |
48 | 85 | (wallet-owner (unwrap-panic (contract-call? csw get-owner))) |
|
0 commit comments