-
Notifications
You must be signed in to change notification settings - Fork 3
/
snippets.json
executable file
·318 lines (308 loc) · 10.8 KB
/
snippets.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
{
"move": {
"scope": "mvir",
"prefix": "move",
"body": "move($1)",
"description": "move"
},
"let": {
"scope": "mvir",
"prefix": "let",
"body": "let ${1:var}: ${2:type};",
"description": "let"
},
"Hash.keccak256": {
"scope": "mvir",
"prefix": "Hash.keccak256",
"body": "Hash.keccak256(${1:data})",
"description": "Hash.keccak256"
},
"Hash.ripemd160": {
"scope": "mvir",
"prefix": "Hash.ripemd160",
"body": "Hash.ripemd160(${1:data})",
"description": "Hash.ripemd160"
},
"Hash.sha2_256": {
"scope": "mvir",
"prefix": "Hash.sha2_256",
"body": "Hash.sha2_256(${1:data})",
"description": "Hash.sha2_256"
},
"Hash.sha3_256": {
"scope": "mvir",
"prefix": "Hash.sha3_256",
"body": "Hash.sha3_256(${1:data})",
"description": "Hash.sha3_256"
},
"LibraAccount": {
"scope": "mvir",
"prefix": "LibraAccount",
"body": "LibraAccount",
"description": "LibraAccount"
},
"LibraAccount.T": {
"scope": "mvir",
"prefix": "LibraAccount.T",
"body": "LibraAccount.T",
"description": "LibraAccount.T"
},
"LibraAccount.make": {
"scope": "mvir",
"prefix": "LibraAccount.make",
"body": "LibraAccount.make(${1:auth_key})",
"description": "Creates a new LibraLibraAccount.T"
},
"LibraAccount.deposit": {
"scope": "mvir",
"prefix": "LibraAccount.deposit",
"body": "LibraAccount.deposit(${1:payee}, ${2:to_deposit})",
"description": "Deposits the `to_deposit` coin into the `payee`'s account"
},
"LibraAccount.mint_to_address": {
"scope": "mvir",
"prefix": "LibraAccount.mint_to_address",
"body": "LibraAccount.mint_to_address(move(${1:payee}), move(${2:amount}))",
"description": [
"mint_to_address can only be called by accounts with MintCapability (see LibraCoin)",
"and those account will be charged for gas. If those account don't have enough gas to pay",
"for the transaction cost they will fail minting.",
"However those account can also mint to themselves so that is a decent workaround"
]
},
"LibraAccount.withdraw_from_sender": {
"scope": "mvir",
"prefix": "LibraAccount.withdraw_from_sender",
"body": "LibraAccount.withdraw_from_sender(${1:amount})",
"description": [
"Withdraw `amount` LibraCoin.T from the transaction sender's account"
]
},
"LibraAccount.pay_from_sender": {
"scope": "mvir",
"prefix": "LibraAccount.pay_from_sender",
"body": "LibraAccount.pay_from_sender(move(${1:payee}), move(${2:amount}))",
"description": [
"Withdraw `amount` LibraCoin.T from the transaction sender's account and send the coin",
"to the `payee` address",
"Creates the `payee` account if it does not exist"
]
},
"LibraAccount.rotate_authentication_key": {
"scope": "mvir",
"prefix": "LibraAccount.rotate_authentication_key",
"body": "LibraAccount.rotate_authentication_key(move(${1:new_authentication_key}))",
"description": [
"Rotate the transaction sender's authentication key",
"The new key will be used for signing future transactions"
]
},
"LibraAccount.create_new_account": {
"scope": "mvir",
"prefix": "LibraAccount.create_new_account",
"body": "LibraAccount.create_new_account(move(${1:fresh_address}),move(${2:initial_balance}))",
"description": [
"Creates a new account at `fresh_address` with the `initial_balance` deducted from the",
"transaction sender's account"
]
},
"LibraAccount.balance": {
"scope": "mvir",
"prefix": "LibraAccount.balance",
"body": "LibraAccount.balance(${1:addr})",
"description": [
"Return the current balance of the LibraCoin.T in LibraLibraAccount.T at `addr`"
]
},
"LibraAccount.sequence_number": {
"scope": "mvir",
"prefix": "LibraAccount.sequence_number",
"body": "LibraAccount.sequence_number(${1:addr})",
"description": [
"Return the current sequence number at `addr`"
]
},
"LibraAccount.exists": {
"scope": "mvir",
"prefix": "LibraAccount.exists",
"body": "LibraAccount.exists(${1:check_addr})",
"description": [
"Checks if an account exists at `check_addr`"
]
},
"LibraCoin": {
"scope": "mvir",
"prefix": "LibraCoin",
"body": "LibraCoin",
"description": "LibraCoin"
},
"LibraCoin.T": {
"scope": "mvir",
"prefix": "LibraCoin.T",
"body": "LibraCoin.T",
"description": "LibraCoin.T"
},
"LibraCoin.borrow_sender_mint_capability": {
"scope": "mvir",
"prefix": "LibraCoin.borrow_sender_mint_capability",
"body": "LibraCoin.borrow_sender_mint_capability()",
"description": [
"Return a reference to the MintCapability published under the sender's account. Fails if the",
"sender does not have a MintCapability.",
"Since only the Association account has a mint capability, this will only succeed if it is",
"invoked by a transaction sent by that account."
]
},
"LibraCoin.mint": {
"scope": "mvir",
"prefix": "LibraCoin.mint",
"body": "LibraCoin.mint(${1:value}, ${2:capability})",
"description": [
"Mint a new LibraCoin.T worth `value`. The caller must have a reference to a MintCapability.",
"Only the Association account can acquire such a reference, and it can do so only via",
"`borrow_sender_mint_capability`"
]
},
"LibraCoin.zero": {
"scope": "mvir",
"prefix": "LibraCoin.zero",
"body": "LibraCoin.zero()",
"description": [
"Create a new LibraCoin.T with a value of 0"
]
},
"LibraCoin.value": {
"scope": "mvir",
"prefix": "LibraCoin.value",
"body": "LibraCoin.value(${1:coin_ref})",
"description": [
"Public accessor for the value of a coin"
]
},
"LibraCoin.split": {
"scope": "mvir",
"prefix": "LibraCoin.split",
"body": "LibraCoin.split(${1:coin}, ${2:amount})",
"description": [
"Splits the given coin into two and returns them both",
"It leverages `Self.withdraw` for any verifications of the values"
]
},
"LibraCoin.withdraw": {
"scope": "mvir",
"prefix": "LibraCoin.withdraw",
"body": "LibraCoin.withdraw(${1:coin_ref}, ${2:amount})",
"description": [
"`Divides` the given coin into two, where original coin is modified in place",
"The original coin will have value = original value - `amount`",
"The new coin will have a value = `amount`",
"Fails if the coins value is less than `amount`"
]
},
"LibraCoin.join": {
"scope": "mvir",
"prefix": "LibraCoin.join",
"body": "LibraCoin.join(${1:coin1}, ${2:coin2})",
"description": [
"Merges two coins and returns a new coin whose value is equal to the sum of the two inputs"
]
},
"LibraCoin.deposit": {
"scope": "mvir",
"prefix": "LibraCoin.deposit",
"body": "LibraCoin.deposit(${1:coin_ref}, ${2:check})",
"description": [
"`Merges` the two coins",
"The coin passed in by reference will have a value equal to the sum of the two coins",
"The `check` coin is consumed in the process"
]
},
"LibraCoin.destroy_zero": {
"scope": "mvir",
"prefix": "LibraCoin.destroy_zero",
"body": "LibraCoin.destroy_zero(${1:coin_ref})",
"description": [
"Destroy a coin",
"Fails if the value is non-zero",
"The amount of LibraCoin.T in the system is a tightly controlled property,",
"so you cannot `burn` any non-zero amount of LibraCoin.T"
]
},
"LibraCoin.TODO_REMOVE_burn_gas_fee": {
"scope": "mvir",
"prefix": "LibraCoin.TODO_REMOVE_burn_gas_fee",
"body": "LibraCoin.TODO_REMOVE_burn_gas_fee(${1:coin})",
"description": [
"Temporary procedure that is called to burn off the collected gas fee",
"In the future this will be replaced by the actual mechanism for collecting gas"
]
},
"Signature.ed25519_verify": {
"scope": "mvir",
"prefix": "Signature.ed25519_verify",
"body": "Signature.ed25519_verify(${1:signature}, ${2:public_key}, ${3:message})",
"description": [
"Signature.ed25519_verify"
]
},
"ValidatorSet.T": {
"scope": "mvir",
"prefix": "ValidatorSet.T",
"body": "ValidatorSet.T",
"description": "ValidatorSet.T"
},
"libra.scripts.create.account": {
"scope": "mvir",
"prefix": "libra.scripts.create.account",
"body": [
"import 0x0.LibraAccount;",
"main (fresh_address: address, initial_amount: u64) {",
" LibraAccount.create_new_account(move(fresh_address), move(initial_amount));",
" return;",
"}"
]
},
"libra.scripts.mint": {
"scope": "mvir",
"prefix": "libra.scripts.mint",
"body": [
"import 0x0.LibraAccount;",
"import 0x0.LibraCoin;",
"main(payee: address, amount: u64) {",
" LibraAccount.mint_to_address(move(payee), move(amount));",
" return;",
"}"
]
},
"libra.scripts.peer.to.peer.transfer": {
"scope": "mvir",
"prefix": "libra.scripts.peer.to.peer.transfer",
"body": [
"import 0x0.LibraAccount;",
"main (payee: address, amount: u64) {",
" LibraAccount.pay_from_sender(move(payee), move(amount));",
" return;",
"}"
]
},
"libra.scripts.placeholder.script": {
"scope": "mvir",
"prefix": "libra.scripts.placeholder.script",
"body": [
"main() {",
" return;",
"}"
]
},
"libra.scripts.rotate.authentication.key": {
"scope": "mvir",
"prefix": "libra.scripts.rotate.authentication.key",
"body": [
"import 0x0.LibraAccount;",
"main (new_key: bytearray) {",
" LibraAccount.rotate_authentication_key(move(new_key));",
" return;",
"}"
]
}
}