▓!▓~▫#$□□$%╳▒╱&□▒□╳#^╲^□&?╱◆$╲#^~~■□█*@&╳#░░%■█▫~◆▒!&╲○█&~░&▒*◆█
Transaction ID
Execution Fee
0.00000249 FLOWExecution Error
pre-condition failed: FungibleToken.Vault.withdraw: Cannot withdraw tokens! The amount requested to be withdrawn (50.00000000) is greater than the balance of the Vault (4.00000000).
Raw Error
[Error Code: 1101] error caused by: 1 error occurred: * transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed: error: pre-condition failed: FungibleToken.Vault.withdraw: Cannot withdraw tokens! The amount requested to be withdrawn (50.00000000) is greater than the balance of the Vault (4.00000000). --> f233dcee88fe0abe.FungibleToken:224:16 Was this error unhelpful? Consider suggesting an improvement here: https://github.com/onflow/cadence/issues.
Transaction Summary
Contract CallCalled FungibleToken, TSHOT, TSHOTExchange
Contracts
Script Arguments
Cadence Script
1import FungibleToken from 0xf233dcee88fe0abe
2import TSHOT from 0x05b67ba314000b2d
3import TSHOTExchange from 0x05b67ba314000b2d
4
5transaction(betAmount: UFix64) {
6
7 prepare(signer: auth(Storage, BorrowValue, Capabilities) &Account) {
8
9 // enforce 50-TSHOT limit (unchanged)
10 if betAmount > 50.0 {
11 panic("Cannot commit more than 50 TSHOT.")
12 }
13
14 // withdraw bet from the user's vault
15 let vaultRef = signer.storage
16 .borrow<auth(FungibleToken.Withdraw) & TSHOT.Vault>(from: /storage/TSHOTTokenVault)
17 ?? panic("Cannot borrow TSHOT vault")
18 let bet <- vaultRef.withdraw(amount: betAmount)
19
20 let receipt <- TSHOTExchange.commitSwap(
21 payer: signer.address,
22 bet: <- bet
23 )
24
25 // save receipt and (optionally) publish capability
26 if signer.storage.type(at: TSHOTExchange.ReceiptStoragePath) != nil {
27 panic("Receipt already stored at ".concat(TSHOTExchange.ReceiptStoragePath.toString()))
28 }
29 signer.storage.save(<- receipt, to: TSHOTExchange.ReceiptStoragePath)
30
31 if signer.capabilities.borrow<&TSHOTExchange.Receipt>(/public/TSHOTReceipt) == nil {
32 let cap = signer.capabilities.storage.issue<&TSHOTExchange.Receipt>(
33 TSHOTExchange.ReceiptStoragePath
34 )
35 signer.capabilities.publish(cap, at: /public/TSHOTReceipt)
36 }
37 }
38
39 execute {
40 log("Commit successful: receipt saved and capability published.")
41 }
42}