From bfd3e3107ac2aa1ab6903bb2863b81600851852d Mon Sep 17 00:00:00 2001 From: "ray.wu" Date: Tue, 8 Feb 2022 19:05:24 +0800 Subject: [PATCH] update msgsender --- contracts/child/ChildToken/ChildERC20ForExchange.sol | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/child/ChildToken/ChildERC20ForExchange.sol b/contracts/child/ChildToken/ChildERC20ForExchange.sol index 04d71fa..8d7c7e3 100755 --- a/contracts/child/ChildToken/ChildERC20ForExchange.sol +++ b/contracts/child/ChildToken/ChildERC20ForExchange.sol @@ -81,16 +81,16 @@ contract ChildERC20ForExchange is function swapIn(uint256 amount) public { 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); + IERC20(originToken).transferFrom(_msgSender(), address(this), amount); + _mint(_msgSender(), amount); + emit SwapIn(_msgSender(), 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); + _burn(_msgSender(), amount); + IERC20(originToken).transfer(_msgSender(), amount); + emit SwapOut(_msgSender(), amount); } }