Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add separate event for swap rate updates #13

Merged
merged 1 commit into from
Nov 3, 2021
Merged
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
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