You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you will add the following code to the end of the Escrow Contract example:
console.log("Jackie withdraws all remaining in escrow contract tokens directly without using escrow contract.")constdirectWithdrawTx=awaitMina.transaction({sender: jackie,
fee,},async()=>{awaittoken.transfer(escrowContract.publicKey,jackie,newUInt64(1e9))})awaitdirectWithdrawTx.prove()directWithdrawTx.sign([jackie.key,escrowContract.privateKey])constdirectWithdrawTxResult=awaitdirectWithdrawTx.send().then((v)=>v.wait())equal(directWithdrawTxResult.status,"included")constescrowBalanceAfterDirectWithdraw=(awaittoken.getBalanceOf(escrowContract.publicKey)).toBigInt()console.log("Escrow balance after direct withdraw:",escrowBalanceAfterDirectWithdraw/1_000_000_000n)equal(escrowBalanceAfterDirectWithdraw,BigInt(0e9))
It runs, and Jackie gets all the tokens of the Escrow Contract without even using the Escrow Contract code:
Jackie withdraws all remaining in escrow contract tokens directly without using escrow contract.
Escrow balance after direct withdraw: 0n
The problem is that the Escrow Contract verification key is installed to the account {publicKey: escrowContract.publicKey}
constescrowBalanceAfterWithdraw=(awaittoken.getBalanceOf(escrowContract.publicKey)).toBigInt()console.log("Escrow balance after deposit:",escrowBalanceAfterDeposit2)equal(escrowBalanceAfterWithdraw,BigInt(1e9))
prints a wrong value (escrowBalanceAfterDeposit2 instead of escrowBalanceAfterWithdraw)
The text was updated successfully, but these errors were encountered:
thirdPartyTokenHolder=newTokenHolder(zkAppAddress,token.token.id);consttx=awaitMina.transaction(deployerAccount,()=>{// pay for deployment of 'thirdPartyTokenHolder'// token account by deployerAccountAccountUpdate.createSigned(deployerAccount).balance.subInPlace(Mina.accountCreationFee());thirdPartyTokenHolder.deploy();token.approveAccountUpdate(thirdPartyTokenHolder.self);});
If you will add the following code to the end of the Escrow Contract example:
It runs, and Jackie gets all the tokens of the Escrow Contract without even using the Escrow Contract code:
The problem is that the Escrow Contract verification key is installed to the account {publicKey: escrowContract.publicKey}
while the tokens are being transferred to another account: {publicKey: escrowContract.publicKey, tokenId} that Escrow Contract does not affect at all.
Also a couple of minor comments:
https://github.com/MinaFoundation/mina-fungible-token/blob/main/examples/escrow.eg.ts#L43
total.greaterThanOrEqual(amount)
gives the Bool result that is not being checkedhttps://github.com/MinaFoundation/mina-fungible-token/blob/main/examples/escrow.eg.ts#L200
prints a wrong value (
escrowBalanceAfterDeposit2
instead ofescrowBalanceAfterWithdraw
)The text was updated successfully, but these errors were encountered: