raw function added

This commit is contained in:
Samyak Jain 2021-03-29 03:12:57 +05:30
parent 3af67589e8
commit 88c8a689c2
2 changed files with 16 additions and 7 deletions

View File

@ -3,7 +3,6 @@ pragma solidity ^0.7.0;
contract Events { contract Events {
event LogDeposit( event LogDeposit(
address indexed token, address indexed token,
string tokenId,
address cToken, address cToken,
uint256 tokenAmt, uint256 tokenAmt,
uint256 getId, uint256 getId,

View File

@ -15,15 +15,15 @@ abstract contract CompoundResolver is Events, Helpers {
* @param getId Get token amount at this ID from `InstaMemory` Contract. * @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract. * @param setId Set token amount at this ID in `InstaMemory` Contract.
*/ */
function deposit( function depositRaw(
string calldata tokenId, address token,
address cToken,
uint256 amt, uint256 amt,
uint256 getId, uint256 getId,
uint256 setId uint256 setId
) external payable returns (string memory _eventName, bytes memory _eventParam) { ) public payable returns (string memory _eventName, bytes memory _eventParam) {
uint _amt = getUint(getId, amt); uint _amt = getUint(getId, amt);
(address token, address cToken) = compMapping.getMapping(tokenId);
require(token != address(0) && cToken != address(0), "ctoken mapping not found"); require(token != address(0) && cToken != address(0), "ctoken mapping not found");
enterMarket(cToken); enterMarket(cToken);
@ -38,8 +38,18 @@ abstract contract CompoundResolver is Events, Helpers {
} }
setUint(setId, _amt); setUint(setId, _amt);
_eventName = "LogDeposit(address,string,address,uint256,uint256,uint256)"; _eventName = "LogDeposit(address,address,uint256,uint256,uint256)";
_eventParam = abi.encode(token, tokenId, cToken, _amt, getId, setId); _eventParam = abi.encode(token, cToken, _amt, getId, setId);
}
function deposit(
string calldata tokenId,
uint256 amt,
uint256 getId,
uint256 setId
) external payable returns (string memory _eventName, bytes memory _eventParam) {
(address token, address cToken) = compMapping.getMapping(tokenId);
(_eventName, _eventParam) = depositRaw(token, cToken, amt, getId, setId);
} }
/** /**