-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GITBOOK-121: Add information on how reward addresses are handled
- Loading branch information
1 parent
f4ff653
commit 638671c
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Multi Send | ||
|
||
Multi send is a very simple but highly useful utility contract for executing multiple STX transfers in a single transaction. | ||
|
||
It takes in a list of addresses and amounts and folds through them to execute a STX transfer for each one. | ||
|
||
Mainnet contract: [https://explorer.hiro.so/txid/0x59665b756dc0fa9efb3fca9e05a28f572c9b14ca894c115fd3e7d81a563e14f8?chain=mainnet](https://explorer.hiro.so/txid/0x59665b756dc0fa9efb3fca9e05a28f572c9b14ca894c115fd3e7d81a563e14f8?chain=mainnet) | ||
|
||
```clojure | ||
;; send-many | ||
(define-private (send-stx (recipient { to: principal, ustx: uint })) | ||
(stx-transfer? (get ustx recipient) tx-sender (get to recipient))) | ||
(define-private (check-err (result (response bool uint)) | ||
(prior (response bool uint))) | ||
(match prior ok-value result | ||
err-value (err err-value))) | ||
(define-public (send-many (recipients (list 200 { to: principal, ustx: uint }))) | ||
(fold check-err | ||
(map send-stx recipients) | ||
(ok true))) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters