Skip to content

Commit

Permalink
Add a test that initialize() cannot be called a second time.
Browse files Browse the repository at this point in the history
  • Loading branch information
kantp committed Jul 23, 2024
1 parent ae0206d commit 58cb188
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 21 additions & 0 deletions FungibleToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,27 @@ describe("token integration", async () => {
await tx.prove()
await tx.send()
})

it("should prevent calling `initialize()` a second time", async () => {
const tx = await Mina.transaction({
sender: deployer,
fee: 1e8,
}, async () => {
await tokenAContract.initialize(
tokenAdmin,
UInt8.from(9),
Bool(true),
)
})

tx.sign([
deployer.key,
tokenA.key,
])

await tx.prove()
await rejects(() => tx.send())
})
})

describe("admin", () => {
Expand Down
1 change: 0 additions & 1 deletion FungibleToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export class FungibleToken extends TokenContractV2 {
startPaused: Bool,
) {
this.account.provedState.requireEquals(Bool(false))
super.init()

this.admin.set(admin)
this.decimals.set(decimals)
Expand Down

0 comments on commit 58cb188

Please sign in to comment.