mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
commit
bd1d510a6a
|
@ -17,6 +17,7 @@ interface TokenInterface {
|
|||
// Compound Helpers
|
||||
interface CTokenInterface {
|
||||
function mint(uint mintAmount) external returns (uint);
|
||||
function redeem(uint redeemTokens) external returns (uint);
|
||||
function borrow(uint borrowAmount) external returns (uint);
|
||||
function repayBorrow(uint repayAmount) external returns (uint);
|
||||
|
||||
|
@ -29,8 +30,6 @@ interface CTokenInterface {
|
|||
interface CETHInterface {
|
||||
function mint() external payable;
|
||||
function repayBorrow() external payable;
|
||||
// function repayBorrowBehalf(address borrower) external payable;
|
||||
// function liquidateBorrow(address borrower, address cTokenCollateral) external payable;
|
||||
}
|
||||
|
||||
interface InstaMapping {
|
||||
|
@ -40,9 +39,6 @@ interface InstaMapping {
|
|||
|
||||
interface ComptrollerInterface {
|
||||
function enterMarkets(address[] calldata cTokens) external returns (uint[] memory);
|
||||
// function exitMarket(address cTokenAddress) external returns (uint);
|
||||
// function getAssetsIn(address account) external view returns (address[] memory);
|
||||
// function getAccountLiquidity(address account) external view returns (uint, uint, uint);
|
||||
}
|
||||
// End Compound Helpers
|
||||
|
||||
|
@ -107,14 +103,6 @@ interface AaveV2Interface {
|
|||
) external;
|
||||
function repay(address _asset, uint256 _amount, uint256 _rateMode, address _onBehalfOf) external;
|
||||
function setUserUseReserveAsCollateral(address _asset, bool _useAsCollateral) external;
|
||||
function getUserAccountData(address user) external view returns (
|
||||
uint256 totalCollateralETH,
|
||||
uint256 totalDebtETH,
|
||||
uint256 availableBorrowsETH,
|
||||
uint256 currentLiquidationThreshold,
|
||||
uint256 ltv,
|
||||
uint256 healthFactor
|
||||
);
|
||||
}
|
||||
|
||||
interface AaveV2LendingPoolProviderInterface {
|
||||
|
@ -137,59 +125,6 @@ interface AaveV2DataProviderInterface {
|
|||
}
|
||||
// End Aave v2 Helpers
|
||||
|
||||
// MakerDAO Helpers
|
||||
interface ManagerLike {
|
||||
function cdpCan(address, uint, address) external view returns (uint);
|
||||
function ilks(uint) external view returns (bytes32);
|
||||
function last(address) external view returns (uint);
|
||||
function count(address) external view returns (uint);
|
||||
function owns(uint) external view returns (address);
|
||||
function urns(uint) external view returns (address);
|
||||
function vat() external view returns (address);
|
||||
function open(bytes32, address) external returns (uint);
|
||||
function give(uint, address) external;
|
||||
function frob(uint, int, int) external;
|
||||
function flux(uint, address, uint) external;
|
||||
function move(uint, address, uint) external;
|
||||
}
|
||||
|
||||
interface VatLike {
|
||||
function can(address, address) external view returns (uint);
|
||||
function ilks(bytes32) external view returns (uint, uint, uint, uint, uint);
|
||||
function dai(address) external view returns (uint);
|
||||
function urns(bytes32, address) external view returns (uint, uint);
|
||||
function frob(
|
||||
bytes32,
|
||||
address,
|
||||
address,
|
||||
address,
|
||||
int,
|
||||
int
|
||||
) external;
|
||||
function hope(address) external;
|
||||
function move(address, address, uint) external;
|
||||
function gem(bytes32, address) external view returns (uint);
|
||||
}
|
||||
|
||||
interface TokenJoinInterface {
|
||||
function dec() external returns (uint);
|
||||
function gem() external returns (TokenInterface);
|
||||
function join(address, uint) external payable;
|
||||
function exit(address, uint) external;
|
||||
}
|
||||
|
||||
interface DaiJoinInterface {
|
||||
function vat() external returns (VatLike);
|
||||
function dai() external returns (TokenInterface);
|
||||
function join(address, uint) external payable;
|
||||
function exit(address, uint) external;
|
||||
}
|
||||
|
||||
interface JugLike {
|
||||
function drip(bytes32) external returns (uint);
|
||||
}
|
||||
// End MakerDAO Helpers
|
||||
|
||||
contract DSMath {
|
||||
|
||||
uint constant WAD = 10 ** 18;
|
||||
|
@ -210,28 +145,6 @@ contract DSMath {
|
|||
function wmul(uint x, uint y) internal pure returns (uint z) {
|
||||
z = add(mul(x, y), WAD / 2) / WAD;
|
||||
}
|
||||
|
||||
function wdiv(uint x, uint y) internal pure returns (uint z) {
|
||||
z = add(mul(x, WAD), y / 2) / y;
|
||||
}
|
||||
|
||||
function toRad(uint wad) internal pure returns (uint rad) {
|
||||
rad = mul(wad, 10 ** 27);
|
||||
}
|
||||
|
||||
function toInt(uint x) internal pure returns (int y) {
|
||||
y = int(x);
|
||||
require(y >= 0, "int-overflow");
|
||||
}
|
||||
|
||||
function convertTo18(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
|
||||
amt = mul(_amt, 10 ** (18 - _dec));
|
||||
}
|
||||
|
||||
function convert18ToDec(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
|
||||
amt = (_amt / 10 ** (18 - _dec));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
contract Helpers is DSMath {
|
||||
|
@ -265,7 +178,7 @@ contract Helpers is DSMath {
|
|||
* @dev Connector Details.
|
||||
*/
|
||||
function connectorID() public pure returns(uint _type, uint _id) {
|
||||
(_type, _id) = (1, 72);
|
||||
(_type, _id) = (1, 73);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -282,34 +195,6 @@ contract Helpers is DSMath {
|
|||
return 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Return Maker MCD DAI_Join Address.
|
||||
*/
|
||||
function getMcdDaiJoin() internal pure returns (address) {
|
||||
return 0x9759A6Ac90977b93B58547b4A71c78317f391A28;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Return Maker MCD Manager Address.
|
||||
*/
|
||||
function getMcdManager() internal pure returns (address) {
|
||||
return 0x5ef30b9986345249bc32d8928B7ee64DE9435E39;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Return Maker MCD DAI Address.
|
||||
*/
|
||||
function getMcdDai() internal pure returns (address) {
|
||||
return 0x6B175474E89094C44Da98b954EedeAC495271d0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Return Maker MCD Jug Address.
|
||||
*/
|
||||
function getMcdJug() internal pure returns (address) {
|
||||
return 0x19c0976f590D67707E62397C87829d896Dc0f1F1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev get Aave Provider
|
||||
*/
|
||||
|
@ -374,90 +259,6 @@ contract Helpers is DSMath {
|
|||
(, , , , , , , , isCol) = aaveData.getUserReserveData(token, address(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Get Vault's ilk.
|
||||
*/
|
||||
function getVaultData(ManagerLike managerContract, uint vault) internal view returns (bytes32 ilk, address urn) {
|
||||
ilk = managerContract.ilks(vault);
|
||||
urn = managerContract.urns(vault);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Get Vault Debt Amount.
|
||||
*/
|
||||
function _getVaultDebt(
|
||||
address vat,
|
||||
bytes32 ilk,
|
||||
address urn
|
||||
) internal view returns (uint wad) {
|
||||
(, uint rate,,,) = VatLike(vat).ilks(ilk);
|
||||
(, uint art) = VatLike(vat).urns(ilk, urn);
|
||||
uint dai = VatLike(vat).dai(urn);
|
||||
|
||||
uint rad = sub(mul(art, rate), dai);
|
||||
wad = rad / RAY;
|
||||
|
||||
wad = mul(wad, RAY) < rad ? wad + 1 : wad;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Get Payback Amount.
|
||||
*/
|
||||
function _getWipeAmt(
|
||||
address vat,
|
||||
uint amt,
|
||||
address urn,
|
||||
bytes32 ilk
|
||||
) internal view returns (int dart)
|
||||
{
|
||||
(, uint rate,,,) = VatLike(vat).ilks(ilk);
|
||||
(, uint art) = VatLike(vat).urns(ilk, urn);
|
||||
dart = toInt(amt / rate);
|
||||
dart = uint(dart) <= art ? - dart : - toInt(art);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Convert String to bytes32.
|
||||
*/
|
||||
function stringToBytes32(string memory str) internal pure returns (bytes32 result) {
|
||||
require(bytes(str).length != 0, "string-empty");
|
||||
// solium-disable-next-line security/no-inline-assembly
|
||||
assembly {
|
||||
result := mload(add(str, 32))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Get vault ID. If `vault` is 0, get last opened vault.
|
||||
*/
|
||||
function getVault(ManagerLike managerContract, uint vault) internal view returns (uint _vault) {
|
||||
if (vault == 0) {
|
||||
require(managerContract.count(address(this)) > 0, "no-vault-opened");
|
||||
_vault = managerContract.last(address(this));
|
||||
} else {
|
||||
_vault = vault;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Get Borrow Amount [MakerDAO]
|
||||
*/
|
||||
function _getBorrowAmt(
|
||||
address vat,
|
||||
address urn,
|
||||
bytes32 ilk,
|
||||
uint amt
|
||||
) internal returns (int dart)
|
||||
{
|
||||
address jug = getMcdJug();
|
||||
uint rate = JugLike(jug).drip(ilk);
|
||||
uint dai = VatLike(vat).dai(urn);
|
||||
if (dai < mul(amt, RAY)) {
|
||||
dart = toInt(sub(mul(amt, RAY), dai) / rate);
|
||||
dart = mul(uint(dart), rate) < mul(amt, RAY) ? dart + 1 : dart;
|
||||
}
|
||||
}
|
||||
|
||||
function convertEthToWeth(bool isEth, TokenInterface token, uint amount) internal {
|
||||
if(isEth) token.deposit.value(amount)();
|
||||
}
|
||||
|
@ -469,7 +270,7 @@ contract Helpers is DSMath {
|
|||
}
|
||||
}
|
||||
|
||||
function getMaxBorrow(Protocol target, address token, uint rateMode) internal returns (uint amt) {
|
||||
function getMaxBorrow(Protocol target, address token, CTokenInterface ctoken, uint rateMode) internal returns (uint amt) {
|
||||
AaveV1Interface aaveV1 = AaveV1Interface(getAaveProvider().getLendingPool());
|
||||
AaveV2DataProviderInterface aaveData = getAaveV2DataProvider();
|
||||
|
||||
|
@ -477,11 +278,9 @@ contract Helpers is DSMath {
|
|||
(uint _amt, uint _fee) = getPaybackBalance(aaveV1, token);
|
||||
amt = _amt + _fee;
|
||||
} else if (target == Protocol.AaveV2) {
|
||||
address _token = token == getEthAddr() ? getWethAddr() : token;
|
||||
amt = getPaybackBalanceV2(aaveData, _token, rateMode);
|
||||
amt = getPaybackBalanceV2(aaveData, token, rateMode);
|
||||
} else if (target == Protocol.Compound) {
|
||||
address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token);
|
||||
amt = CTokenInterface(cToken).borrowBalanceCurrent(address(this));
|
||||
amt = ctoken.borrowBalanceCurrent(address(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -495,6 +294,11 @@ contract Helpers is DSMath {
|
|||
}
|
||||
}
|
||||
|
||||
function calculateFee(uint256 amount, uint256 fee, bool toAdd) internal pure returns(uint feeAmount, uint _amount){
|
||||
feeAmount = wmul(amount, fee);
|
||||
_amount = toAdd ? add(amount, feeAmount) : sub(amount, feeAmount);
|
||||
}
|
||||
|
||||
function getTokenInterfaces(uint length, address[] memory tokens) internal pure returns (TokenInterface[] memory) {
|
||||
TokenInterface[] memory _tokens = new TokenInterface[](length);
|
||||
for (uint i = 0; i < length; i++) {
|
||||
|
@ -551,11 +355,10 @@ contract CompoundHelpers is Helpers {
|
|||
address _token = address(token) == getWethAddr() ? getEthAddr() : address(token);
|
||||
|
||||
if (amt == uint(-1)) {
|
||||
amt = getMaxBorrow(target, _token, rateMode);
|
||||
amt = getMaxBorrow(target, address(token), ctoken, rateMode);
|
||||
}
|
||||
|
||||
uint feeAmt = wmul(amt, fee);
|
||||
uint _amt = add(amt, feeAmt);
|
||||
(uint feeAmt, uint _amt) = calculateFee(amt, fee, true);
|
||||
|
||||
require(ctoken.borrow(_amt) == 0, "borrow-failed-collateral?");
|
||||
transferFees(_token, feeAmt);
|
||||
|
@ -584,8 +387,7 @@ contract CompoundHelpers is Helpers {
|
|||
if (amt > 0) {
|
||||
address _token = address(token) == getWethAddr() ? getEthAddr() : address(token);
|
||||
|
||||
uint feeAmt = wmul(amt, fee);
|
||||
uint _amt = sub(amt, feeAmt);
|
||||
(uint feeAmt, uint _amt) = calculateFee(amt, fee, false);
|
||||
|
||||
if (_token != getEthAddr()) {
|
||||
token.approve(address(ctoken), _amt);
|
||||
|
@ -609,12 +411,17 @@ contract CompoundHelpers is Helpers {
|
|||
}
|
||||
}
|
||||
|
||||
function _compWithdrawOne(CTokenInterface ctoken, uint amt) internal returns (uint) {
|
||||
function _compWithdrawOne(CTokenInterface ctoken, TokenInterface token, uint amt) internal returns (uint) {
|
||||
if (amt > 0) {
|
||||
if (amt == uint(-1)) {
|
||||
amt = ctoken.balanceOf(address(this));
|
||||
bool isEth = address(token) == getWethAddr();
|
||||
uint initalBal = isEth ? address(this).balance : token.balanceOf(address(this));
|
||||
require(ctoken.redeem(ctoken.balanceOf(address(this))) == 0, "withdraw-failed");
|
||||
uint finalBal = isEth ? address(this).balance : token.balanceOf(address(this));
|
||||
amt = sub(finalBal, initalBal);
|
||||
} else {
|
||||
require(ctoken.redeemUnderlying(amt) == 0, "withdraw-failed");
|
||||
}
|
||||
require(ctoken.redeemUnderlying(amt) == 0, "withdraw-failed");
|
||||
}
|
||||
return amt;
|
||||
}
|
||||
|
@ -622,11 +429,12 @@ contract CompoundHelpers is Helpers {
|
|||
function _compWithdraw(
|
||||
uint length,
|
||||
CTokenInterface[] memory ctokens,
|
||||
TokenInterface[] memory tokens,
|
||||
uint[] memory amts
|
||||
) internal returns(uint[] memory) {
|
||||
uint[] memory finalAmts = new uint[](length);
|
||||
for (uint i = 0; i < length; i++) {
|
||||
finalAmts[i] = _compWithdrawOne(ctokens[i], amts[i]);
|
||||
finalAmts[i] = _compWithdrawOne(ctokens[i], tokens[i], amts[i]);
|
||||
}
|
||||
return finalAmts;
|
||||
}
|
||||
|
@ -666,16 +474,27 @@ contract AaveV1Helpers is CompoundHelpers {
|
|||
uint fee;
|
||||
Protocol target;
|
||||
TokenInterface[] tokens;
|
||||
CTokenInterface[] ctokens;
|
||||
uint[] amts;
|
||||
uint[] borrowRateModes;
|
||||
uint[] paybackRateModes;
|
||||
}
|
||||
|
||||
struct AaveV1DepositData {
|
||||
AaveV1Interface aave;
|
||||
AaveV1CoreInterface aaveCore;
|
||||
uint length;
|
||||
uint fee;
|
||||
TokenInterface[] tokens;
|
||||
uint[] amts;
|
||||
}
|
||||
|
||||
function _aaveV1BorrowOne(
|
||||
AaveV1Interface aave,
|
||||
uint fee,
|
||||
Protocol target,
|
||||
TokenInterface token,
|
||||
CTokenInterface ctoken,
|
||||
uint amt,
|
||||
uint borrowRateMode,
|
||||
uint paybackRateMode
|
||||
|
@ -685,11 +504,10 @@ contract AaveV1Helpers is CompoundHelpers {
|
|||
address _token = address(token) == getWethAddr() ? getEthAddr() : address(token);
|
||||
|
||||
if (amt == uint(-1)) {
|
||||
amt = getMaxBorrow(target, _token, paybackRateMode);
|
||||
amt = getMaxBorrow(target, address(token), ctoken, paybackRateMode);
|
||||
}
|
||||
|
||||
uint feeAmt = wmul(amt, fee);
|
||||
uint _amt = add(amt, feeAmt);
|
||||
(uint feeAmt, uint _amt) = calculateFee(amt, fee, true);
|
||||
|
||||
aave.borrow(_token, _amt, borrowRateMode, getReferralCode());
|
||||
transferFees(_token, feeAmt);
|
||||
|
@ -707,6 +525,7 @@ contract AaveV1Helpers is CompoundHelpers {
|
|||
data.fee,
|
||||
data.target,
|
||||
data.tokens[i],
|
||||
data.ctokens[i],
|
||||
data.amts[i],
|
||||
data.borrowRateModes[i],
|
||||
data.paybackRateModes[i]
|
||||
|
@ -724,8 +543,7 @@ contract AaveV1Helpers is CompoundHelpers {
|
|||
) internal {
|
||||
if (amt > 0) {
|
||||
uint ethAmt;
|
||||
uint feeAmt = wmul(amt, fee);
|
||||
uint _amt = sub(amt, feeAmt);
|
||||
(uint feeAmt, uint _amt) = calculateFee(amt, fee, false);
|
||||
|
||||
bool isEth = address(token) == getWethAddr();
|
||||
|
||||
|
@ -747,15 +565,16 @@ contract AaveV1Helpers is CompoundHelpers {
|
|||
}
|
||||
|
||||
function _aaveV1Deposit(
|
||||
AaveV1Interface aave,
|
||||
AaveV1CoreInterface aaveCore,
|
||||
uint length,
|
||||
uint fee,
|
||||
TokenInterface[] memory tokens,
|
||||
uint[] memory amts
|
||||
AaveV1DepositData memory data
|
||||
) internal {
|
||||
for (uint i = 0; i < length; i++) {
|
||||
_aaveV1DepositOne(aave, aaveCore, fee, tokens[i], amts[i]);
|
||||
for (uint i = 0; i < data.length; i++) {
|
||||
_aaveV1DepositOne(
|
||||
data.aave,
|
||||
data.aaveCore,
|
||||
data.fee,
|
||||
data.tokens[i],
|
||||
data.amts[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -768,10 +587,10 @@ contract AaveV1Helpers is CompoundHelpers {
|
|||
if (amt > 0) {
|
||||
address _token = address(token) == getWethAddr() ? getEthAddr() : address(token);
|
||||
ATokenV1Interface atoken = ATokenV1Interface(aaveCore.getReserveATokenAddress(_token));
|
||||
atoken.redeem(amt);
|
||||
if (amt == uint(-1)) {
|
||||
amt = getWithdrawBalance(aave, _token);
|
||||
}
|
||||
atoken.redeem(amt);
|
||||
}
|
||||
return amt;
|
||||
}
|
||||
|
@ -840,29 +659,47 @@ contract AaveV2Helpers is AaveV1Helpers {
|
|||
uint fee;
|
||||
Protocol target;
|
||||
TokenInterface[] tokens;
|
||||
CTokenInterface[] ctokens;
|
||||
uint[] amts;
|
||||
uint[] rateModes;
|
||||
}
|
||||
|
||||
struct AaveV2PaybackData {
|
||||
AaveV2Interface aave;
|
||||
AaveV2DataProviderInterface aaveData;
|
||||
uint length;
|
||||
TokenInterface[] tokens;
|
||||
uint[] amts;
|
||||
uint[] rateModes;
|
||||
}
|
||||
|
||||
struct AaveV2WithdrawData {
|
||||
AaveV2Interface aave;
|
||||
AaveV2DataProviderInterface aaveData;
|
||||
uint length;
|
||||
TokenInterface[] tokens;
|
||||
uint[] amts;
|
||||
}
|
||||
|
||||
function _aaveV2BorrowOne(
|
||||
AaveV2Interface aave,
|
||||
uint fee,
|
||||
Protocol target,
|
||||
TokenInterface token,
|
||||
CTokenInterface ctoken,
|
||||
uint amt,
|
||||
uint rateMode
|
||||
) internal returns (uint) {
|
||||
if (amt > 0) {
|
||||
address _token = address(token) == getWethAddr() ? getEthAddr() : address(token);
|
||||
bool isEth = address(token) == getWethAddr();
|
||||
|
||||
address _token = isEth ? getEthAddr() : address(token);
|
||||
|
||||
if (amt == uint(-1)) {
|
||||
amt = getMaxBorrow(target, _token, rateMode);
|
||||
amt = getMaxBorrow(target, _token, ctoken, rateMode);
|
||||
}
|
||||
|
||||
uint feeAmt = wmul(amt, fee);
|
||||
uint _amt = add(amt, feeAmt);
|
||||
|
||||
bool isEth = address(token) == getWethAddr();
|
||||
(uint feeAmt, uint _amt) = calculateFee(amt, fee, true);
|
||||
|
||||
aave.borrow(address(token), _amt, rateMode, getReferralCode(), address(this));
|
||||
convertWethToEth(isEth, token, amt);
|
||||
|
@ -882,6 +719,7 @@ contract AaveV2Helpers is AaveV1Helpers {
|
|||
data.fee,
|
||||
data.target,
|
||||
data.tokens[i],
|
||||
data.ctokens[i],
|
||||
data.amts[i],
|
||||
data.rateModes[i]
|
||||
);
|
||||
|
@ -897,8 +735,7 @@ contract AaveV2Helpers is AaveV1Helpers {
|
|||
uint amt
|
||||
) internal {
|
||||
if (amt > 0) {
|
||||
uint feeAmt = wmul(amt, fee);
|
||||
uint _amt = sub(amt, feeAmt);
|
||||
(uint feeAmt, uint _amt) = calculateFee(amt, fee, false);
|
||||
|
||||
bool isEth = address(token) == getWethAddr();
|
||||
address _token = isEth ? getEthAddr() : address(token);
|
||||
|
@ -948,15 +785,16 @@ contract AaveV2Helpers is AaveV1Helpers {
|
|||
}
|
||||
|
||||
function _aaveV2Withdraw(
|
||||
AaveV2Interface aave,
|
||||
AaveV2DataProviderInterface aaveData,
|
||||
uint length,
|
||||
TokenInterface[] memory tokens,
|
||||
uint[] memory amts
|
||||
AaveV2WithdrawData memory data
|
||||
) internal returns (uint[] memory) {
|
||||
uint[] memory finalAmts = new uint[](length);
|
||||
for (uint i = 0; i < length; i++) {
|
||||
finalAmts[i] = _aaveV2WithdrawOne(aave, aaveData, tokens[i], amts[i]);
|
||||
uint[] memory finalAmts = new uint[](data.length);
|
||||
for (uint i = 0; i < data.length; i++) {
|
||||
finalAmts[i] = _aaveV2WithdrawOne(
|
||||
data.aave,
|
||||
data.aaveData,
|
||||
data.tokens[i],
|
||||
data.amts[i]
|
||||
);
|
||||
}
|
||||
return finalAmts;
|
||||
}
|
||||
|
@ -982,168 +820,21 @@ contract AaveV2Helpers is AaveV1Helpers {
|
|||
}
|
||||
|
||||
function _aaveV2Payback(
|
||||
AaveV2Interface aave,
|
||||
AaveV2DataProviderInterface aaveData,
|
||||
uint length,
|
||||
TokenInterface[] memory tokens,
|
||||
uint[] memory amts,
|
||||
uint[] memory rateModes
|
||||
AaveV2PaybackData memory data
|
||||
) internal {
|
||||
for (uint i = 0; i < length; i++) {
|
||||
_aaveV2PaybackOne(aave, aaveData, tokens[i], amts[i], rateModes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contract MakerHelpers is AaveV2Helpers {
|
||||
|
||||
struct MakerData {
|
||||
uint _vault;
|
||||
address colAddr;
|
||||
address daiJoin;
|
||||
TokenJoinInterface tokenJoinContract;
|
||||
VatLike vatContract;
|
||||
TokenInterface tokenContract;
|
||||
DaiJoinInterface daiJoinContract;
|
||||
}
|
||||
|
||||
function _makerOpen(string memory colType) internal {
|
||||
bytes32 ilk = stringToBytes32(colType);
|
||||
require(InstaMapping(getMappingAddr()).gemJoinMapping(ilk) != address(0), "wrong-col-type");
|
||||
ManagerLike(getMcdManager()).open(ilk, address(this));
|
||||
}
|
||||
|
||||
function _makerDepositAndBorrow(
|
||||
uint vault,
|
||||
uint collateralAmt,
|
||||
uint debtAmt,
|
||||
uint collateralFee,
|
||||
uint debtFee
|
||||
) internal {
|
||||
uint collateralFeeAmt = wmul(collateralAmt, collateralFee);
|
||||
uint _collateralAmt = sub(collateralAmt, collateralFeeAmt);
|
||||
|
||||
uint debtFeeAmt = wmul(debtAmt, debtFee);
|
||||
uint _debtAmt = add(debtAmt, debtFeeAmt);
|
||||
|
||||
MakerData memory makerData;
|
||||
|
||||
ManagerLike managerContract = ManagerLike(getMcdManager());
|
||||
|
||||
makerData._vault = getVault(managerContract, vault);
|
||||
(bytes32 ilk, address urn) = getVaultData(managerContract, makerData._vault);
|
||||
|
||||
makerData.colAddr = InstaMapping(getMappingAddr()).gemJoinMapping(ilk);
|
||||
makerData.tokenJoinContract = TokenJoinInterface(makerData.colAddr);
|
||||
makerData.tokenContract = makerData.tokenJoinContract.gem();
|
||||
makerData.daiJoin = getMcdDaiJoin();
|
||||
makerData.vatContract = VatLike(managerContract.vat());
|
||||
|
||||
if (address(makerData.tokenContract) == getWethAddr()) {
|
||||
makerData.tokenContract.deposit.value(collateralAmt)();
|
||||
}
|
||||
|
||||
transferFees(address(makerData.tokenContract), collateralFeeAmt);
|
||||
|
||||
makerData.tokenContract.approve(address(makerData.colAddr), _collateralAmt);
|
||||
makerData.tokenJoinContract.join(urn, _collateralAmt);
|
||||
|
||||
int intAmt = toInt(convertTo18(makerData.tokenJoinContract.dec(), _collateralAmt));
|
||||
|
||||
int dart = _getBorrowAmt(address(makerData.vatContract), urn, ilk, _debtAmt);
|
||||
|
||||
managerContract.frob(
|
||||
makerData._vault,
|
||||
intAmt,
|
||||
dart
|
||||
);
|
||||
|
||||
managerContract.move(
|
||||
makerData._vault,
|
||||
address(this),
|
||||
toRad(_debtAmt)
|
||||
);
|
||||
|
||||
if (makerData.vatContract.can(address(this), address(makerData.daiJoin)) == 0) {
|
||||
makerData.vatContract.hope(makerData.daiJoin);
|
||||
}
|
||||
|
||||
DaiJoinInterface(makerData.daiJoin).exit(address(this), _debtAmt);
|
||||
|
||||
transferFees(getMcdDai(), debtFeeAmt);
|
||||
}
|
||||
|
||||
function _makerPaybackAndWithdraw(
|
||||
uint vault,
|
||||
uint withdrawAmt,
|
||||
uint paybackAmt
|
||||
) internal returns (uint, uint) {
|
||||
ManagerLike managerContract = ManagerLike(getMcdManager());
|
||||
MakerData memory makerData;
|
||||
|
||||
makerData._vault = getVault(managerContract, vault);
|
||||
(bytes32 ilk, address urn) = getVaultData(managerContract, makerData._vault);
|
||||
|
||||
makerData.colAddr = InstaMapping(getMappingAddr()).gemJoinMapping(ilk);
|
||||
makerData.tokenJoinContract = TokenJoinInterface(makerData.colAddr);
|
||||
makerData.tokenContract = makerData.tokenJoinContract.gem();
|
||||
makerData.daiJoin = getMcdDaiJoin();
|
||||
makerData.vatContract = VatLike(managerContract.vat());
|
||||
|
||||
uint _withdrawAmt18;
|
||||
if (withdrawAmt == uint(-1)) {
|
||||
(_withdrawAmt18,) = makerData.vatContract.urns(ilk, urn);
|
||||
withdrawAmt = convert18ToDec(makerData.tokenJoinContract.dec(), _withdrawAmt18);
|
||||
} else {
|
||||
_withdrawAmt18 = convertTo18(makerData.tokenJoinContract.dec(), withdrawAmt);
|
||||
}
|
||||
|
||||
int _paybackDart;
|
||||
{
|
||||
(, uint art) = makerData.vatContract.urns(ilk, urn);
|
||||
uint _maxDebt = _getVaultDebt(address(makerData.vatContract), ilk, urn);
|
||||
_paybackDart = paybackAmt == uint(-1) ?
|
||||
-int(art) :
|
||||
_getWipeAmt(
|
||||
address(makerData.vatContract),
|
||||
makerData.vatContract.dai(urn),
|
||||
urn,
|
||||
ilk
|
||||
for (uint i = 0; i < data.length; i++) {
|
||||
_aaveV2PaybackOne(
|
||||
data.aave,
|
||||
data.aaveData,
|
||||
data.tokens[i],
|
||||
data.amts[i],
|
||||
data.rateModes[i]
|
||||
);
|
||||
|
||||
paybackAmt = paybackAmt == uint(-1) ? _maxDebt : paybackAmt;
|
||||
|
||||
require(_maxDebt >= paybackAmt, "paying-excess-debt");
|
||||
}
|
||||
|
||||
makerData.daiJoinContract = DaiJoinInterface(makerData.daiJoin);
|
||||
makerData.daiJoinContract.dai().approve(makerData.daiJoin, paybackAmt);
|
||||
makerData.daiJoinContract.join(urn, paybackAmt);
|
||||
|
||||
managerContract.frob(
|
||||
makerData._vault,
|
||||
-toInt(_withdrawAmt18),
|
||||
_paybackDart
|
||||
);
|
||||
|
||||
managerContract.flux(
|
||||
makerData._vault,
|
||||
address(this),
|
||||
_withdrawAmt18
|
||||
);
|
||||
|
||||
if (address(makerData.tokenContract) == getWethAddr()) {
|
||||
makerData.tokenJoinContract.exit(address(this), _withdrawAmt18);
|
||||
makerData.tokenContract.withdraw(_withdrawAmt18);
|
||||
} else {
|
||||
makerData.tokenJoinContract.exit(address(this), _withdrawAmt18);
|
||||
}
|
||||
|
||||
return (withdrawAmt, paybackAmt);
|
||||
}
|
||||
}
|
||||
|
||||
contract RefinanceResolver is MakerHelpers {
|
||||
contract RefinanceResolver is AaveV2Helpers {
|
||||
|
||||
struct RefinanceData {
|
||||
Protocol source;
|
||||
|
@ -1157,22 +848,6 @@ contract RefinanceResolver is MakerHelpers {
|
|||
uint[] paybackRateModes;
|
||||
}
|
||||
|
||||
struct RefinanceMakerData {
|
||||
uint fromVaultId;
|
||||
uint toVaultId;
|
||||
Protocol source;
|
||||
Protocol target;
|
||||
uint collateralFee;
|
||||
uint debtFee;
|
||||
bool isFrom;
|
||||
string colType;
|
||||
address token;
|
||||
uint debt;
|
||||
uint collateral;
|
||||
uint borrowRateMode;
|
||||
uint paybackRateMode;
|
||||
}
|
||||
|
||||
function refinance(RefinanceData calldata data) external payable {
|
||||
|
||||
require(data.source != data.target, "source-and-target-unequal");
|
||||
|
@ -1193,6 +868,7 @@ contract RefinanceResolver is MakerHelpers {
|
|||
uint[] memory paybackAmts;
|
||||
|
||||
TokenInterface[] memory tokens = getTokenInterfaces(length, data.tokens);
|
||||
CTokenInterface[] memory _ctokens = getCtokenInterfaces(length, data.tokens);
|
||||
|
||||
if (data.source == Protocol.Aave && data.target == Protocol.AaveV2) {
|
||||
AaveV2BorrowData memory _aaveV2BorrowData;
|
||||
|
@ -1200,8 +876,9 @@ contract RefinanceResolver is MakerHelpers {
|
|||
_aaveV2BorrowData.aave = aaveV2;
|
||||
_aaveV2BorrowData.length = length;
|
||||
_aaveV2BorrowData.fee = data.debtFee;
|
||||
_aaveV2BorrowData.target = data.target;
|
||||
_aaveV2BorrowData.target = data.source;
|
||||
_aaveV2BorrowData.tokens = tokens;
|
||||
_aaveV2BorrowData.ctokens = _ctokens;
|
||||
_aaveV2BorrowData.amts = data.borrowAmts;
|
||||
_aaveV2BorrowData.rateModes = data.borrowRateModes;
|
||||
|
||||
|
@ -1210,14 +887,13 @@ contract RefinanceResolver is MakerHelpers {
|
|||
depositAmts = _aaveV1Withdraw(aaveV1, aaveCore, length, tokens, data.withdrawAmts);
|
||||
_aaveV2Deposit(aaveV2, aaveData, length, data.collateralFee, tokens, depositAmts);
|
||||
} else if (data.source == Protocol.Aave && data.target == Protocol.Compound) {
|
||||
CTokenInterface[] memory _ctokens = getCtokenInterfaces(length, data.tokens);
|
||||
_compEnterMarkets(length, _ctokens);
|
||||
|
||||
CompoundBorrowData memory _compoundBorrowData;
|
||||
|
||||
_compoundBorrowData.length = length;
|
||||
_compoundBorrowData.fee = data.debtFee;
|
||||
_compoundBorrowData.target = data.target;
|
||||
_compoundBorrowData.target = data.source;
|
||||
_compoundBorrowData.ctokens = _ctokens;
|
||||
_compoundBorrowData.tokens = tokens;
|
||||
_compoundBorrowData.amts = data.borrowAmts;
|
||||
|
@ -1231,22 +907,54 @@ contract RefinanceResolver is MakerHelpers {
|
|||
} else if (data.source == Protocol.AaveV2 && data.target == Protocol.Aave) {
|
||||
|
||||
AaveV1BorrowData memory _aaveV1BorrowData;
|
||||
AaveV2PaybackData memory _aaveV2PaybackData;
|
||||
AaveV2WithdrawData memory _aaveV2WithdrawData;
|
||||
|
||||
_aaveV1BorrowData.aave = aaveV1;
|
||||
_aaveV1BorrowData.length = length;
|
||||
_aaveV1BorrowData.fee = data.debtFee;
|
||||
_aaveV1BorrowData.target = data.target;
|
||||
_aaveV1BorrowData.tokens = tokens;
|
||||
_aaveV1BorrowData.amts = data.borrowAmts;
|
||||
_aaveV1BorrowData.borrowRateModes = data.borrowRateModes;
|
||||
_aaveV1BorrowData.paybackRateModes = data.paybackRateModes;
|
||||
{
|
||||
_aaveV1BorrowData.aave = aaveV1;
|
||||
_aaveV1BorrowData.length = length;
|
||||
_aaveV1BorrowData.fee = data.debtFee;
|
||||
_aaveV1BorrowData.target = data.source;
|
||||
_aaveV1BorrowData.tokens = tokens;
|
||||
_aaveV1BorrowData.ctokens = _ctokens;
|
||||
_aaveV1BorrowData.amts = data.borrowAmts;
|
||||
_aaveV1BorrowData.borrowRateModes = data.borrowRateModes;
|
||||
_aaveV1BorrowData.paybackRateModes = data.paybackRateModes;
|
||||
|
||||
paybackAmts = _aaveV1Borrow(_aaveV1BorrowData);
|
||||
_aaveV2Payback(aaveV2, aaveData, length, tokens, paybackAmts, data.paybackRateModes);
|
||||
depositAmts = _aaveV2Withdraw(aaveV2, aaveData, length, tokens, data.withdrawAmts);
|
||||
_aaveV1Deposit(aaveV1, aaveCore, length, data.collateralFee, tokens, depositAmts);
|
||||
paybackAmts = _aaveV1Borrow(_aaveV1BorrowData);
|
||||
}
|
||||
|
||||
{
|
||||
_aaveV2PaybackData.aave = aaveV2;
|
||||
_aaveV2PaybackData.aaveData = aaveData;
|
||||
_aaveV2PaybackData.length = length;
|
||||
_aaveV2PaybackData.tokens = tokens;
|
||||
_aaveV2PaybackData.amts = paybackAmts;
|
||||
_aaveV2PaybackData.rateModes = data.paybackRateModes;
|
||||
_aaveV2Payback(_aaveV2PaybackData);
|
||||
}
|
||||
|
||||
{
|
||||
_aaveV2WithdrawData.aave = aaveV2;
|
||||
_aaveV2WithdrawData.aaveData = aaveData;
|
||||
_aaveV2WithdrawData.length = length;
|
||||
_aaveV2WithdrawData.tokens = tokens;
|
||||
_aaveV2WithdrawData.amts = data.withdrawAmts;
|
||||
depositAmts = _aaveV2Withdraw(_aaveV2WithdrawData);
|
||||
}
|
||||
{
|
||||
AaveV1DepositData memory _aaveV1DepositData;
|
||||
|
||||
_aaveV1DepositData.aave = aaveV1;
|
||||
_aaveV1DepositData.aaveCore = aaveCore;
|
||||
_aaveV1DepositData.length = length;
|
||||
_aaveV1DepositData.fee = data.collateralFee;
|
||||
_aaveV1DepositData.tokens = tokens;
|
||||
_aaveV1DepositData.amts = depositAmts;
|
||||
|
||||
_aaveV1Deposit(_aaveV1DepositData);
|
||||
}
|
||||
} else if (data.source == Protocol.AaveV2 && data.target == Protocol.Compound) {
|
||||
CTokenInterface[] memory _ctokens = getCtokenInterfaces(length, data.tokens);
|
||||
_compEnterMarkets(length, _ctokens);
|
||||
|
||||
{
|
||||
|
@ -1254,7 +962,7 @@ contract RefinanceResolver is MakerHelpers {
|
|||
|
||||
_compoundBorrowData.length = length;
|
||||
_compoundBorrowData.fee = data.debtFee;
|
||||
_compoundBorrowData.target = data.target;
|
||||
_compoundBorrowData.target = data.source;
|
||||
_compoundBorrowData.ctokens = _ctokens;
|
||||
_compoundBorrowData.tokens = tokens;
|
||||
_compoundBorrowData.amts = data.borrowAmts;
|
||||
|
@ -1262,9 +970,28 @@ contract RefinanceResolver is MakerHelpers {
|
|||
|
||||
paybackAmts = _compBorrow(_compoundBorrowData);
|
||||
}
|
||||
|
||||
AaveV2PaybackData memory _aaveV2PaybackData;
|
||||
|
||||
_aaveV2PaybackData.aave = aaveV2;
|
||||
_aaveV2PaybackData.aaveData = aaveData;
|
||||
_aaveV2PaybackData.length = length;
|
||||
_aaveV2PaybackData.tokens = tokens;
|
||||
_aaveV2PaybackData.amts = paybackAmts;
|
||||
_aaveV2PaybackData.rateModes = data.paybackRateModes;
|
||||
|
||||
_aaveV2Payback(aaveV2, aaveData, length, tokens, paybackAmts, data.paybackRateModes);
|
||||
depositAmts = _aaveV2Withdraw(aaveV2, aaveData, length, tokens, data.withdrawAmts);
|
||||
_aaveV2Payback(_aaveV2PaybackData);
|
||||
|
||||
{
|
||||
AaveV2WithdrawData memory _aaveV2WithdrawData;
|
||||
|
||||
_aaveV2WithdrawData.aave = aaveV2;
|
||||
_aaveV2WithdrawData.aaveData = aaveData;
|
||||
_aaveV2WithdrawData.length = length;
|
||||
_aaveV2WithdrawData.tokens = tokens;
|
||||
_aaveV2WithdrawData.amts = data.withdrawAmts;
|
||||
depositAmts = _aaveV2Withdraw(_aaveV2WithdrawData);
|
||||
}
|
||||
_compDeposit(length, data.collateralFee, _ctokens, tokens, depositAmts);
|
||||
} else if (data.source == Protocol.Compound && data.target == Protocol.Aave) {
|
||||
|
||||
|
@ -1273,108 +1000,51 @@ contract RefinanceResolver is MakerHelpers {
|
|||
_aaveV1BorrowData.aave = aaveV1;
|
||||
_aaveV1BorrowData.length = length;
|
||||
_aaveV1BorrowData.fee = data.debtFee;
|
||||
_aaveV1BorrowData.target = data.target;
|
||||
_aaveV1BorrowData.target = data.source;
|
||||
_aaveV1BorrowData.tokens = tokens;
|
||||
_aaveV1BorrowData.ctokens = _ctokens;
|
||||
_aaveV1BorrowData.amts = data.borrowAmts;
|
||||
_aaveV1BorrowData.borrowRateModes = data.borrowRateModes;
|
||||
_aaveV1BorrowData.paybackRateModes = data.paybackRateModes;
|
||||
|
||||
paybackAmts = _aaveV1Borrow(_aaveV1BorrowData);
|
||||
{
|
||||
CTokenInterface[] memory _ctokens = getCtokenInterfaces(length, data.tokens);
|
||||
_compPayback(length, _ctokens, tokens, paybackAmts);
|
||||
depositAmts = _compWithdraw(length, _ctokens, data.withdrawAmts);
|
||||
depositAmts = _compWithdraw(length, _ctokens, tokens, data.withdrawAmts);
|
||||
}
|
||||
_aaveV1Deposit(aaveV1, aaveCore, length, data.collateralFee, tokens, depositAmts);
|
||||
} else if (data.source == Protocol.Compound && data.target == Protocol.AaveV2) {
|
||||
CTokenInterface[] memory _ctokens = getCtokenInterfaces(length, data.tokens);
|
||||
|
||||
{
|
||||
AaveV1DepositData memory _aaveV1DepositData;
|
||||
|
||||
_aaveV1DepositData.aave = aaveV1;
|
||||
_aaveV1DepositData.aaveCore = aaveCore;
|
||||
_aaveV1DepositData.length = length;
|
||||
_aaveV1DepositData.fee = data.collateralFee;
|
||||
_aaveV1DepositData.tokens = tokens;
|
||||
_aaveV1DepositData.amts = depositAmts;
|
||||
|
||||
_aaveV1Deposit(_aaveV1DepositData);
|
||||
}
|
||||
} else if (data.source == Protocol.Compound && data.target == Protocol.AaveV2) {
|
||||
AaveV2BorrowData memory _aaveV2BorrowData;
|
||||
|
||||
_aaveV2BorrowData.aave = aaveV2;
|
||||
_aaveV2BorrowData.length = length;
|
||||
_aaveV2BorrowData.fee = data.debtFee;
|
||||
_aaveV2BorrowData.target = data.target;
|
||||
_aaveV2BorrowData.target = data.source;
|
||||
_aaveV2BorrowData.tokens = tokens;
|
||||
_aaveV2BorrowData.ctokens = _ctokens;
|
||||
_aaveV2BorrowData.amts = data.borrowAmts;
|
||||
_aaveV2BorrowData.rateModes = data.borrowRateModes;
|
||||
|
||||
paybackAmts = _aaveV2Borrow(_aaveV2BorrowData);
|
||||
_compPayback(length, _ctokens, tokens, paybackAmts);
|
||||
depositAmts = _compWithdraw(length, _ctokens, data.withdrawAmts);
|
||||
depositAmts = _compWithdraw(length, _ctokens, tokens, data.withdrawAmts);
|
||||
_aaveV2Deposit(aaveV2, aaveData, length, data.collateralFee, tokens, depositAmts);
|
||||
} else {
|
||||
revert("invalid-options");
|
||||
}
|
||||
}
|
||||
|
||||
function refinanceMaker(RefinanceMakerData calldata data) external payable {
|
||||
|
||||
AaveV2Interface aaveV2 = AaveV2Interface(getAaveV2Provider().getLendingPool());
|
||||
AaveV1Interface aaveV1 = AaveV1Interface(getAaveProvider().getLendingPool());
|
||||
AaveV1CoreInterface aaveCore = AaveV1CoreInterface(getAaveProvider().getLendingPoolCore());
|
||||
AaveV2DataProviderInterface aaveData = getAaveV2DataProvider();
|
||||
|
||||
TokenInterface dai = TokenInterface(getMcdDai());
|
||||
TokenInterface token = TokenInterface(data.token == getEthAddr() ? getWethAddr() : data.token);
|
||||
|
||||
uint depositAmt;
|
||||
uint borrowAmt;
|
||||
|
||||
if (data.isFrom) {
|
||||
(depositAmt, borrowAmt) = _makerPaybackAndWithdraw(
|
||||
data.fromVaultId,
|
||||
data.collateral,
|
||||
data.debt
|
||||
);
|
||||
|
||||
if (data.target == Protocol.Aave) {
|
||||
_aaveV1DepositOne(aaveV1, aaveCore, data.collateralFee, token, depositAmt);
|
||||
_aaveV1BorrowOne(aaveV1, data.debtFee, Protocol.AaveV2, dai, borrowAmt, data.borrowRateMode, 2);
|
||||
} else if (data.target == Protocol.AaveV2) {
|
||||
_aaveV2DepositOne(aaveV2, aaveData, data.collateralFee, token, depositAmt);
|
||||
_aaveV2BorrowOne(aaveV2, data.debtFee, Protocol.AaveV2, dai, borrowAmt, data.borrowRateMode);
|
||||
} else if (data.target == Protocol.Compound) {
|
||||
address[] memory tokens = new address[](2);
|
||||
tokens[0] = address(dai);
|
||||
tokens[1] = data.token;
|
||||
|
||||
CTokenInterface[] memory _ctokens = getCtokenInterfaces(2, tokens);
|
||||
|
||||
_compEnterMarkets(2, _ctokens);
|
||||
|
||||
_compDepositOne(data.collateralFee, _ctokens[1], token, depositAmt);
|
||||
_compBorrowOne(data.debtFee, _ctokens[0], dai, borrowAmt, Protocol.Aave, 2);
|
||||
} else {
|
||||
revert("invalid-option");
|
||||
}
|
||||
} else {
|
||||
if (data.toVaultId == 0) {
|
||||
_makerOpen(data.colType);
|
||||
}
|
||||
|
||||
if (data.source == Protocol.Aave) {
|
||||
borrowAmt = _aaveV1PaybackOne(aaveV1, aaveCore, dai, data.debt);
|
||||
depositAmt = _aaveV1WithdrawOne(aaveV1, aaveCore, token, data.collateral);
|
||||
} else if (data.source == Protocol.AaveV2) {
|
||||
borrowAmt = _aaveV2PaybackOne(aaveV2, aaveData, dai, data.debt, data.paybackRateMode);
|
||||
depositAmt = _aaveV2WithdrawOne(aaveV2, aaveData, token, data.collateral);
|
||||
} else if (data.source == Protocol.Compound) {
|
||||
address _cDai = InstaMapping(getMappingAddr()).cTokenMapping(address(dai));
|
||||
address _cToken = InstaMapping(getMappingAddr()).cTokenMapping(data.token);
|
||||
|
||||
CTokenInterface cDai = CTokenInterface(_cDai);
|
||||
CTokenInterface cToken = CTokenInterface(_cToken);
|
||||
|
||||
borrowAmt = _compPaybackOne(cDai, dai, data.debt);
|
||||
depositAmt = _compWithdrawOne(cToken, data.collateral);
|
||||
} else {
|
||||
revert("invalid-option");
|
||||
}
|
||||
|
||||
_makerDepositAndBorrow(data.toVaultId, depositAmt, borrowAmt, data.collateralFee, data.debtFee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectRefinance is RefinanceResolver {
|
||||
|
|
Loading…
Reference in New Issue
Block a user