Skip to content

Commit

Permalink
add event log
Browse files Browse the repository at this point in the history
  • Loading branch information
tomatoishealthy committed Feb 8, 2022
1 parent 4fd217c commit ad066ef
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contracts/child/ChildToken/ChildERC20ForExchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ contract ChildERC20ForExchange is
NativeMetaTransaction,
ContextMixin
{
event SwapIn(address indexed sender, uint256 value);
event SwapOut(address indexed sender, uint256 value);

bytes32 public constant DEPOSITOR_ROLE = keccak256("DEPOSITOR_ROLE");

address public immutable originToken;
Expand Down Expand Up @@ -80,12 +83,14 @@ contract ChildERC20ForExchange is
require(originToken != address(0x0), "origin token not set");
IERC20(originToken).transferFrom(msg.sender, address(this), amount);
_mint(msg.sender, amount);
emit SwapIn(msg.sender, amount);
}

function swapOut(uint256 amount) public {
require(originToken != address(0x0), "origin token not set");
_burn(msg.sender, amount);
IERC20(originToken).transfer(msg.sender, amount);
emit SwapOut(msg.sender, amount);
}

}

0 comments on commit ad066ef

Please sign in to comment.