Skip to content

Commit d792ad5

Browse files
committed
refactor: Update treasury print statements to use notification and payload format
1 parent 7636a92 commit d792ad5

File tree

1 file changed

+67
-47
lines changed

1 file changed

+67
-47
lines changed

contracts/dao/extensions/aibtcdev-treasury.clar

Lines changed: 67 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@
4646
(begin
4747
(try! (is-dao-or-extension))
4848
(print {
49-
event: "allow-asset",
50-
enabled: enabled,
51-
token: token
49+
notification: "allow-asset",
50+
payload: {
51+
enabled: enabled,
52+
token: token
53+
}
5254
})
5355
(ok (map-set AllowedAssets token enabled))
5456
)
@@ -66,11 +68,13 @@
6668
(define-public (deposit-stx (amount uint))
6769
(begin
6870
(print {
69-
event: "deposit-stx",
70-
amount: amount,
71-
caller: contract-caller,
72-
recipient: TREASURY,
73-
sender: tx-sender
71+
notification: "deposit-stx",
72+
payload: {
73+
amount: amount,
74+
caller: contract-caller,
75+
recipient: TREASURY,
76+
sender: tx-sender
77+
}
7478
})
7579
(stx-transfer? amount tx-sender TREASURY)
7680
)
@@ -81,12 +85,14 @@
8185
(begin
8286
(asserts! (is-allowed (contract-of ft)) ERR_UNKNOWN_ASSSET)
8387
(print {
84-
event: "deposit-ft",
85-
amount: amount,
86-
assetContract: (contract-of ft),
87-
caller: contract-caller,
88-
recipient: TREASURY,
89-
sender: tx-sender
88+
notification: "deposit-ft",
89+
payload: {
90+
amount: amount,
91+
assetContract: (contract-of ft),
92+
caller: contract-caller,
93+
recipient: TREASURY,
94+
sender: tx-sender
95+
}
9096
})
9197
(contract-call? ft transfer amount tx-sender TREASURY none)
9298
)
@@ -97,12 +103,14 @@
97103
(begin
98104
(asserts! (is-allowed (contract-of nft)) ERR_UNKNOWN_ASSSET)
99105
(print {
100-
event: "deposit-nft",
101-
assetContract: (contract-of nft),
102-
caller: contract-caller,
103-
recipient: TREASURY,
104-
sender: tx-sender,
105-
tokenId: id,
106+
notification: "deposit-nft",
107+
payload: {
108+
assetContract: (contract-of nft),
109+
caller: contract-caller,
110+
recipient: TREASURY,
111+
sender: tx-sender,
112+
tokenId: id
113+
}
106114
})
107115
(contract-call? nft transfer id tx-sender TREASURY)
108116
)
@@ -113,11 +121,13 @@
113121
(begin
114122
(try! (is-dao-or-extension))
115123
(print {
116-
event: "withdraw-stx",
117-
amount: amount,
118-
caller: contract-caller,
119-
recipient: recipient,
120-
sender: tx-sender
124+
notification: "withdraw-stx",
125+
payload: {
126+
amount: amount,
127+
caller: contract-caller,
128+
recipient: recipient,
129+
sender: tx-sender
130+
}
121131
})
122132
(as-contract (stx-transfer? amount TREASURY recipient))
123133
)
@@ -129,11 +139,13 @@
129139
(try! (is-dao-or-extension))
130140
(asserts! (is-allowed (contract-of ft)) ERR_UNKNOWN_ASSSET)
131141
(print {
132-
event: "withdraw-ft",
133-
assetContract: (contract-of ft),
134-
caller: contract-caller,
135-
recipient: recipient,
136-
sender: tx-sender
142+
notification: "withdraw-ft",
143+
payload: {
144+
assetContract: (contract-of ft),
145+
caller: contract-caller,
146+
recipient: recipient,
147+
sender: tx-sender
148+
}
137149
})
138150
(as-contract (contract-call? ft transfer amount TREASURY recipient none))
139151
)
@@ -145,12 +157,14 @@
145157
(try! (is-dao-or-extension))
146158
(asserts! (is-allowed (contract-of nft)) ERR_UNKNOWN_ASSSET)
147159
(print {
148-
event: "withdraw-nft",
149-
assetContract: (contract-of nft),
150-
caller: contract-caller,
151-
recipient: recipient,
152-
sender: tx-sender,
153-
tokenId: id
160+
notification: "withdraw-nft",
161+
payload: {
162+
assetContract: (contract-of nft),
163+
caller: contract-caller,
164+
recipient: recipient,
165+
sender: tx-sender,
166+
tokenId: id
167+
}
154168
})
155169
(as-contract (contract-call? nft transfer id TREASURY recipient))
156170
)
@@ -161,11 +175,13 @@
161175
(begin
162176
(try! (is-dao-or-extension))
163177
(print {
164-
event: "delegate-stx",
165-
amount: maxAmount,
166-
caller: contract-caller,
167-
delegate: to,
168-
sender: tx-sender
178+
notification: "delegate-stx",
179+
payload: {
180+
amount: maxAmount,
181+
caller: contract-caller,
182+
delegate: to,
183+
sender: tx-sender
184+
}
169185
})
170186
(match (as-contract (contract-call? (var-get poxContract) delegate-stx maxAmount to none none))
171187
success (ok success)
@@ -179,9 +195,11 @@
179195
(begin
180196
(try! (is-dao-or-extension))
181197
(print {
182-
event: "revoke-delegate-stx",
183-
caller: contract-caller,
184-
sender: tx-sender
198+
notification: "revoke-delegate-stx",
199+
payload: {
200+
caller: contract-caller,
201+
sender: tx-sender
202+
}
185203
})
186204
(match (as-contract (contract-call? (var-get poxContract) revoke-delegate-stx))
187205
success (begin (print success) (ok true))
@@ -208,9 +226,11 @@
208226
(define-private (allow-assets-iter (item {token: principal, enabled: bool}))
209227
(begin
210228
(print {
211-
event: "allow-asset",
212-
enabled: (get enabled item),
213-
token: (get token item)
229+
notification: "allow-asset",
230+
payload: {
231+
enabled: (get enabled item),
232+
token: (get token item)
233+
}
214234
})
215235
(map-set AllowedAssets (get token item) (get enabled item))
216236
)

0 commit comments

Comments
 (0)