Skip to content

Commit

Permalink
Fix assembly_script_transfer_coins
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey committed Mar 18, 2024
1 parent f0a16ed commit 92b59cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vm-mock/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,13 @@ export default function createMockedABI(
balance: BigInt(0),
});
}
const callerBalance = ledger.get(callerAddress).balance;
if (callerBalance < BigInt(_coinsAmount)) {
const contractBalance = ledger.get(contractAddress).balance;
if (contractBalance < BigInt(_coinsAmount)) {
throw new Error(
`Runtime error: not enough balance to transfer ${_coinsAmount} coins.`,
);
}
ledger.get(callerAddress).balance -= BigInt(_coinsAmount);
ledger.get(contractAddress).balance -= BigInt(_coinsAmount);
ledger.get(address).balance += BigInt(_coinsAmount);
},

Expand Down

0 comments on commit 92b59cd

Please sign in to comment.