Ketuojo Moses
Ketuojo Moses

Reputation: 1

Check to make sure a solidity line of code ran successfully

how do I confirm this a solidity line of code ran successfully

claimed[msg.sender] = claimed[msg.sender].add(1); // make sure this goes first before transfer to prevent reentrancy

Upvotes: 0

Views: 161

Answers (1)

Petr Hejda
Petr Hejda

Reputation: 43561

Assuming it's the SafeMath library function add(), it contains an assert() condition in case of integer overlow. If the claimed[msg.sender] value overflows, it throws an exception, and an uncaught exception causes the transaction to revert.

So if the transaction executing this line doesn't revert (assuming there's no try/catch block), the line was executed successfully.

Upvotes: 1

Related Questions