mirror of
https://github.com/status-im/dagger-contracts.git
synced 2025-03-03 15:50:43 +00:00
Check result of ERC20 transferFrom call
This commit is contained in:
parent
9e0d05965d
commit
2f59927b30
@ -26,8 +26,13 @@ contract Collateral {
|
|||||||
totals.balance -= amount;
|
totals.balance -= amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function transferFrom(address sender, uint256 amount) private {
|
||||||
|
address receiver = address(this);
|
||||||
|
require(token.transferFrom(sender, receiver, amount), "Transfer failed");
|
||||||
|
}
|
||||||
|
|
||||||
function deposit(uint256 amount) public invariant {
|
function deposit(uint256 amount) public invariant {
|
||||||
token.transferFrom(msg.sender, address(this), amount);
|
transferFrom(msg.sender, amount);
|
||||||
totals.deposited += amount;
|
totals.deposited += amount;
|
||||||
add(msg.sender, amount);
|
add(msg.sender, amount);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user