File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 18
18
(ok true )
19
19
)
20
20
21
- (define-public (send (msg (string-ascii 1048576 )) (opcode ( optional ( buff 16 )) ))
21
+ (define-public (send (msg (string-ascii 1048576 )) (isFromDao bool ))
22
22
(begin
23
+ (and isFromDao (try! (is-dao-or-extension )))
23
24
(asserts! (> (len msg) u0 ) INPUT_ERROR)
24
25
;; print the message as the first event
25
26
(print msg)
29
30
payload : {
30
31
caller : contract-caller ,
31
32
height : block-height ,
33
+ isFromDao : isFromDao,
32
34
sender : tx-sender ,
33
35
}
34
36
})
35
37
(ok true )
36
38
)
37
39
)
40
+
41
+ ;; private functions
42
+ ;;
43
+
44
+ (define-private (is-dao-or-extension )
45
+ (ok (asserts! (or (is-eq tx-sender .aibtcdev-dao )
46
+ (contract-call? .aibtcdev-dao is-extension contract-caller )) ERR_UNAUTHORIZED
47
+ ))
48
+ )
Original file line number Diff line number Diff line change 47
47
48
48
(define-trait messaging
49
49
(
50
- ;; send a message on-chain
50
+ ;; send a message on-chain (opt from DAO)
51
51
;; @param msg the message to send (up to 1MB)
52
+ ;; @param isFromDao whether the message is from the DAO
52
53
;; @returns (response bool uint)
53
- (send ((string-ascii 1048576 )) (response bool uint ))
54
+ (send ((string-ascii 1048576 ) bool ) (response bool uint ))
54
55
)
55
56
)
56
57
You can’t perform that action at this time.
0 commit comments