File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040 )
4141)
4242
43+ ;; Uses native transfer-many function with standard tuple format. More
44+ ;; efficient cost-wise but supports fewer recipients.
45+ ;;
46+ ;; Max recipients:
47+ ;; - 19 standard principals
48+ ;; - 5 contract principals
49+ (define-private (sbtc-transfer-many-native (recipients (list
50+ 200
51+ {
52+ amount : uint ,
53+ sender : principal ,
54+ to : principal ,
55+ memo : (optional (buff 34 )),
56+ }
57+ )))
58+ (contract-call? 'SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token
59+ transfer-many recipients
60+ )
61+ )
62+
4363(define-private (sbtc-transfer
4464 (amount uint )
4565 (from principal )
5070 )
5171)
5272
73+ (define-private (to-native (transfer {
74+ a : uint ,
75+ r : principal ,
76+ }))
77+ {
78+ amount : (get a transfer),
79+ sender : tx-sender ,
80+ to : (get r transfer),
81+ memo : none ,
82+ }
83+ )
84+
5385(define-public (call (payload (buff 2048 )))
5486 (let ((details (unwrap!
5587 (from-consensus-buff? {
6698 )
6799 err-invalid-payload
68100 )))
69- (try! (sbtc-transfer-many-custom ( get recipients details)))
101+ (try! (sbtc-transfer-many-native ( map to-native ( get recipients details) )))
70102 (match tx-sponsor ?
71103 spnsr (let ((fees (get fees details)))
72104 (and (> fees u0 ) (try! (sbtc-transfer fees tx-sender spnsr)))
Original file line number Diff line number Diff line change 99 ustx : uint ,
1010 to : principal ,
1111})))
12- (contract-call? 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-many send-many recipients)
12+ (contract-call? 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-many send-many
13+ recipients
14+ )
1315)
1416
1517(define-public (call (payload (buff 2048 )))
Original file line number Diff line number Diff line change 2020 )
2121)
2222
23- (define-public (stx-send-many-sponsored (sm <wallet-trait>) (details {
24- recipients : (list 11 {
25- ustx : uint ,
26- to : principal ,
27- }),
28- fees : uint ,
29- }))
23+ (define-public (stx-send-many-sponsored
24+ (sm <wallet-trait>)
25+ (details {
26+ recipients : (list 11 {
27+ ustx : uint ,
28+ to : principal ,
29+ }),
30+ fees : uint ,
31+ })
32+ )
3033 (contract-call? sm extension-call .ext-sponsored-send-many
3134 (unwrap! (to-consensus-buff? details) err-invalid-payload)
3235 )
4851(define-public (sbtc-transfer-many-sponsored
4952 (sm <wallet-trait>)
5053 (details {
51- recipients : (list 11 {
54+ recipients : (list 11
55+ {
5256 ;; Amount in sats.
5357 a : uint ,
5458 ;; Recipient address.
Original file line number Diff line number Diff line change 142142)
143143
144144;; init
145- (map-set admins tx-sender true )
145+ (map-set admins tx-sender true )
146146(map-set admins (as-contract tx-sender ) true )
Original file line number Diff line number Diff line change 136136)
137137
138138;; init
139- (map-set admins tx-sender true )
139+ (map-set admins tx-sender true )
140140(map-set admins (as-contract tx-sender ) true )
Original file line number Diff line number Diff line change 2121 (ok true )
2222 )
2323)
24-
Original file line number Diff line number Diff line change 171171
172172;; init
173173(set-security-level u1 )
174- (map-set admins .inactive-observer true )
174+ (map-set admins .inactive-observer true )
175175(map-set admins tx-sender true ) ;; send 1000 ustx to the smart wallet(stx-transfer? u1000 tx-sender (as-contract tx-sender))
You can’t perform that action at this time.
0 commit comments