Skip to content
This repository was archived by the owner on Dec 24, 2020. It is now read-only.

Check sent ETH when buying oTokens #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion contracts/OptionsExchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ contract OptionsExchange {
IERC20 oToken,
uint256 _amt,
address payable _transferTo
) public returns (uint256) {
) internal returns (uint256) {
require(!isETH(oToken), "Can only buy oTokens");

if (!isETH(paymentToken)) {
Expand Down Expand Up @@ -224,6 +224,8 @@ contract OptionsExchange {

uint256 ethToTransfer = exchange.getEthToTokenOutputPrice(_amt);

require(msg.value == ethToTransfer, "Not enough ETH to buy oToken");

emit BuyOTokens(
msg.sender,
_transferTo,
Expand Down
Loading