mirror of
https://github.com/codex-storage/codex-contracts-eth.git
synced 2025-01-10 20:06:09 +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;
|
||||
}
|
||||
|
||||
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 {
|
||||
token.transferFrom(msg.sender, address(this), amount);
|
||||
transferFrom(msg.sender, amount);
|
||||
totals.deposited += amount;
|
||||
add(msg.sender, amount);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user