Skip to content

Commit

Permalink
adding in outboundAmount
Browse files Browse the repository at this point in the history
  • Loading branch information
sirarthurmoney committed Nov 8, 2023
1 parent 5bc2958 commit 920b723
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contracts/token/oft/v2/fee/NativeOFTWithFee.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import "./OFTWithFee.sol";

contract NativeOFTWithFee is OFTWithFee, ReentrancyGuard {

uint public outboundAmount;

event Deposit(address indexed _dst, uint _amount);
event Withdrawal(address indexed _src, uint _amount);

Expand Down Expand Up @@ -103,6 +105,7 @@ contract NativeOFTWithFee is OFTWithFee, ReentrancyGuard {
}

_transfer(msg.sender, address(this), _amount);
outboundAmount += _amount;
return messageFee;
}

Expand Down Expand Up @@ -130,10 +133,12 @@ contract NativeOFTWithFee is OFTWithFee, ReentrancyGuard {

_spendAllowance(_from, msg.sender, _amount);
_transfer(_from, address(this), _amount);
outboundAmount += _amount;
return messageFee;
}

function _creditTo(uint16, address _toAddress, uint _amount) internal override returns(uint) {
outboundAmount -= _amount;
_burn(address(this), _amount);
(bool success, ) = _toAddress.call{value: _amount}("");
require(success, "NativeOFTWithFee: failed to _creditTo");
Expand Down

0 comments on commit 920b723

Please sign in to comment.