From d1519c56fd822dde55ab27a9504920567acf40c1 Mon Sep 17 00:00:00 2001 From: Dimitri <69167058+dimsome@users.noreply.github.com> Date: Thu, 20 Jan 2022 12:31:42 +0700 Subject: [PATCH] fix: eventsParams --- contracts/mainnet/connectors/mstable/main.sol | 19 +++++++++++-------- contracts/polygon/connectors/mstable/main.sol | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/contracts/mainnet/connectors/mstable/main.sol b/contracts/mainnet/connectors/mstable/main.sol index 05080c3d..7f4d3cab 100644 --- a/contracts/mainnet/connectors/mstable/main.sol +++ b/contracts/mainnet/connectors/mstable/main.sol @@ -33,6 +33,7 @@ abstract contract mStableResolver is Events, Helpers { ) external returns (string memory _eventName, bytes memory _eventParam) { // uint256 mintedAmount = _amount; + address path; // Check if needs to be minted first if (IMasset(mUsdToken).bAssetIndexes(_token) != 0) { @@ -44,11 +45,13 @@ abstract contract mStableResolver is Events, Helpers { _minOut, address(this) ); + path = mUsdToken; } else { require(mintedAmount >= _minOut, "mintedAmount < _minOut"); + path = imUsdToken } - return _deposit(_token, mintedAmount, imUsdToken); + return _deposit(_token, mintedAmount, path); } /** @@ -115,7 +118,7 @@ abstract contract mStableResolver is Events, Helpers { require(amountWithdrawn >= _minOut, "amountWithdrawn < _minOut"); } - _eventName = "LogWithdraw()"; + _eventName = "LogWithdraw(address,uint256,address)"; _eventParam = abi.encode(mUsdToken, amountWithdrawn, imUsdToken); } @@ -154,7 +157,7 @@ abstract contract mStableResolver is Events, Helpers { address(this) ); - _eventName = "LogRedeem()"; + _eventName = "LogWithdraw(address,uint256,address)"; _eventParam = abi.encode(_token, amountRedeemed, _path); } @@ -178,7 +181,7 @@ abstract contract mStableResolver is Events, Helpers { uint256 claimedRewardToken = sub(rewardAmountUpdated, rewardAmount); - _eventName = "LogClaimRewards()"; + _eventName = "LogClaimRewards(address,uint256)"; _eventParam = abi.encode(rewardToken, claimedRewardToken); } @@ -231,7 +234,7 @@ abstract contract mStableResolver is Events, Helpers { ); } - _eventName = "LogSwap()"; + _eventName = "LogSwap(address,address,uint256,uint256)"; _eventParam = abi.encode(_input, _output, _amount, amountSwapped); } @@ -269,7 +272,7 @@ abstract contract mStableResolver is Events, Helpers { address(this) ); - _eventName = "LogSwap()"; + _eventName = "LogSwap(address,address,uint256,uint256)"; _eventParam = abi.encode(_input, _output, _amount, amountSwapped); } @@ -304,7 +307,7 @@ abstract contract mStableResolver is Events, Helpers { IBoostedSavingsVault(imUsdVault).stake(credits); // 3. Log Events - _eventName = "LogDeposit()"; + _eventName = "LogDeposit(address,uint256,address)"; _eventParam = abi.encode(_token, _amount, _path); } @@ -359,5 +362,5 @@ abstract contract mStableResolver is Events, Helpers { } contract ConnectV2mStable is mStableResolver { - string public constant name = "mStable-Mainnet-Connector-v1"; + string public constant name = "mStable-v1.0"; } diff --git a/contracts/polygon/connectors/mstable/main.sol b/contracts/polygon/connectors/mstable/main.sol index 4e69d843..69b63e48 100644 --- a/contracts/polygon/connectors/mstable/main.sol +++ b/contracts/polygon/connectors/mstable/main.sol @@ -33,6 +33,7 @@ abstract contract PmStableResolver is Events, Helpers { ) external returns (string memory _eventName, bytes memory _eventParam) { // uint256 mintedAmount = _amount; + address path; // Check if needs to be minted first if (IMasset(mUsdToken).bAssetIndexes(_token) != 0) { @@ -44,11 +45,13 @@ abstract contract PmStableResolver is Events, Helpers { _minOut, address(this) ); + path = mUsdToken; } else { require(mintedAmount >= _minOut, "mintedAmount < _minOut"); + path = imUsdToken } - return _deposit(_token, mintedAmount, imUsdToken); + return _deposit(_token, mintedAmount, path); } /** @@ -115,7 +118,7 @@ abstract contract PmStableResolver is Events, Helpers { require(amountWithdrawn >= _minOut, "amountWithdrawn < _minOut"); } - _eventName = "LogWithdraw()"; + _eventName = "LogWithdraw(address,uint256,address)"; _eventParam = abi.encode(mUsdToken, amountWithdrawn, imUsdToken); } @@ -154,7 +157,7 @@ abstract contract PmStableResolver is Events, Helpers { address(this) ); - _eventName = "LogRedeem()"; + _eventName = "LogWithdraw(address,uint256,address)"; _eventParam = abi.encode(_token, amountRedeemed, _path); } @@ -189,7 +192,7 @@ abstract contract PmStableResolver is Events, Helpers { platformAmount ); - _eventName = "LogClaimRewards()"; + _eventName = "LogClaimRewards(address,uint256,address,uint256)"; _eventParam = abi.encode( rewardToken, claimedRewardToken, @@ -247,7 +250,7 @@ abstract contract PmStableResolver is Events, Helpers { ); } - _eventName = "LogSwap()"; + _eventName = "LogSwap(address,address,uint256,uint256)"; _eventParam = abi.encode(_input, _output, _amount, amountSwapped); } @@ -285,7 +288,7 @@ abstract contract PmStableResolver is Events, Helpers { address(this) ); - _eventName = "LogSwap()"; + _eventName = "LogSwap(address,address,uint256,uint256)"; _eventParam = abi.encode(_input, _output, _amount, amountSwapped); } @@ -320,7 +323,7 @@ abstract contract PmStableResolver is Events, Helpers { IStakingRewardsWithPlatformToken(imUsdVault).stake(credits); // 3. Log Events - _eventName = "LogDeposit()"; + _eventName = "LogDeposit(address,uint256,address)"; _eventParam = abi.encode(_token, _amount, _path); } @@ -382,5 +385,5 @@ abstract contract PmStableResolver is Events, Helpers { } contract ConnectV2PmStable is PmStableResolver { - string public constant name = "mStable-Polygon-Connector-v1"; + string public constant name = "mStable-Polygon-v1.0"; }