Skip to content

Commit

Permalink
Don't transfer if value is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienFT committed May 7, 2024
1 parent fd93902 commit 2ad4d2a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion smart-contract/assembly/contracts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ export function dnsAlloc(binaryArgs: StaticArray<u8>): StaticArray<u8> {
domainCost.toString() +
'.',
);
transferCoins(Context.caller(), transferredCoins - domainCost);
if (transferredCoins > domainCost) {
transferCoins(Context.caller(), transferredCoins - domainCost);
}
return u256ToBytes(counter);
}

Expand Down

0 comments on commit 2ad4d2a

Please sign in to comment.