mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
cleanup
This commit is contained in:
parent
ba74a38a84
commit
34f4f10288
|
@ -2,18 +2,6 @@ pragma solidity >=0.7.0;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
contract Events {
|
contract Events {
|
||||||
event LogDeposit(
|
|
||||||
address owner,
|
|
||||||
address[] tokens,
|
|
||||||
uint[] amts
|
|
||||||
);
|
|
||||||
|
|
||||||
event LogWithdraw(
|
|
||||||
address owner,
|
|
||||||
address[] tokens,
|
|
||||||
uint[] amts
|
|
||||||
);
|
|
||||||
|
|
||||||
event LogUpdateSafeRatioGap(
|
event LogUpdateSafeRatioGap(
|
||||||
uint256 oldSafeRatioGap,
|
uint256 oldSafeRatioGap,
|
||||||
uint256 newSafeRatioGap
|
uint256 newSafeRatioGap
|
||||||
|
|
|
@ -68,9 +68,9 @@ abstract contract Helpers is Stores, DSMath, Variables {
|
||||||
|
|
||||||
if (data.atokenBal < data.supplyAmt) {
|
if (data.atokenBal < data.supplyAmt) {
|
||||||
uint _reqAmt = data.supplyAmt - data.atokenBal;
|
uint _reqAmt = data.supplyAmt - data.atokenBal;
|
||||||
uint num = _reqAmt/data.tokenLiq + 1; // TODO: Is this right
|
uint num = _reqAmt/data.tokenLiq + 1;
|
||||||
uint splitAmt = _reqAmt/num; // TODO: Check decimal
|
uint splitAmt = _reqAmt/num;
|
||||||
uint finalSplit = _reqAmt - (splitAmt * (num - 1)); // TODO: to resolve upper decimal error
|
uint finalSplit = _reqAmt - (splitAmt * (num - 1));
|
||||||
|
|
||||||
_tokenContract.approve(address(aave), _reqAmt);
|
_tokenContract.approve(address(aave), _reqAmt);
|
||||||
for (uint j = 0; j < num; j++) {
|
for (uint j = 0; j < num; j++) {
|
||||||
|
@ -97,10 +97,9 @@ abstract contract Helpers is Stores, DSMath, Variables {
|
||||||
(data.tokenLiq,,,,,,,,,) = aaveData.getReserveData(data.token);
|
(data.tokenLiq,,,,,,,,,) = aaveData.getReserveData(data.token);
|
||||||
data.borrowAmt = borrowAmts[i];
|
data.borrowAmt = borrowAmts[i];
|
||||||
|
|
||||||
// TODO: Check number of loops needed. Borrow and supply on user's account.
|
uint num = data.borrowAmt/data.tokenLiq + 1;
|
||||||
uint num = data.borrowAmt/data.tokenLiq + 1; // TODO: Is this right
|
uint splitAmt = data.borrowAmt/num;
|
||||||
uint splitAmt = data.borrowAmt/num; // TODO: Check decimal
|
uint finalSplit = data.borrowAmt - (splitAmt * (num - 1));
|
||||||
uint finalSplit = data.borrowAmt - (splitAmt * (num - 1)); // TODO: to resolve upper decimal error
|
|
||||||
|
|
||||||
uint spellsAmt = num <= 1 ? (2 * (num + 1)) : (2 * (num + 1)) + 1;
|
uint spellsAmt = num <= 1 ? (2 * (num + 1)) : (2 * (num + 1)) + 1;
|
||||||
string[] memory targets = new string[](spellsAmt);
|
string[] memory targets = new string[](spellsAmt);
|
||||||
|
|
|
@ -2,18 +2,6 @@ pragma solidity >=0.7.0;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
contract Events {
|
contract Events {
|
||||||
event LogDeposit(
|
|
||||||
address owner,
|
|
||||||
address[] tokens,
|
|
||||||
uint256[] amts
|
|
||||||
);
|
|
||||||
|
|
||||||
event LogWithdraw(
|
|
||||||
address owner,
|
|
||||||
address[] tokens,
|
|
||||||
uint256[] amts
|
|
||||||
);
|
|
||||||
|
|
||||||
event LogSettle(
|
event LogSettle(
|
||||||
address[] tokens,
|
address[] tokens,
|
||||||
uint256[] amts
|
uint256[] amts
|
||||||
|
|
|
@ -144,10 +144,9 @@ abstract contract Helpers is DSMath, Stores, Variables {
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertTo18(uint amount, uint decimal) internal pure returns (uint) {
|
function convertTo18(uint amount, uint decimal) internal pure returns (uint) {
|
||||||
return amount * (10 ** (18 - decimal)); // TODO: verify this
|
return amount * (10 ** (18 - decimal));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: need to verify this throughly
|
|
||||||
/*
|
/*
|
||||||
* Checks the position to migrate should have a safe gap from liquidation
|
* Checks the position to migrate should have a safe gap from liquidation
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -88,14 +88,12 @@ contract Variables {
|
||||||
/**
|
/**
|
||||||
* @dev This will be used to have debt/collateral ratio always 20% less than liquidation
|
* @dev This will be used to have debt/collateral ratio always 20% less than liquidation
|
||||||
*/
|
*/
|
||||||
// TODO @KaymasJain: Is this number correct for it?
|
uint public safeRatioGap = 800000000000000000; // 20%
|
||||||
uint public safeRatioGap = 800000000000000000; // 20%?
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev fee on collateral
|
* @dev fee on collateral
|
||||||
*/
|
*/
|
||||||
// TODO @KaymasJain: Is this number correct for it?
|
uint public fee = 998000000000000000; // 0.2% (99.8%) on collateral
|
||||||
uint public fee = 998000000000000000; // 0.2% (99.8%) on collateral? TODO: Is this right?
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Mapping of supported token
|
* @dev Mapping of supported token
|
||||||
|
|
Loading…
Reference in New Issue
Block a user