Skip to content

Commit

Permalink
Add separate event for swap rate updates (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
k1rill-fedoseev authored Nov 3, 2021
1 parent 9a40d78 commit 7f2508f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions contracts/SBCWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ contract SBCWrapper is IERC677Receiver, PausableEIP1967Admin, Claimable, Reentra
SBCToken public immutable sbcToken;

event Swap(address indexed token, address indexed user, uint256 amount, uint256 received);
event TokenSwapEnabled(address indexed token, uint256 rate);
event SwapRateUpdated(address indexed token, uint256 rate);
event TokenSwapEnabled(address indexed token);
event TokenSwapPaused(address indexed token);

constructor(SBCToken _sbcToken) {
Expand All @@ -44,10 +45,14 @@ contract SBCWrapper is IERC677Receiver, PausableEIP1967Admin, Claimable, Reentra
function enableToken(address _token, uint256 _rate) external onlyAdmin {
require(_rate > 0, "SBCWrapper: invalid rate");

TokenStatus oldStatus = tokenStatus[_token];
tokenStatus[_token] = TokenStatus.ENABLED;
tokenRate[_token] = _rate;

emit TokenSwapEnabled(_token, _rate);
if (oldStatus != TokenStatus.ENABLED) {
emit TokenSwapEnabled(_token);
}
emit SwapRateUpdated(_token, _rate);
}

/**
Expand Down

0 comments on commit 7f2508f

Please sign in to comment.