From aa67b788a3a7bb1db24313054d3bf8b388263b5a Mon Sep 17 00:00:00 2001 From: Samyak Jain <34437877+KaymasJain@users.noreply.github.com> Date: Sun, 7 Feb 2021 23:48:38 +0530 Subject: [PATCH] updated connector event return --- contracts/connectors/COMP/main.sol | 20 ++++++++++++-------- contracts/static/basic.sol | 6 ++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/contracts/connectors/COMP/main.sol b/contracts/connectors/COMP/main.sol index a1f870bd..ae432c0c 100644 --- a/contracts/connectors/COMP/main.sol +++ b/contracts/connectors/COMP/main.sol @@ -12,7 +12,7 @@ abstract contract CompResolver is Events, Helpers { * @dev Claim Accrued COMP Token. * @param setId Set ctoken amount at this ID in `InstaMemory` Contract. */ - function ClaimComp(uint setId) external payable returns (bytes memory) { + function ClaimComp(uint setId) external payable returns (string memory _eventName, bytes memory _eventParam) { TokenInterface compToken = TokenInterface(getCompTokenAddress()); uint intialBal = compToken.balanceOf(address(this)); ComptrollerInterface(getComptrollerAddress()).claimComp(address(this)); @@ -21,7 +21,8 @@ abstract contract CompResolver is Events, Helpers { setUint(setId, amt); - return encodeEvent("LogClaimedComp(uint256,uint256)", abi.encode(amt, setId)); + eventName = "LogClaimedComp(uint256,uint256)"; + _eventParam = abi.encode(amt, setId); } /** @@ -29,7 +30,7 @@ abstract contract CompResolver is Events, Helpers { * @param tokens Array of tokens supplied and borrowed. * @param setId Set ctoken amount at this ID in `InstaMemory` Contract. */ - function ClaimCompTwo(address[] calldata tokens, uint setId) external payable returns (bytes memory) { + function ClaimCompTwo(address[] calldata tokens, uint setId) external payable returns (string memory _eventName, bytes memory _eventParam) { uint _len = tokens.length; address[] memory ctokens = new address[](_len); for (uint i = 0; i < _len; i++) { @@ -44,7 +45,8 @@ abstract contract CompResolver is Events, Helpers { setUint(setId, amt); - return encodeEvent("LogClaimedComp(uint256,uint256)", abi.encode(amt, setId)); + eventName = "LogClaimedComp(uint256,uint256)"; + _eventParam = abi.encode(amt, setId); } /** @@ -53,7 +55,7 @@ abstract contract CompResolver is Events, Helpers { * @param borrowTokens Array of tokens borrowed. * @param setId Set ctoken amount at this ID in `InstaMemory` Contract. */ - function ClaimCompThree(address[] calldata supplyTokens, address[] calldata borrowTokens, uint setId) external payable returns (bytes memory) { + function ClaimCompThree(address[] calldata supplyTokens, address[] calldata borrowTokens, uint setId) external payable returns (string memory _eventName, bytes memory _eventParam) { (address[] memory ctokens, bool isBorrow, bool isSupply) = mergeTokenArr(supplyTokens, borrowTokens); address[] memory holders = new address[](1); @@ -67,20 +69,22 @@ abstract contract CompResolver is Events, Helpers { setUint(setId, amt); - return encodeEvent("LogClaimedComp(uint256,uint256)", abi.encode(amt, setId)); + eventName = "LogClaimedComp(uint256,uint256)"; + _eventParam = abi.encode(amt, setId); } /** * @dev Delegate votes. * @param delegatee The address to delegate votes to. */ - function delegate(address delegatee) external payable returns (bytes memory) { + function delegate(address delegatee) external payable returns (string memory _eventName, bytes memory _eventParam) { COMPInterface compToken = COMPInterface(getCompTokenAddress()); require(compToken.delegates(address(this)) != delegatee, "Already delegated to same delegatee."); compToken.delegate(delegatee); - return encodeEvent("LogDelegate(address)", abi.encode(delegatee)); + eventName = "LogClaimedComp(uint256,uint256)"; + _eventParam = abi.encode(amt, setId); } } diff --git a/contracts/static/basic.sol b/contracts/static/basic.sol index 80b1e33b..7c2c669f 100644 --- a/contracts/static/basic.sol +++ b/contracts/static/basic.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.0; +pragma solidity ^0.7.0; /** * @title StaticConnectBasic. @@ -40,9 +40,7 @@ contract BasicResolver is Memory { /** * @dev ETH Address. */ - function ethAddr internal pure returns (address) { - return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; - } + address constant internal ethAddr = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; /** * @dev Withdraw Assets To Smart Account.