Skip to content

Instantly share code, notes, and snippets.

@mightybyte
Last active January 29, 2020 08:41
Show Gist options
  • Save mightybyte/938ac63548438d942b6b1e00fd5fc2d2 to your computer and use it in GitHub Desktop.
Save mightybyte/938ac63548438d942b6b1e00fd5fc2d2 to your computer and use it in GitHub Desktop.
Pact command template for a safe rotate-and-drain operation
code: |-
(use coin)
(let* ((acct:string "rotest")
(bal:decimal (coin.get-balance acct))
)
(coin.rotate acct (read-keyset "ks"))
(coin.transfer acct "croesus" bal)
)
data:
ks:
keys: [dea647009295dc015ba6e6359b85bafe09d2ce935a03c3bf83f775442d539025]
pred: "keys-all"
publicMeta:
chainId: "0"
sender: croesus
gasLimit: 1500
gasPrice: 0.00001
ttl: 86400
networkId: "testnet04"
signers:
- public: 2993f795d133fa5d0fd877a641cabc8b28cd36147f666988cacbaa4379d1ff93
caps:
- name: coin.GAS
args: []
- name: coin.ROTATE
args: ["rotest"]
- public: dea647009295dc015ba6e6359b85bafe09d2ce935a03c3bf83f775442d539025
caps:
- name: coin.TRANSFER
args: ["rotest","croesus",100]
type: exec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment