Skip to content

Commit

Permalink
Use init method for zkApp state
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMinkov committed Jul 18, 2022
1 parent a714246 commit 3b0ad43
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/lib/token.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class TokenContract extends SmartContract {
...Permissions.default(),
editState: Permissions.proofOrSignature(),
});
}

@method init() {
this.tokenSymbol.set(tokenSymbol);
this.totalAmountInCirculation.set(UInt64.zero);
this.maxAmountInCirculation.set(UInt64.from(100_000_000));
Expand Down Expand Up @@ -108,11 +111,13 @@ async function setupLocal() {
tokenAccount2Key = Local.testAccounts[2].privateKey;
tokenAccount2 = tokenAccount2Key.toPublicKey();

let tx = await Mina.transaction(feePayer, () => {
Party.fundNewAccount(feePayer);
zkapp.deploy({ zkappKey });
});
tx.send();
(
await Mina.transaction(feePayer, () => {
Party.fundNewAccount(feePayer);
zkapp.deploy({ zkappKey });
zkapp.init();
})
).send();
}

describe('Token', () => {
Expand Down

0 comments on commit 3b0ad43

Please sign in to comment.