updated connector event return

This commit is contained in:
Samyak Jain 2021-02-07 23:48:38 +05:30
parent 7f7d03157e
commit aa67b788a3
2 changed files with 14 additions and 12 deletions

View File

@ -12,7 +12,7 @@ abstract contract CompResolver is Events, Helpers {
* @dev Claim Accrued COMP Token. * @dev Claim Accrued COMP Token.
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract. * @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()); TokenInterface compToken = TokenInterface(getCompTokenAddress());
uint intialBal = compToken.balanceOf(address(this)); uint intialBal = compToken.balanceOf(address(this));
ComptrollerInterface(getComptrollerAddress()).claimComp(address(this)); ComptrollerInterface(getComptrollerAddress()).claimComp(address(this));
@ -21,7 +21,8 @@ abstract contract CompResolver is Events, Helpers {
setUint(setId, amt); 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 tokens Array of tokens supplied and borrowed.
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract. * @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; uint _len = tokens.length;
address[] memory ctokens = new address[](_len); address[] memory ctokens = new address[](_len);
for (uint i = 0; i < _len; i++) { for (uint i = 0; i < _len; i++) {
@ -44,7 +45,8 @@ abstract contract CompResolver is Events, Helpers {
setUint(setId, amt); 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 borrowTokens Array of tokens borrowed.
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract. * @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 ctokens, bool isBorrow, bool isSupply) = mergeTokenArr(supplyTokens, borrowTokens);
address[] memory holders = new address[](1); address[] memory holders = new address[](1);
@ -67,20 +69,22 @@ abstract contract CompResolver is Events, Helpers {
setUint(setId, amt); setUint(setId, amt);
return encodeEvent("LogClaimedComp(uint256,uint256)", abi.encode(amt, setId)); eventName = "LogClaimedComp(uint256,uint256)";
_eventParam = abi.encode(amt, setId);
} }
/** /**
* @dev Delegate votes. * @dev Delegate votes.
* @param delegatee The address to delegate votes to. * @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()); COMPInterface compToken = COMPInterface(getCompTokenAddress());
require(compToken.delegates(address(this)) != delegatee, "Already delegated to same delegatee."); require(compToken.delegates(address(this)) != delegatee, "Already delegated to same delegatee.");
compToken.delegate(delegatee); compToken.delegate(delegatee);
return encodeEvent("LogDelegate(address)", abi.encode(delegatee)); eventName = "LogClaimedComp(uint256,uint256)";
_eventParam = abi.encode(amt, setId);
} }
} }

View File

@ -1,4 +1,4 @@
pragma solidity ^0.6.0; pragma solidity ^0.7.0;
/** /**
* @title StaticConnectBasic. * @title StaticConnectBasic.
@ -40,9 +40,7 @@ contract BasicResolver is Memory {
/** /**
* @dev ETH Address. * @dev ETH Address.
*/ */
function ethAddr internal pure returns (address) { address constant internal ethAddr = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
}
/** /**
* @dev Withdraw Assets To Smart Account. * @dev Withdraw Assets To Smart Account.