Marge main and update comments

This commit is contained in:
Mubaris NK 2021-03-29 22:20:07 +05:30
commit 28da8598cc
No known key found for this signature in database
GPG Key ID: 9AC09AD0F8D68561
14 changed files with 228 additions and 184 deletions

View File

@ -1,19 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
contract Migrations {
address public owner = msg.sender;
uint public last_completed_migration;
modifier restricted() {
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
}

View File

@ -85,13 +85,14 @@ abstract contract OneInchResolverHelpers is OneInchResolver {
abstract contract OneInch is OneInchResolverHelpers {
/**
* @dev Sell ETH/ERC20_Token using 1inch.
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr selling token amount.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAmt selling token amount.
* @param unitAmt unit amount of buyAmt/sellAmt with slippage.
* @dev Sell ETH/ERC20_Token using 1Inch.
* @notice Swap tokens from exchanges like kyber, 0x etc, with calculation done off-chain.
* @param buyAddr The address of the token to buy.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr The address of the token to sell.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAmt The amount of the token to sell.
* @param unitAmt The amount of buyAmt/sellAmt with slippage.
* @param callData Data from 1inch API.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @param setId ID stores the amount of token brought.
*/
function sell(
address buyAddr,
@ -118,5 +119,5 @@ abstract contract OneInch is OneInchResolverHelpers {
}
contract ConnectV2OneInch is OneInch {
string public name = "1inch-v1";
string public name = "1Inch-v1";
}

View File

@ -131,15 +131,16 @@ abstract contract OneProtoResolverHelpers is OneProtoResolver {
abstract contract OneProto is OneProtoResolverHelpers {
/**
* @dev Sell ETH/ERC20_Token using 1proto using off-chain calculation.
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr selling token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAmt selling token amount.
* @param unitAmt unit amount of buyAmt/sellAmt with slippage.
* @param distribution distribution of swap across different dex.
* @param disableDexes disable a dex. (To disable none: 0)
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @dev Sell ETH/ERC20_Token using 1Proto using off-chain calculation.
* @notice Swap tokens from exchanges like Uniswap, Kyber etc, with calculation done off-chain.
* @param buyAddr The address of the token to buy.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr The address of the token to sell.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAmt The amount of the token to sell.
* @param unitAmt The amount of buyAmt/sellAmt with slippage.
* @param distribution The distribution of swap across different DEXs.
* @param disableDexes Disable a dex. (To disable none: 0)
* @param getId ID to retrieve sellAmt.
* @param setId ID stores the amount of token brought.
*/
function sell(
address buyAddr,
@ -168,14 +169,15 @@ abstract contract OneProto is OneProtoResolverHelpers {
}
/**
* @dev Sell ETH/ERC20_Token using 1proto using muliple token.
* @param tokens array of tokens.
* @param sellAmt selling token amount.
* @param unitAmt unit amount of buyAmt/sellAmt with slippage.
* @param distribution distribution of swap across different dex.
* @param disableDexes disable a dex. (To disable none: 0)
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @dev Sell Multiple tokens using 1proto using off-chain calculation.
* @notice Swap multiple tokens from exchanges like Uniswap, Kyber etc, with calculation done off-chain.
* @param tokens Array of tokens.
* @param sellAmt The amount of the token to sell.
* @param unitAmt The amount of buyAmt/sellAmt with slippage.
* @param distribution The distribution of swap across different DEXs.
* @param disableDexes Disable a dex. (To disable none: 0)
* @param getId ID to retrieve sellAmt.
* @param setId ID stores the amount of token brought.
*/
function sellMulti(
address[] calldata tokens,

View File

@ -9,7 +9,8 @@ abstract contract CompResolver is Events, Helpers {
/**
* @dev Claim Accrued COMP Token.
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract.
* @notice Claim Accrued COMP Token.
* @param setId ID stores the amount of COMP claimed.
*/
function ClaimComp(uint256 setId) external payable returns (string memory _eventName, bytes memory _eventParam) {
TokenInterface _compToken = TokenInterface(address(compToken));
@ -26,8 +27,9 @@ abstract contract CompResolver is Events, Helpers {
/**
* @dev Claim Accrued COMP Token.
* @notice Claim Accrued COMP Token.
* @param tokens Array of tokens supplied and borrowed.
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract.
* @param setId ID stores the amount of COMP claimed.
*/
function ClaimCompTwo(address[] calldata tokens, uint256 setId) external payable returns (string memory _eventName, bytes memory _eventParam) {
uint _len = tokens.length;
@ -50,9 +52,10 @@ abstract contract CompResolver is Events, Helpers {
/**
* @dev Claim Accrued COMP Token.
* @notice Claim Accrued COMP Token.
* @param supplyTokens Array of tokens supplied.
* @param borrowTokens Array of tokens borrowed.
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract.
* @param setId ID stores the amount of COMP claimed.
*/
function ClaimCompThree(address[] calldata supplyTokens, address[] calldata borrowTokens, uint256 setId) external payable returns (string memory _eventName, bytes memory _eventParam) {
(address[] memory ctokens, bool isBorrow, bool isSupply) = mergeTokenArr(supplyTokens, borrowTokens);
@ -74,7 +77,8 @@ abstract contract CompResolver is Events, Helpers {
/**
* @dev Delegate votes.
* @param delegatee The address to delegate votes to.
* @notice Delegate votes.
* @param delegatee The address to delegate the votes to.
*/
function delegate(address delegatee) external payable returns (string memory _eventName, bytes memory _eventParam) {
require(compToken.delegates(address(this)) != delegatee, "Already delegated to same delegatee.");

View File

@ -9,10 +9,11 @@ import { AaveInterface, AaveCoreInterface, ATokenInterface } from "./interface.s
abstract contract AaveResolver is Events, Helpers {
/**
* @dev Deposit ETH/ERC20_Token.
* @param token token address to deposit.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to deposit.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Deposit a token to Aave v1 for lending / collaterization.
* @param token The address of the token to deposit.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of the token to deposit. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens deposited.
*/
function deposit(
address token,
@ -45,10 +46,11 @@ abstract contract AaveResolver is Events, Helpers {
/**
* @dev Withdraw ETH/ERC20_Token.
* @param token token address to withdraw.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to withdraw.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Withdraw deposited token from Aave v1
* @param token The address of the token to withdraw.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of the token to withdraw. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens withdrawn.
*/
function withdraw(
address token,
@ -74,10 +76,11 @@ abstract contract AaveResolver is Events, Helpers {
/**
* @dev Borrow ETH/ERC20_Token.
* @param token token address to borrow.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to borrow.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Borrow a token using Aave v1
* @param token The address of the token to borrow.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of the token to borrow.
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens borrowed.
*/
function borrow(
address token,
@ -96,10 +99,11 @@ abstract contract AaveResolver is Events, Helpers {
/**
* @dev Payback borrowed ETH/ERC20_Token.
* @param token token address to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to payback.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Payback debt owed.
* @param token The address of the token to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of the token to payback. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens paid back.
*/
function payback(
address token,
@ -132,6 +136,7 @@ abstract contract AaveResolver is Events, Helpers {
/**
* @dev Enable collateral
* @notice Enable an array of tokens as collateral
* @param tokens Array of tokens to enable collateral
*/
function enableCollateral(

View File

@ -6,4 +6,5 @@ contract Events {
event LogBorrow(address indexed token, uint256 tokenAmt, uint256 indexed rateMode, uint256 getId, uint256 setId);
event LogPayback(address indexed token, uint256 tokenAmt, uint256 indexed rateMode, uint256 getId, uint256 setId);
event LogEnableCollateral(address[] tokens);
event LogSwapRateMode(address indexed token, uint256 rateMode);
}

View File

@ -12,6 +12,7 @@ interface AaveInterface {
) external;
function repay(address _asset, uint256 _amount, uint256 _rateMode, address _onBehalfOf) external;
function setUserUseReserveAsCollateral(address _asset, bool _useAsCollateral) external;
function swapBorrowRateMode(address _asset, uint256 _rateMode) external;
}
interface AaveLendingPoolProviderInterface {

View File

@ -9,10 +9,11 @@ import { AaveInterface } from "./interface.sol";
abstract contract AaveResolver is Events, Helpers {
/**
* @dev Deposit ETH/ERC20_Token.
* @param token token address to deposit.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to deposit.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Deposit a token to Aave v2 for lending / collaterization.
* @param token The address of the token to deposit.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of the token to deposit. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens deposited.
*/
function deposit(
address token,
@ -52,10 +53,11 @@ abstract contract AaveResolver is Events, Helpers {
/**
* @dev Withdraw ETH/ERC20_Token.
* @param token token address to withdraw.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to withdraw.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Withdraw deposited token from Aave v2
* @param token The address of the token to withdraw.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of the token to withdraw. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens withdrawn.
*/
function withdraw(
address token,
@ -87,11 +89,12 @@ abstract contract AaveResolver is Events, Helpers {
/**
* @dev Borrow ETH/ERC20_Token.
* @param token token address to borrow.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to borrow.
* @param rateMode type of borrow debt.(For Stable: 1, Variable: 2)
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Borrow a token using Aave v2
* @param token The address of the token to borrow.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of the token to borrow.
* @param rateMode The type of borrow debt. (For Stable: 1, Variable: 2)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens borrowed.
*/
function borrow(
address token,
@ -118,11 +121,12 @@ abstract contract AaveResolver is Events, Helpers {
/**
* @dev Payback borrowed ETH/ERC20_Token.
* @param token token address to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt token amount to payback.
* @param rateMode type of borrow debt.(For Stable: 1, Variable: 2)
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Payback debt owed.
* @param token The address of the token to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of the token to payback. (For max: `uint256(-1)`)
* @param rateMode The type of debt paying back. (For Stable: 1, Variable: 2)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens paid back.
*/
function payback(
address token,
@ -156,6 +160,7 @@ abstract contract AaveResolver is Events, Helpers {
/**
* @dev Enable collateral
* @notice Enable an array of tokens as collateral
* @param tokens Array of tokens to enable collateral
*/
function enableCollateral(
@ -173,9 +178,31 @@ abstract contract AaveResolver is Events, Helpers {
}
}
_eventName = "LogEnableCollateral(address[]);";
_eventName = "LogEnableCollateral(address[])";
_eventParam = abi.encode(tokens);
}
/**
* @dev Swap borrow rate mode
* @notice Swaps user borrow rate mode between variable and stable
* @param token The address of the token to swap borrow rate.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param rateMode Desired borrow rate mode. (Stable = 1, Variable = 2)
*/
function swapBorrowRateMode(
address token,
uint rateMode
) external payable returns (string memory _eventName, bytes memory _eventParam) {
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
uint currentRateMode = rateMode == 1 ? 2 : 1;
if (getPaybackBalance(token, currentRateMode) > 0) {
aave.swapBorrowRateMode(token, rateMode);
}
_eventName = "LogSwapRateMode(address,uint256)";
_eventParam = abi.encode(token, rateMode);
}
}
contract ConnectV2AaveV2 is AaveResolver {

View File

@ -7,7 +7,8 @@ import { Events } from "./events.sol";
abstract contract AuthorityResolver is Events, Helpers {
/**
* @dev Add New authority
* @param authority authority Address.
* @notice Add an address as account authority
* @param authority The authority Address.
*/
function add(
address authority
@ -20,7 +21,8 @@ abstract contract AuthorityResolver is Events, Helpers {
/**
* @dev Remove authority
* @param authority authority Address.
* @notice Remove an address as account authority
* @param authority The authority Address.
*/
function remove(
address authority

View File

@ -12,10 +12,11 @@ abstract contract BasicResolver is Events, DSMath, Basic {
/**
* @dev Deposit Assets To Smart Account.
* @param token Token Address.
* @param amt Token Amount.
* @param getId Get Storage ID.
* @param setId Set Storage ID.
* @notice Deposit a token to DSA
* @param token The address of the token to deposit. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of tokens to deposit. (For max: `uint256(-1)` (Not valid for ETH))
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens deposited.
*/
function deposit(
address token,
@ -39,12 +40,13 @@ abstract contract BasicResolver is Events, DSMath, Basic {
}
/**
* @dev Withdraw Assets To Smart Account.
* @param token Token Address.
* @param amt Token Amount.
* @param to Withdraw token address.
* @param getId Get Storage ID.
* @param setId Set Storage ID.
* @dev Withdraw Assets from Smart Account
* @notice Withdraw a token from DSA
* @param token The address of the token to withdraw. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amt The amount of tokens to withdraw. (For max: `uint256(-1)`)
* @param to The address to receive the token upon withdrawal
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens withdrawn.
*/
function withdraw(
address token,

View File

@ -10,11 +10,12 @@ import { CETHInterface, CTokenInterface } from "./interface.sol";
abstract contract CompoundResolver is Events, Helpers {
/**
* @dev Deposit ETH/ERC20_Token.
* @notice Deposit a token to Compound for lending / collaterization.
* @param token The address of the token to deposit. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param cToken The address of the corresponding cToken.
* @param amt token amount to deposit.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @param amt The amount of the token to deposit. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens deposited.
*/
function depositRaw(
address token,
@ -63,11 +64,12 @@ abstract contract CompoundResolver is Events, Helpers {
/**
* @dev Withdraw ETH/ERC20_Token.
* @notice Withdraw deposited token from Compound
* @param token The address of the token to withdraw. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param cToken The address of the corresponding cToken.
* @param amt token amount to withdraw.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @param amt The amount of the token to withdraw. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens withdrawn.
*/
function withdrawRaw(
address token,
@ -116,11 +118,12 @@ abstract contract CompoundResolver is Events, Helpers {
/**
* @dev Borrow ETH/ERC20_Token.
* @notice Borrow a token using Compound
* @param token The address of the token to borrow. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param cToken The address of the corresponding cToken.
* @param amt token amount to borrow.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @param amt The amount of the token to borrow.
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens borrowed.
*/
function borrowRaw(
address token,
@ -161,11 +164,12 @@ abstract contract CompoundResolver is Events, Helpers {
/**
* @dev Payback borrowed ETH/ERC20_Token.
* @notice Payback debt owed.
* @param token The address of the token to payback. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param cToken The address of the corresponding cToken.
* @param amt token amount to payback.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @param amt The amount of the token to payback. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens paid back.
*/
function paybackRaw(
address token,
@ -216,11 +220,12 @@ abstract contract CompoundResolver is Events, Helpers {
/**
* @dev Deposit ETH/ERC20_Token.
* @notice Same as depositRaw. The only difference is this method stores cToken amount in set ID.
* @param token The address of the token to deposit. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param cToken The address of the corresponding cToken.
* @param amt token amount to depositCToken.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set ctoken amount at this ID in `InstaMemory` Contract.
* @param amt The amount of the token to deposit. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of cTokens received.
*/
function depositCTokenRaw(
address token,
@ -280,11 +285,12 @@ abstract contract CompoundResolver is Events, Helpers {
/**
* @dev Withdraw CETH/CERC20_Token using cToken Amt.
* @notice Same as withdrawRaw. The only difference is this method fetch cToken amount in get ID.
* @param token The address of the token to withdraw. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param cToken The address of the corresponding cToken.
* @param cTokenAmt ctoken amount to withdrawCToken.
* @param getId Get ctoken amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @param cTokenAmt The amount of cTokens to withdraw
* @param getId ID to retrieve cTokenAmt
* @param setId ID stores the amount of tokens withdrawn.
*/
function withdrawCTokenRaw(
address token,
@ -335,14 +341,15 @@ abstract contract CompoundResolver is Events, Helpers {
/**
* @dev Liquidate a position.
* @notice Liquidate a position.
* @param borrower Borrower's Address.
* @param tokenToPay The address of the token to pay for liquidation.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param cTokenPay Corresponding cToken address.
* @param tokenInReturn The address of the token to return for liquidation.
* @param cTokenColl Corresponding cToken address.
* @param amt The token amount to pay for liquidation.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of paid for liquidation.
*/
function liquidateRaw(
address borrower,
@ -391,12 +398,13 @@ abstract contract CompoundResolver is Events, Helpers {
/**
* @dev Liquidate a position using the mapping.
* @notice Liquidate a position using the mapping.
* @param borrower Borrower's Address.
* @param tokenIdToPay token id of the token to pay for liquidation.(For eg: ETH-A)
* @param tokenIdInReturn token id of the token to return for liquidation.(For eg: USDC-A)
* @param amt token amount to pay for liquidation.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of paid for liquidation.
*/
function liquidate(
address borrower,

View File

@ -8,6 +8,7 @@ import { VatLike, TokenJoinInterface } from "./interface.sol";
abstract contract MakerResolver is Helpers, Events {
/**
* @dev Open Vault
* @notice Open a MakerDAO Vault
* @param colType Type of Collateral.(eg: 'ETH-A')
*/
function open(string calldata colType) external payable returns (string memory _eventName, bytes memory _eventParam) {
@ -21,6 +22,7 @@ abstract contract MakerResolver is Helpers, Events {
/**
* @dev Close Vault
* @notice Close a MakerDAO Vault
* @param vault Vault ID to close.
*/
function close(uint256 vault) external payable returns (string memory _eventName, bytes memory _eventParam) {
@ -39,10 +41,11 @@ abstract contract MakerResolver is Helpers, Events {
/**
* @dev Deposit ETH/ERC20_Token Collateral.
* @param vault Vault ID.
* @param amt token amount to deposit.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Deposit collateral to a MakerDAO vault
* @param vault Vault ID. (Use 0 for last opened vault)
* @param amt The amount of tokens to deposit. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens deposited.
*/
function deposit(
uint256 vault,
@ -85,10 +88,11 @@ abstract contract MakerResolver is Helpers, Events {
/**
* @dev Withdraw ETH/ERC20_Token Collateral.
* @param vault Vault ID.
* @param amt token amount to withdraw.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Withdraw collateral from a MakerDAO vault
* @param vault Vault ID. (Use 0 for last opened vault)
* @param amt The amount of tokens to withdraw. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of tokens withdrawn.
*/
function withdraw(
uint256 vault,
@ -140,10 +144,11 @@ abstract contract MakerResolver is Helpers, Events {
/**
* @dev Borrow DAI.
* @param vault Vault ID.
* @param amt token amount to borrow.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Borrow DAI using a MakerDAO vault
* @param vault Vault ID. (Use 0 for last opened vault)
* @param amt The amount of DAI to borrow.
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of DAI borrowed.
*/
function borrow(
uint256 vault,
@ -188,10 +193,11 @@ abstract contract MakerResolver is Helpers, Events {
/**
* @dev Payback borrowed DAI.
* @param vault Vault ID.
* @param amt token amount to payback.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Payback DAI debt owed by a MakerDAO vault
* @param vault Vault ID. (Use 0 for last opened vault)
* @param amt The amount of DAI to payback. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of DAI paid back.
*/
function payback(
uint256 vault,
@ -233,10 +239,11 @@ abstract contract MakerResolver is Helpers, Events {
/**
* @dev Withdraw leftover ETH/ERC20_Token after Liquidation.
* @param vault Vault ID.
* @param amt token amount to Withdraw.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Withdraw leftover collateral after Liquidation.
* @param vault Vault ID. (Use 0 for last opened vault)
* @param amt token amount to Withdraw. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of collateral withdrawn.
*/
function withdrawLiquidated(
uint256 vault,
@ -285,13 +292,14 @@ abstract contract MakerResolver is Helpers, Events {
}
/**
* @dev Deposit ETH/ERC20_Token Collateral and Borrow DAI.
* @param vault Vault ID.
* @param depositAmt token deposit amount to Withdraw.
* @param borrowAmt token borrow amount to Withdraw.
* @param getIdDeposit Get deposit token amount at this ID from `InstaMemory` Contract.
* @param getIdBorrow Get borrow token amount at this ID from `InstaMemory` Contract.
* @param setIdDeposit Set deposit token amount at this ID in `InstaMemory` Contract.
* @param setIdBorrow Set borrow token amount at this ID in `InstaMemory` Contract.
* @notice Deposit collateral and borrow DAI.
* @param vault Vault ID. (Use 0 for last opened vault)
* @param depositAmt The amount of tokens to deposit. (For max: `uint256(-1)`)
* @param borrowAmt The amount of DAI to borrow.
* @param getIdDeposit ID to retrieve depositAmt.
* @param getIdBorrow ID to retrieve borrowAmt.
* @param setIdDeposit ID stores the amount of tokens deposited.
* @param setIdBorrow ID stores the amount of DAI borrowed.
*/
function depositAndBorrow(
uint256 vault,
@ -365,10 +373,11 @@ abstract contract MakerResolver is Helpers, Events {
/**
* @dev Exit DAI from urn.
* @param vault Vault ID.
* @param amt token amount to exit.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Exit DAI from urn.
* @param vault Vault ID. (Use 0 for last opened vault)
* @param amt The amount of DAI to exit. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of DAI exited.
*/
function exitDai(
uint256 vault,
@ -406,9 +415,10 @@ abstract contract MakerResolver is Helpers, Events {
/**
* @dev Deposit DAI in DSR.
* @param amt DAI amount to deposit.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Deposit DAI in DSR.
* @param amt The amount of DAI to deposit. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of DAI deposited.
*/
function depositDai(
uint256 amt,
@ -439,9 +449,10 @@ abstract contract MakerResolver is Helpers, Events {
/**
* @dev Withdraw DAI from DSR.
* @param amt DAI amount to withdraw.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Withdraw DAI from DSR.
* @param amt The amount of DAI to withdraw. (For max: `uint256(-1)`)
* @param getId ID to retrieve amt.
* @param setId ID stores the amount of DAI withdrawn.
*/
function withdrawDai(
uint256 amt,

View File

@ -7,13 +7,14 @@ import { Events } from "./events.sol";
abstract contract UniswapResolver is Helpers, Events {
/**
* @dev Deposit Liquidity.
* @param tokenA tokenA address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param tokenB tokenB address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amtA tokenA amount.
* @param unitAmt unit amount of amtB/amtA with slippage.
* @param slippage slippage amount.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Deposit Liquidity to a Uniswap v2 pool.
* @param tokenA The address of token A.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param tokenB The address of token B.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param amtA The amount of A tokens to deposit.
* @param unitAmt The unit amount of of amtB/amtA with slippage.
* @param slippage Slippage amount.
* @param getId ID to retrieve amtA.
* @param setId ID stores the amount of pools tokens received.
*/
function deposit(
address tokenA,
@ -41,13 +42,14 @@ abstract contract UniswapResolver is Helpers, Events {
/**
* @dev Withdraw Liquidity.
* @param tokenA tokenA address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param tokenB tokenB address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param uniAmt uni token amount.
* @param unitAmtA unit amount of amtA/uniAmt with slippage.
* @param unitAmtB unit amount of amtB/uniAmt with slippage.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setIds Set token amounts at this IDs in `InstaMemory` Contract.
* @notice Withdraw Liquidity from a Uniswap v2 pool.
* @param tokenA The address of token A.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param tokenB The address of token B.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param uniAmt The amount of pool tokens to withdraw.
* @param unitAmtA The unit amount of amtA/uniAmt with slippage.
* @param unitAmtB The unit amount of amtB/uniAmt with slippage.
* @param getId ID to retrieve uniAmt.
* @param setIds Array of IDs to store the amount tokens received.
*/
function withdraw(
address tokenA,
@ -77,12 +79,13 @@ abstract contract UniswapResolver is Helpers, Events {
/**
* @dev Buy ETH/ERC20_Token.
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr selling token amount.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param buyAmt buying token amount.
* @param unitAmt unit amount of sellAmt/buyAmt with slippage.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Buy a token using a Uniswap v2
* @param buyAddr The address of the token to buy.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr The address of the token to sell.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param buyAmt The amount of tokens to buy.
* @param unitAmt The unit amount of sellAmt/buyAmt with slippage.
* @param getId ID to retrieve buyAmt.
* @param setId ID to store the amount of tokens sold.
*/
function buy(
address buyAddr,
@ -127,12 +130,13 @@ abstract contract UniswapResolver is Helpers, Events {
/**
* @dev Sell ETH/ERC20_Token.
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr selling token amount.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAmt selling token amount.
* @param unitAmt unit amount of buyAmt/sellAmt with slippage.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
* @notice Sell a token using a Uniswap v2
* @param buyAddr The address of the token to buy.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr The address of the token to sell.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAmt The amount of the token to sell.
* @param unitAmt The unit amount of buyAmt/sellAmt with slippage.
* @param getId ID to retrieve sellAmt.
* @param setId ID stores the amount of token brought.
*/
function sell(
address buyAddr,

View File

@ -1,5 +0,0 @@
const Migrations = artifacts.require("Migrations");
module.exports = function (deployer) {
deployer.deploy(Migrations);
};