zkcloudworker 0.16.3 → 0.16.5
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/src/mina/index.d.ts +0 -2
- package/lib/ts/src/mina/index.js +0 -2
- package/lib/ts/src/mina/token/vk.d.ts +20 -0
- package/lib/ts/src/mina/token/vk.js +20 -0
- package/lib/ts/src/mina/utils/index.d.ts +2 -0
- package/lib/ts/src/mina/utils/index.js +2 -0
- package/lib/{web/src/mina/nft/whitelist.d.ts → ts/src/mina/utils/indexed-map.d.ts} +8 -7
- package/lib/ts/src/mina/{nft/whitelist.js → utils/indexed-map.js} +14 -18
- package/lib/ts/src/mina/utils/ipfs.d.ts +5 -0
- package/lib/ts/src/mina/utils/ipfs.js +10 -0
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/mina/index.d.ts +0 -2
- package/lib/web/src/mina/index.js +0 -2
- package/lib/web/src/mina/index.js.map +1 -1
- package/lib/web/src/mina/token/vk.d.ts +20 -0
- package/lib/web/src/mina/token/vk.js +20 -0
- package/lib/web/src/mina/token/vk.js.map +1 -1
- package/lib/web/src/mina/utils/index.d.ts +2 -0
- package/lib/web/src/mina/utils/index.js +2 -0
- package/lib/web/src/mina/utils/index.js.map +1 -1
- package/lib/{ts/src/mina/nft/whitelist.d.ts → web/src/mina/utils/indexed-map.d.ts} +8 -7
- package/lib/web/src/mina/{nft/whitelist.js → utils/indexed-map.js} +12 -14
- package/lib/web/src/mina/utils/indexed-map.js.map +1 -0
- package/lib/web/src/mina/utils/ipfs.d.ts +5 -0
- package/lib/web/src/mina/utils/ipfs.js +8 -0
- package/lib/web/src/mina/utils/ipfs.js.map +1 -0
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +2 -8
- package/lib/ts/src/mina/V1/FungibleToken.d.ts +0 -338
- package/lib/ts/src/mina/V1/FungibleToken.js +0 -308
- package/lib/ts/src/mina/V1/FungibleTokenAdmin.d.ts +0 -31
- package/lib/ts/src/mina/V1/FungibleTokenAdmin.js +0 -102
- package/lib/ts/src/mina/V1/index.d.ts +0 -28
- package/lib/ts/src/mina/V1/index.js +0 -13
- package/lib/ts/src/mina/V1/vk.d.ts +0 -22
- package/lib/ts/src/mina/V1/vk.js +0 -25
- package/lib/ts/src/mina/nft/index.d.ts +0 -3
- package/lib/ts/src/mina/nft/index.js +0 -19
- package/lib/ts/src/mina/nft/types.d.ts +0 -1254
- package/lib/ts/src/mina/nft/types.js +0 -236
- package/lib/ts/src/mina/nft/whitelist-admin.d.ts +0 -23
- package/lib/ts/src/mina/nft/whitelist-admin.js +0 -139
- package/lib/web/src/mina/V1/FungibleToken.d.ts +0 -338
- package/lib/web/src/mina/V1/FungibleToken.js +0 -292
- package/lib/web/src/mina/V1/FungibleToken.js.map +0 -1
- package/lib/web/src/mina/V1/FungibleTokenAdmin.d.ts +0 -31
- package/lib/web/src/mina/V1/FungibleTokenAdmin.js +0 -91
- package/lib/web/src/mina/V1/FungibleTokenAdmin.js.map +0 -1
- package/lib/web/src/mina/V1/index.d.ts +0 -28
- package/lib/web/src/mina/V1/index.js +0 -11
- package/lib/web/src/mina/V1/index.js.map +0 -1
- package/lib/web/src/mina/V1/vk.d.ts +0 -22
- package/lib/web/src/mina/V1/vk.js +0 -23
- package/lib/web/src/mina/V1/vk.js.map +0 -1
- package/lib/web/src/mina/nft/index.d.ts +0 -3
- package/lib/web/src/mina/nft/index.js +0 -4
- package/lib/web/src/mina/nft/index.js.map +0 -1
- package/lib/web/src/mina/nft/types.d.ts +0 -1254
- package/lib/web/src/mina/nft/types.js +0 -227
- package/lib/web/src/mina/nft/types.js.map +0 -1
- package/lib/web/src/mina/nft/whitelist-admin.d.ts +0 -23
- package/lib/web/src/mina/nft/whitelist-admin.js +0 -128
- package/lib/web/src/mina/nft/whitelist-admin.js.map +0 -1
- package/lib/web/src/mina/nft/whitelist.js.map +0 -1
@@ -1,338 +0,0 @@
|
|
1
|
-
import { AccountUpdate, AccountUpdateForest, DeployArgs, Bool, Field, Int64, PublicKey, State, TokenContractV2, Types, UInt64, UInt8, VerificationKey } from "o1js_v1";
|
2
|
-
import { FungibleTokenAdminBase } from "./FungibleTokenAdmin.js";
|
3
|
-
interface FungibleTokenDeployProps extends Exclude<DeployArgs, undefined> {
|
4
|
-
/** The token symbol. */
|
5
|
-
symbol: string;
|
6
|
-
/** A source code reference, which is placed within the `zkappUri` of the contract account.
|
7
|
-
* Typically a link to a file on github. */
|
8
|
-
src: string;
|
9
|
-
}
|
10
|
-
export declare const FungibleTokenErrors: {
|
11
|
-
noAdminKey: string;
|
12
|
-
noPermissionToChangeAdmin: string;
|
13
|
-
tokenPaused: string;
|
14
|
-
noPermissionToMint: string;
|
15
|
-
noPermissionToPause: string;
|
16
|
-
noPermissionToResume: string;
|
17
|
-
noTransferFromCirculation: string;
|
18
|
-
noPermissionChangeAllowed: string;
|
19
|
-
flashMinting: string;
|
20
|
-
unbalancedTransaction: string;
|
21
|
-
};
|
22
|
-
export declare class FungibleToken extends TokenContractV2 {
|
23
|
-
decimals: State<UInt8>;
|
24
|
-
admin: State<PublicKey>;
|
25
|
-
paused: State<import("o1js_v1/dist/node/lib/provable/bool.js").Bool>;
|
26
|
-
static AdminContract: new (...args: any) => FungibleTokenAdminBase;
|
27
|
-
readonly events: {
|
28
|
-
SetAdmin: typeof SetAdminEvent;
|
29
|
-
Pause: typeof PauseEvent;
|
30
|
-
Mint: typeof MintEvent;
|
31
|
-
Burn: typeof BurnEvent;
|
32
|
-
BalanceChange: typeof BalanceChangeEvent;
|
33
|
-
};
|
34
|
-
deploy(props: FungibleTokenDeployProps): Promise<void>;
|
35
|
-
/** Update the verification key.
|
36
|
-
* Note that because we have set the permissions for setting the verification key to `impossibleDuringCurrentVersion()`, this will only be possible in case of a protocol update that requires an update.
|
37
|
-
*/
|
38
|
-
updateVerificationKey(vk: VerificationKey): Promise<void>;
|
39
|
-
/** Initializes the account for tracking total circulation.
|
40
|
-
* @argument {PublicKey} admin - public key where the admin contract is deployed
|
41
|
-
* @argument {UInt8} decimals - number of decimals for the token
|
42
|
-
* @argument {Bool} startPaused - if set to `Bool(true), the contract will start in a mode where token minting and transfers are paused. This should be used for non-atomic deployments
|
43
|
-
*/
|
44
|
-
initialize(admin: PublicKey, decimals: UInt8, startPaused: Bool): Promise<void>;
|
45
|
-
getAdminContract(): Promise<FungibleTokenAdminBase>;
|
46
|
-
setAdmin(admin: PublicKey): Promise<void>;
|
47
|
-
mint(recipient: PublicKey, amount: UInt64): Promise<AccountUpdate>;
|
48
|
-
burn(from: PublicKey, amount: UInt64): Promise<AccountUpdate>;
|
49
|
-
pause(): Promise<void>;
|
50
|
-
resume(): Promise<void>;
|
51
|
-
transfer(from: PublicKey, to: PublicKey, amount: UInt64): Promise<void>;
|
52
|
-
private checkPermissionsUpdate;
|
53
|
-
/** Approve `AccountUpdate`s that have been created outside of the token contract.
|
54
|
-
*
|
55
|
-
* @argument {AccountUpdateForest} updates - The `AccountUpdate`s to approve. Note that the forest size is limited by the base token contract, @see TokenContractV2.MAX_ACCOUNT_UPDATES The current limit is 9.
|
56
|
-
*/
|
57
|
-
approveBase(updates: AccountUpdateForest): Promise<void>;
|
58
|
-
getBalanceOf(address: PublicKey): Promise<UInt64>;
|
59
|
-
/** Reports the current circulating supply
|
60
|
-
* This does take into account currently unreduced actions.
|
61
|
-
*/
|
62
|
-
getCirculating(): Promise<UInt64>;
|
63
|
-
getDecimals(): Promise<UInt8>;
|
64
|
-
}
|
65
|
-
declare const SetAdminEvent_base: (new (value: {
|
66
|
-
adminKey: PublicKey;
|
67
|
-
}) => {
|
68
|
-
adminKey: PublicKey;
|
69
|
-
}) & {
|
70
|
-
_isStruct: true;
|
71
|
-
} & Omit<import("o1js_v1/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
72
|
-
adminKey: PublicKey;
|
73
|
-
}, {
|
74
|
-
adminKey: {
|
75
|
-
x: bigint;
|
76
|
-
isOdd: boolean;
|
77
|
-
};
|
78
|
-
}>, "fromFields"> & {
|
79
|
-
fromFields: (fields: import("o1js_v1/dist/node/lib/provable/field.js").Field[]) => {
|
80
|
-
adminKey: PublicKey;
|
81
|
-
};
|
82
|
-
} & {
|
83
|
-
fromValue: (value: {
|
84
|
-
adminKey: PublicKey | {
|
85
|
-
x: Field | bigint;
|
86
|
-
isOdd: Bool | boolean;
|
87
|
-
};
|
88
|
-
}) => {
|
89
|
-
adminKey: PublicKey;
|
90
|
-
};
|
91
|
-
toInput: (x: {
|
92
|
-
adminKey: PublicKey;
|
93
|
-
}) => {
|
94
|
-
fields?: Field[] | undefined;
|
95
|
-
packed?: [Field, number][] | undefined;
|
96
|
-
};
|
97
|
-
toJSON: (x: {
|
98
|
-
adminKey: PublicKey;
|
99
|
-
}) => {
|
100
|
-
adminKey: string;
|
101
|
-
};
|
102
|
-
fromJSON: (x: {
|
103
|
-
adminKey: string;
|
104
|
-
}) => {
|
105
|
-
adminKey: PublicKey;
|
106
|
-
};
|
107
|
-
empty: () => {
|
108
|
-
adminKey: PublicKey;
|
109
|
-
};
|
110
|
-
};
|
111
|
-
export declare class SetAdminEvent extends SetAdminEvent_base {
|
112
|
-
}
|
113
|
-
declare const PauseEvent_base: (new (value: {
|
114
|
-
isPaused: import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
115
|
-
}) => {
|
116
|
-
isPaused: import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
117
|
-
}) & {
|
118
|
-
_isStruct: true;
|
119
|
-
} & Omit<import("o1js_v1/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
120
|
-
isPaused: import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
121
|
-
}, {
|
122
|
-
isPaused: boolean;
|
123
|
-
}>, "fromFields"> & {
|
124
|
-
fromFields: (fields: import("o1js_v1/dist/node/lib/provable/field.js").Field[]) => {
|
125
|
-
isPaused: import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
126
|
-
};
|
127
|
-
} & {
|
128
|
-
fromValue: (value: {
|
129
|
-
isPaused: boolean | import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
130
|
-
}) => {
|
131
|
-
isPaused: import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
132
|
-
};
|
133
|
-
toInput: (x: {
|
134
|
-
isPaused: import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
135
|
-
}) => {
|
136
|
-
fields?: Field[] | undefined;
|
137
|
-
packed?: [Field, number][] | undefined;
|
138
|
-
};
|
139
|
-
toJSON: (x: {
|
140
|
-
isPaused: import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
141
|
-
}) => {
|
142
|
-
isPaused: boolean;
|
143
|
-
};
|
144
|
-
fromJSON: (x: {
|
145
|
-
isPaused: boolean;
|
146
|
-
}) => {
|
147
|
-
isPaused: import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
148
|
-
};
|
149
|
-
empty: () => {
|
150
|
-
isPaused: import("o1js_v1/dist/node/lib/provable/bool.js").Bool;
|
151
|
-
};
|
152
|
-
};
|
153
|
-
export declare class PauseEvent extends PauseEvent_base {
|
154
|
-
}
|
155
|
-
declare const MintEvent_base: (new (value: {
|
156
|
-
recipient: PublicKey;
|
157
|
-
amount: Types.UInt64;
|
158
|
-
}) => {
|
159
|
-
recipient: PublicKey;
|
160
|
-
amount: Types.UInt64;
|
161
|
-
}) & {
|
162
|
-
_isStruct: true;
|
163
|
-
} & Omit<import("o1js_v1/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
164
|
-
recipient: PublicKey;
|
165
|
-
amount: Types.UInt64;
|
166
|
-
}, {
|
167
|
-
recipient: {
|
168
|
-
x: bigint;
|
169
|
-
isOdd: boolean;
|
170
|
-
};
|
171
|
-
amount: bigint;
|
172
|
-
}>, "fromFields"> & {
|
173
|
-
fromFields: (fields: import("o1js_v1/dist/node/lib/provable/field.js").Field[]) => {
|
174
|
-
recipient: PublicKey;
|
175
|
-
amount: Types.UInt64;
|
176
|
-
};
|
177
|
-
} & {
|
178
|
-
fromValue: (value: {
|
179
|
-
recipient: PublicKey | {
|
180
|
-
x: Field | bigint;
|
181
|
-
isOdd: Bool | boolean;
|
182
|
-
};
|
183
|
-
amount: bigint | Types.UInt64;
|
184
|
-
}) => {
|
185
|
-
recipient: PublicKey;
|
186
|
-
amount: Types.UInt64;
|
187
|
-
};
|
188
|
-
toInput: (x: {
|
189
|
-
recipient: PublicKey;
|
190
|
-
amount: Types.UInt64;
|
191
|
-
}) => {
|
192
|
-
fields?: Field[] | undefined;
|
193
|
-
packed?: [Field, number][] | undefined;
|
194
|
-
};
|
195
|
-
toJSON: (x: {
|
196
|
-
recipient: PublicKey;
|
197
|
-
amount: Types.UInt64;
|
198
|
-
}) => {
|
199
|
-
recipient: string;
|
200
|
-
amount: string;
|
201
|
-
};
|
202
|
-
fromJSON: (x: {
|
203
|
-
recipient: string;
|
204
|
-
amount: string;
|
205
|
-
}) => {
|
206
|
-
recipient: PublicKey;
|
207
|
-
amount: Types.UInt64;
|
208
|
-
};
|
209
|
-
empty: () => {
|
210
|
-
recipient: PublicKey;
|
211
|
-
amount: Types.UInt64;
|
212
|
-
};
|
213
|
-
};
|
214
|
-
export declare class MintEvent extends MintEvent_base {
|
215
|
-
}
|
216
|
-
declare const BurnEvent_base: (new (value: {
|
217
|
-
from: PublicKey;
|
218
|
-
amount: Types.UInt64;
|
219
|
-
}) => {
|
220
|
-
from: PublicKey;
|
221
|
-
amount: Types.UInt64;
|
222
|
-
}) & {
|
223
|
-
_isStruct: true;
|
224
|
-
} & Omit<import("o1js_v1/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
225
|
-
from: PublicKey;
|
226
|
-
amount: Types.UInt64;
|
227
|
-
}, {
|
228
|
-
from: {
|
229
|
-
x: bigint;
|
230
|
-
isOdd: boolean;
|
231
|
-
};
|
232
|
-
amount: bigint;
|
233
|
-
}>, "fromFields"> & {
|
234
|
-
fromFields: (fields: import("o1js_v1/dist/node/lib/provable/field.js").Field[]) => {
|
235
|
-
from: PublicKey;
|
236
|
-
amount: Types.UInt64;
|
237
|
-
};
|
238
|
-
} & {
|
239
|
-
fromValue: (value: {
|
240
|
-
from: PublicKey | {
|
241
|
-
x: Field | bigint;
|
242
|
-
isOdd: Bool | boolean;
|
243
|
-
};
|
244
|
-
amount: bigint | Types.UInt64;
|
245
|
-
}) => {
|
246
|
-
from: PublicKey;
|
247
|
-
amount: Types.UInt64;
|
248
|
-
};
|
249
|
-
toInput: (x: {
|
250
|
-
from: PublicKey;
|
251
|
-
amount: Types.UInt64;
|
252
|
-
}) => {
|
253
|
-
fields?: Field[] | undefined;
|
254
|
-
packed?: [Field, number][] | undefined;
|
255
|
-
};
|
256
|
-
toJSON: (x: {
|
257
|
-
from: PublicKey;
|
258
|
-
amount: Types.UInt64;
|
259
|
-
}) => {
|
260
|
-
from: string;
|
261
|
-
amount: string;
|
262
|
-
};
|
263
|
-
fromJSON: (x: {
|
264
|
-
from: string;
|
265
|
-
amount: string;
|
266
|
-
}) => {
|
267
|
-
from: PublicKey;
|
268
|
-
amount: Types.UInt64;
|
269
|
-
};
|
270
|
-
empty: () => {
|
271
|
-
from: PublicKey;
|
272
|
-
amount: Types.UInt64;
|
273
|
-
};
|
274
|
-
};
|
275
|
-
export declare class BurnEvent extends BurnEvent_base {
|
276
|
-
}
|
277
|
-
declare const BalanceChangeEvent_base: (new (value: {
|
278
|
-
address: PublicKey;
|
279
|
-
amount: Int64;
|
280
|
-
}) => {
|
281
|
-
address: PublicKey;
|
282
|
-
amount: Int64;
|
283
|
-
}) & {
|
284
|
-
_isStruct: true;
|
285
|
-
} & Omit<import("o1js_v1/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
286
|
-
address: PublicKey;
|
287
|
-
amount: Int64;
|
288
|
-
}, {
|
289
|
-
address: {
|
290
|
-
x: bigint;
|
291
|
-
isOdd: boolean;
|
292
|
-
};
|
293
|
-
amount: any;
|
294
|
-
}>, "fromFields"> & {
|
295
|
-
fromFields: (fields: import("o1js_v1/dist/node/lib/provable/field.js").Field[]) => {
|
296
|
-
address: PublicKey;
|
297
|
-
amount: Int64;
|
298
|
-
};
|
299
|
-
} & {
|
300
|
-
fromValue: (value: {
|
301
|
-
address: PublicKey | {
|
302
|
-
x: Field | bigint;
|
303
|
-
isOdd: Bool | boolean;
|
304
|
-
};
|
305
|
-
amount: any;
|
306
|
-
}) => {
|
307
|
-
address: PublicKey;
|
308
|
-
amount: Int64;
|
309
|
-
};
|
310
|
-
toInput: (x: {
|
311
|
-
address: PublicKey;
|
312
|
-
amount: Int64;
|
313
|
-
}) => {
|
314
|
-
fields?: Field[] | undefined;
|
315
|
-
packed?: [Field, number][] | undefined;
|
316
|
-
};
|
317
|
-
toJSON: (x: {
|
318
|
-
address: PublicKey;
|
319
|
-
amount: Int64;
|
320
|
-
}) => {
|
321
|
-
address: string;
|
322
|
-
amount: any;
|
323
|
-
};
|
324
|
-
fromJSON: (x: {
|
325
|
-
address: string;
|
326
|
-
amount: any;
|
327
|
-
}) => {
|
328
|
-
address: PublicKey;
|
329
|
-
amount: Int64;
|
330
|
-
};
|
331
|
-
empty: () => {
|
332
|
-
address: PublicKey;
|
333
|
-
amount: Int64;
|
334
|
-
};
|
335
|
-
};
|
336
|
-
export declare class BalanceChangeEvent extends BalanceChangeEvent_base {
|
337
|
-
}
|
338
|
-
export {};
|
@@ -1,292 +0,0 @@
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
2
|
-
import { AccountUpdate, AccountUpdateForest, assert, Bool, Int64, method, Permissions, Provable, PublicKey, State, state, Struct, TokenContractV2, Types, UInt64, UInt8, VerificationKey, } from "o1js_v1";
|
3
|
-
import { FungibleTokenAdmin, } from "./FungibleTokenAdmin.js";
|
4
|
-
export const FungibleTokenErrors = {
|
5
|
-
noAdminKey: "could not fetch admin contract key",
|
6
|
-
noPermissionToChangeAdmin: "Not allowed to change admin contract",
|
7
|
-
tokenPaused: "Token is currently paused",
|
8
|
-
noPermissionToMint: "Not allowed to mint tokens",
|
9
|
-
noPermissionToPause: "Not allowed to pause token",
|
10
|
-
noPermissionToResume: "Not allowed to resume token",
|
11
|
-
noTransferFromCirculation: "Can't transfer to/from the circulation account",
|
12
|
-
noPermissionChangeAllowed: "Can't change permissions for access or receive on token accounts",
|
13
|
-
flashMinting: "Flash-minting or unbalanced transaction detected. Please make sure that your transaction is balanced, and that your `AccountUpdate`s are ordered properly, so that tokens are not received before they are sent.",
|
14
|
-
unbalancedTransaction: "Transaction is unbalanced",
|
15
|
-
};
|
16
|
-
export class FungibleToken extends TokenContractV2 {
|
17
|
-
constructor() {
|
18
|
-
super(...arguments);
|
19
|
-
this.decimals = State();
|
20
|
-
this.admin = State();
|
21
|
-
this.paused = State();
|
22
|
-
this.events = {
|
23
|
-
SetAdmin: SetAdminEvent,
|
24
|
-
Pause: PauseEvent,
|
25
|
-
Mint: MintEvent,
|
26
|
-
Burn: BurnEvent,
|
27
|
-
BalanceChange: BalanceChangeEvent,
|
28
|
-
};
|
29
|
-
}
|
30
|
-
async deploy(props) {
|
31
|
-
await super.deploy(props);
|
32
|
-
this.paused.set(Bool(true));
|
33
|
-
this.account.zkappUri.set(props.src);
|
34
|
-
this.account.tokenSymbol.set(props.symbol);
|
35
|
-
this.account.permissions.set({
|
36
|
-
...Permissions.default(),
|
37
|
-
setVerificationKey: Permissions.VerificationKey.impossibleDuringCurrentVersion(),
|
38
|
-
setPermissions: Permissions.impossible(),
|
39
|
-
access: Permissions.proof(),
|
40
|
-
});
|
41
|
-
}
|
42
|
-
/** Update the verification key.
|
43
|
-
* Note that because we have set the permissions for setting the verification key to `impossibleDuringCurrentVersion()`, this will only be possible in case of a protocol update that requires an update.
|
44
|
-
*/
|
45
|
-
async updateVerificationKey(vk) {
|
46
|
-
this.account.verificationKey.set(vk);
|
47
|
-
}
|
48
|
-
/** Initializes the account for tracking total circulation.
|
49
|
-
* @argument {PublicKey} admin - public key where the admin contract is deployed
|
50
|
-
* @argument {UInt8} decimals - number of decimals for the token
|
51
|
-
* @argument {Bool} startPaused - if set to `Bool(true), the contract will start in a mode where token minting and transfers are paused. This should be used for non-atomic deployments
|
52
|
-
*/
|
53
|
-
async initialize(admin, decimals, startPaused) {
|
54
|
-
this.account.provedState.requireEquals(Bool(false));
|
55
|
-
this.admin.set(admin);
|
56
|
-
this.decimals.set(decimals);
|
57
|
-
this.paused.set(Bool(false));
|
58
|
-
this.paused.set(startPaused);
|
59
|
-
const accountUpdate = AccountUpdate.createSigned(this.address, this.deriveTokenId());
|
60
|
-
let permissions = Permissions.default();
|
61
|
-
// This is necessary in order to allow token holders to burn.
|
62
|
-
permissions.send = Permissions.none();
|
63
|
-
permissions.setPermissions = Permissions.impossible();
|
64
|
-
accountUpdate.account.permissions.set(permissions);
|
65
|
-
}
|
66
|
-
async getAdminContract() {
|
67
|
-
const admin = await Provable.witnessAsync(PublicKey, async () => {
|
68
|
-
let pk = await this.admin.fetch();
|
69
|
-
assert(pk !== undefined, FungibleTokenErrors.noAdminKey);
|
70
|
-
return pk;
|
71
|
-
});
|
72
|
-
this.admin.requireEquals(admin);
|
73
|
-
return new FungibleToken.AdminContract(admin);
|
74
|
-
}
|
75
|
-
async setAdmin(admin) {
|
76
|
-
const adminContract = await this.getAdminContract();
|
77
|
-
const canChangeAdmin = await adminContract.canChangeAdmin(admin);
|
78
|
-
canChangeAdmin.assertTrue(FungibleTokenErrors.noPermissionToChangeAdmin);
|
79
|
-
this.admin.set(admin);
|
80
|
-
this.emitEvent("SetAdmin", new SetAdminEvent({ adminKey: admin }));
|
81
|
-
}
|
82
|
-
async mint(recipient, amount) {
|
83
|
-
this.paused
|
84
|
-
.getAndRequireEquals()
|
85
|
-
.assertFalse(FungibleTokenErrors.tokenPaused);
|
86
|
-
const accountUpdate = this.internal.mint({ address: recipient, amount });
|
87
|
-
const adminContract = await this.getAdminContract();
|
88
|
-
const canMint = await adminContract.canMint(accountUpdate);
|
89
|
-
canMint.assertTrue(FungibleTokenErrors.noPermissionToMint);
|
90
|
-
recipient
|
91
|
-
.equals(this.address)
|
92
|
-
.assertFalse(FungibleTokenErrors.noTransferFromCirculation);
|
93
|
-
this.approve(accountUpdate);
|
94
|
-
this.emitEvent("Mint", new MintEvent({ recipient, amount }));
|
95
|
-
const circulationUpdate = AccountUpdate.create(this.address, this.deriveTokenId());
|
96
|
-
circulationUpdate.balanceChange = Int64.fromUnsigned(amount);
|
97
|
-
return accountUpdate;
|
98
|
-
}
|
99
|
-
async burn(from, amount) {
|
100
|
-
this.paused
|
101
|
-
.getAndRequireEquals()
|
102
|
-
.assertFalse(FungibleTokenErrors.tokenPaused);
|
103
|
-
const accountUpdate = this.internal.burn({ address: from, amount });
|
104
|
-
const circulationUpdate = AccountUpdate.create(this.address, this.deriveTokenId());
|
105
|
-
from
|
106
|
-
.equals(this.address)
|
107
|
-
.assertFalse(FungibleTokenErrors.noTransferFromCirculation);
|
108
|
-
circulationUpdate.balanceChange = Int64.fromUnsigned(amount).negV2();
|
109
|
-
this.emitEvent("Burn", new BurnEvent({ from, amount }));
|
110
|
-
return accountUpdate;
|
111
|
-
}
|
112
|
-
async pause() {
|
113
|
-
const adminContract = await this.getAdminContract();
|
114
|
-
const canPause = await adminContract.canPause();
|
115
|
-
canPause.assertTrue(FungibleTokenErrors.noPermissionToPause);
|
116
|
-
this.paused.set(Bool(true));
|
117
|
-
this.emitEvent("Pause", new PauseEvent({ isPaused: Bool(true) }));
|
118
|
-
}
|
119
|
-
async resume() {
|
120
|
-
const adminContract = await this.getAdminContract();
|
121
|
-
const canResume = await adminContract.canResume();
|
122
|
-
canResume.assertTrue(FungibleTokenErrors.noPermissionToResume);
|
123
|
-
this.paused.set(Bool(false));
|
124
|
-
this.emitEvent("Pause", new PauseEvent({ isPaused: Bool(false) }));
|
125
|
-
}
|
126
|
-
async transfer(from, to, amount) {
|
127
|
-
this.paused
|
128
|
-
.getAndRequireEquals()
|
129
|
-
.assertFalse(FungibleTokenErrors.tokenPaused);
|
130
|
-
from
|
131
|
-
.equals(this.address)
|
132
|
-
.assertFalse(FungibleTokenErrors.noTransferFromCirculation);
|
133
|
-
to.equals(this.address).assertFalse(FungibleTokenErrors.noTransferFromCirculation);
|
134
|
-
this.internal.send({ from, to, amount });
|
135
|
-
}
|
136
|
-
checkPermissionsUpdate(update) {
|
137
|
-
let permissions = update.update.permissions;
|
138
|
-
let { access, receive } = permissions.value;
|
139
|
-
let accessIsNone = Provable.equal(Types.AuthRequired, access, Permissions.none());
|
140
|
-
let receiveIsNone = Provable.equal(Types.AuthRequired, receive, Permissions.none());
|
141
|
-
let updateAllowed = accessIsNone.and(receiveIsNone);
|
142
|
-
assert(updateAllowed.or(permissions.isSome.not()), FungibleTokenErrors.noPermissionChangeAllowed);
|
143
|
-
}
|
144
|
-
/** Approve `AccountUpdate`s that have been created outside of the token contract.
|
145
|
-
*
|
146
|
-
* @argument {AccountUpdateForest} updates - The `AccountUpdate`s to approve. Note that the forest size is limited by the base token contract, @see TokenContractV2.MAX_ACCOUNT_UPDATES The current limit is 9.
|
147
|
-
*/
|
148
|
-
async approveBase(updates) {
|
149
|
-
this.paused
|
150
|
-
.getAndRequireEquals()
|
151
|
-
.assertFalse(FungibleTokenErrors.tokenPaused);
|
152
|
-
let totalBalance = Int64.from(0);
|
153
|
-
this.forEachUpdate(updates, (update, usesToken) => {
|
154
|
-
// Make sure that the account permissions are not changed
|
155
|
-
this.checkPermissionsUpdate(update);
|
156
|
-
this.emitEventIf(usesToken, "BalanceChange", new BalanceChangeEvent({
|
157
|
-
address: update.publicKey,
|
158
|
-
amount: update.balanceChange,
|
159
|
-
}));
|
160
|
-
// Don't allow transfers to/from the account that's tracking circulation
|
161
|
-
update.publicKey
|
162
|
-
.equals(this.address)
|
163
|
-
.and(usesToken)
|
164
|
-
.assertFalse(FungibleTokenErrors.noTransferFromCirculation);
|
165
|
-
totalBalance = Provable.if(usesToken, totalBalance.add(update.balanceChange), totalBalance);
|
166
|
-
totalBalance.isPositiveV2().assertFalse(FungibleTokenErrors.flashMinting);
|
167
|
-
});
|
168
|
-
totalBalance.assertEquals(Int64.zero, FungibleTokenErrors.unbalancedTransaction);
|
169
|
-
}
|
170
|
-
async getBalanceOf(address) {
|
171
|
-
const account = AccountUpdate.create(address, this.deriveTokenId()).account;
|
172
|
-
const balance = account.balance.get();
|
173
|
-
account.balance.requireEquals(balance);
|
174
|
-
return balance;
|
175
|
-
}
|
176
|
-
/** Reports the current circulating supply
|
177
|
-
* This does take into account currently unreduced actions.
|
178
|
-
*/
|
179
|
-
async getCirculating() {
|
180
|
-
let circulating = await this.getBalanceOf(this.address);
|
181
|
-
return circulating;
|
182
|
-
}
|
183
|
-
async getDecimals() {
|
184
|
-
return this.decimals.getAndRequireEquals();
|
185
|
-
}
|
186
|
-
}
|
187
|
-
// This defines the type of the contract that is used to control access to administrative actions.
|
188
|
-
// If you want to have a custom contract, overwrite this by setting FungibleToken.AdminContract to
|
189
|
-
// your own implementation of FungibleTokenAdminBase.
|
190
|
-
FungibleToken.AdminContract = FungibleTokenAdmin;
|
191
|
-
__decorate([
|
192
|
-
state(UInt8),
|
193
|
-
__metadata("design:type", Object)
|
194
|
-
], FungibleToken.prototype, "decimals", void 0);
|
195
|
-
__decorate([
|
196
|
-
state(PublicKey),
|
197
|
-
__metadata("design:type", Object)
|
198
|
-
], FungibleToken.prototype, "admin", void 0);
|
199
|
-
__decorate([
|
200
|
-
state(Bool),
|
201
|
-
__metadata("design:type", Object)
|
202
|
-
], FungibleToken.prototype, "paused", void 0);
|
203
|
-
__decorate([
|
204
|
-
method,
|
205
|
-
__metadata("design:type", Function),
|
206
|
-
__metadata("design:paramtypes", [VerificationKey]),
|
207
|
-
__metadata("design:returntype", Promise)
|
208
|
-
], FungibleToken.prototype, "updateVerificationKey", null);
|
209
|
-
__decorate([
|
210
|
-
method,
|
211
|
-
__metadata("design:type", Function),
|
212
|
-
__metadata("design:paramtypes", [PublicKey, UInt8, Bool]),
|
213
|
-
__metadata("design:returntype", Promise)
|
214
|
-
], FungibleToken.prototype, "initialize", null);
|
215
|
-
__decorate([
|
216
|
-
method,
|
217
|
-
__metadata("design:type", Function),
|
218
|
-
__metadata("design:paramtypes", [PublicKey]),
|
219
|
-
__metadata("design:returntype", Promise)
|
220
|
-
], FungibleToken.prototype, "setAdmin", null);
|
221
|
-
__decorate([
|
222
|
-
method.returns(AccountUpdate),
|
223
|
-
__metadata("design:type", Function),
|
224
|
-
__metadata("design:paramtypes", [PublicKey, UInt64]),
|
225
|
-
__metadata("design:returntype", Promise)
|
226
|
-
], FungibleToken.prototype, "mint", null);
|
227
|
-
__decorate([
|
228
|
-
method.returns(AccountUpdate),
|
229
|
-
__metadata("design:type", Function),
|
230
|
-
__metadata("design:paramtypes", [PublicKey, UInt64]),
|
231
|
-
__metadata("design:returntype", Promise)
|
232
|
-
], FungibleToken.prototype, "burn", null);
|
233
|
-
__decorate([
|
234
|
-
method,
|
235
|
-
__metadata("design:type", Function),
|
236
|
-
__metadata("design:paramtypes", []),
|
237
|
-
__metadata("design:returntype", Promise)
|
238
|
-
], FungibleToken.prototype, "pause", null);
|
239
|
-
__decorate([
|
240
|
-
method,
|
241
|
-
__metadata("design:type", Function),
|
242
|
-
__metadata("design:paramtypes", []),
|
243
|
-
__metadata("design:returntype", Promise)
|
244
|
-
], FungibleToken.prototype, "resume", null);
|
245
|
-
__decorate([
|
246
|
-
method,
|
247
|
-
__metadata("design:type", Function),
|
248
|
-
__metadata("design:paramtypes", [PublicKey, PublicKey, UInt64]),
|
249
|
-
__metadata("design:returntype", Promise)
|
250
|
-
], FungibleToken.prototype, "transfer", null);
|
251
|
-
__decorate([
|
252
|
-
method,
|
253
|
-
__metadata("design:type", Function),
|
254
|
-
__metadata("design:paramtypes", [AccountUpdateForest]),
|
255
|
-
__metadata("design:returntype", Promise)
|
256
|
-
], FungibleToken.prototype, "approveBase", null);
|
257
|
-
__decorate([
|
258
|
-
method.returns(UInt64),
|
259
|
-
__metadata("design:type", Function),
|
260
|
-
__metadata("design:paramtypes", [PublicKey]),
|
261
|
-
__metadata("design:returntype", Promise)
|
262
|
-
], FungibleToken.prototype, "getBalanceOf", null);
|
263
|
-
__decorate([
|
264
|
-
method.returns(UInt8),
|
265
|
-
__metadata("design:type", Function),
|
266
|
-
__metadata("design:paramtypes", []),
|
267
|
-
__metadata("design:returntype", Promise)
|
268
|
-
], FungibleToken.prototype, "getDecimals", null);
|
269
|
-
export class SetAdminEvent extends Struct({
|
270
|
-
adminKey: PublicKey,
|
271
|
-
}) {
|
272
|
-
}
|
273
|
-
export class PauseEvent extends Struct({
|
274
|
-
isPaused: Bool,
|
275
|
-
}) {
|
276
|
-
}
|
277
|
-
export class MintEvent extends Struct({
|
278
|
-
recipient: PublicKey,
|
279
|
-
amount: UInt64,
|
280
|
-
}) {
|
281
|
-
}
|
282
|
-
export class BurnEvent extends Struct({
|
283
|
-
from: PublicKey,
|
284
|
-
amount: UInt64,
|
285
|
-
}) {
|
286
|
-
}
|
287
|
-
export class BalanceChangeEvent extends Struct({
|
288
|
-
address: PublicKey,
|
289
|
-
amount: Int64,
|
290
|
-
}) {
|
291
|
-
}
|
292
|
-
//# sourceMappingURL=FungibleToken.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FungibleToken.js","sourceRoot":"","sources":["../../../../../../src/mina/V1/FungibleToken.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EAEnB,MAAM,EACN,IAAI,EAEJ,KAAK,EACL,MAAM,EACN,WAAW,EACX,QAAQ,EACR,SAAS,EACT,KAAK,EACL,KAAK,EACL,MAAM,EACN,eAAe,EACf,KAAK,EACL,MAAM,EACN,KAAK,EACL,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AAUjC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,UAAU,EAAE,oCAAoC;IAChD,yBAAyB,EAAE,sCAAsC;IACjE,WAAW,EAAE,2BAA2B;IACxC,kBAAkB,EAAE,4BAA4B;IAChD,mBAAmB,EAAE,4BAA4B;IACjD,oBAAoB,EAAE,6BAA6B;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CAAC;;qCACb,SAAS,EAAU,MAAM;;yCAezC;AAGK;IADL,MAAM;;;;0CAON;AAGK;IADL,MAAM;;;;2CAON;AAGK;IADL,MAAM;;qCACc,SAAS,EAAM,SAAS,EAAU,MAAM;;6CAW5D;AA6BK;IADL,MAAM;;qCACoB,mBAAmB;;gDAgC7C;AAGK;IADL,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;;qCACK,SAAS;;iDAKpC;AAWK;IADL,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;;;;gDAGrB;AAGH,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC;IACxC,QAAQ,EAAE,SAAS;CACpB,CAAC;CAAG;AAEL,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC;IACrC,QAAQ,EAAE,IAAI;CACf,CAAC;CAAG;AAEL,MAAM,OAAO,SAAU,SAAQ,MAAM,CAAC;IACpC,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,MAAM;CACf,CAAC;CAAG;AAEL,MAAM,OAAO,SAAU,SAAQ,MAAM,CAAC;IACpC,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,MAAM;CACf,CAAC;CAAG;AAEL,MAAM,OAAO,kBAAmB,SAAQ,MAAM,CAAC;IAC7C,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,KAAK;CACd,CAAC;CAAG"}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { AccountUpdate, Bool, DeployArgs, PublicKey, SmartContract, VerificationKey } from "o1js_v1";
|
2
|
-
export type FungibleTokenAdminBase = SmartContract & {
|
3
|
-
canMint(accountUpdate: AccountUpdate): Promise<Bool>;
|
4
|
-
canChangeAdmin(admin: PublicKey): Promise<Bool>;
|
5
|
-
canPause(): Promise<Bool>;
|
6
|
-
canResume(): Promise<Bool>;
|
7
|
-
};
|
8
|
-
export interface FungibleTokenAdminDeployProps extends Exclude<DeployArgs, undefined> {
|
9
|
-
adminPublicKey: PublicKey;
|
10
|
-
}
|
11
|
-
/** A contract that grants permissions for administrative actions on a token.
|
12
|
-
*
|
13
|
-
* We separate this out into a dedicated contract. That way, when issuing a token, a user can
|
14
|
-
* specify their own rules for administrative actions, without changing the token contract itself.
|
15
|
-
*
|
16
|
-
* The advantage is that third party applications that only use the token in a non-privileged way
|
17
|
-
* can integrate against the unchanged token contract.
|
18
|
-
*/
|
19
|
-
export declare class FungibleTokenAdmin extends SmartContract implements FungibleTokenAdminBase {
|
20
|
-
private adminPublicKey;
|
21
|
-
deploy(props: FungibleTokenAdminDeployProps): Promise<void>;
|
22
|
-
/** Update the verification key.
|
23
|
-
* Note that because we have set the permissions for setting the verification key to `impossibleDuringCurrentVersion()`, this will only be possible in case of a protocol update that requires an update.
|
24
|
-
*/
|
25
|
-
updateVerificationKey(vk: VerificationKey): Promise<void>;
|
26
|
-
private ensureAdminSignature;
|
27
|
-
canMint(_accountUpdate: AccountUpdate): Promise<import("o1js_v1/dist/node/lib/provable/bool").Bool>;
|
28
|
-
canChangeAdmin(_admin: PublicKey): Promise<import("o1js_v1/dist/node/lib/provable/bool").Bool>;
|
29
|
-
canPause(): Promise<Bool>;
|
30
|
-
canResume(): Promise<Bool>;
|
31
|
-
}
|