mirror of
https://github.com/Instadapp/dsa-resolvers-deprecated.git
synced 2024-07-29 22:38:16 +00:00
Merge branch 'master' of https://github.com/InstaDApp/dsa-resolvers
This commit is contained in:
commit
d683264eae
|
@ -143,16 +143,6 @@ contract UniswapHelpers is Helpers {
|
||||||
unitAmt = wmul(unitAmt, add(WAD, slippage));
|
unitAmt = wmul(unitAmt, add(WAD, slippage));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMinAmount(
|
|
||||||
TokenInterface token,
|
|
||||||
uint amt,
|
|
||||||
uint slippage
|
|
||||||
) internal view returns(uint minAmt) {
|
|
||||||
uint _amt18 = convertTo18(token.decimals(), amt);
|
|
||||||
minAmt = wmul(_amt18, sub(WAD, slippage));
|
|
||||||
minAmt = convert18ToDec(token.decimals(), minAmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _getWithdrawUnitAmts(
|
function _getWithdrawUnitAmts(
|
||||||
TokenInterface tokenA,
|
TokenInterface tokenA,
|
||||||
TokenInterface tokenB,
|
TokenInterface tokenB,
|
||||||
|
@ -189,19 +179,19 @@ contract UniswapHelpers is Helpers {
|
||||||
contract Resolver is UniswapHelpers {
|
contract Resolver is UniswapHelpers {
|
||||||
|
|
||||||
function getBuyAmount(address buyAddr, address sellAddr, uint sellAmt, uint slippage)
|
function getBuyAmount(address buyAddr, address sellAddr, uint sellAmt, uint slippage)
|
||||||
public view returns (uint expectedRate, uint unitAmt)
|
public view returns (uint buyAmt, uint unitAmt)
|
||||||
{
|
{
|
||||||
(TokenInterface _buyAddr, TokenInterface _sellAddr) = changeEthAddress(buyAddr, sellAddr);
|
(TokenInterface _buyAddr, TokenInterface _sellAddr) = changeEthAddress(buyAddr, sellAddr);
|
||||||
expectedRate = getExpectedBuyAmt(address(_buyAddr), address(_sellAddr), sellAmt);
|
buyAmt = getExpectedBuyAmt(address(_buyAddr), address(_sellAddr), sellAmt);
|
||||||
unitAmt = getBuyUnitAmt(_buyAddr, expectedRate, _sellAddr, sellAmt, slippage);
|
unitAmt = getBuyUnitAmt(_buyAddr, buyAmt, _sellAddr, sellAmt, slippage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSellAmount(address buyAddr, address sellAddr, uint buyAmt, uint slippage)
|
function getSellAmount(address buyAddr, address sellAddr, uint buyAmt, uint slippage)
|
||||||
public view returns (uint expectedRate, uint unitAmt)
|
public view returns (uint sellAmt, uint unitAmt)
|
||||||
{
|
{
|
||||||
(TokenInterface _buyAddr, TokenInterface _sellAddr) = changeEthAddress(buyAddr, sellAddr);
|
(TokenInterface _buyAddr, TokenInterface _sellAddr) = changeEthAddress(buyAddr, sellAddr);
|
||||||
expectedRate = getExpectedSellAmt(address(_buyAddr), address(_sellAddr), buyAmt);
|
sellAmt = getExpectedSellAmt(address(_buyAddr), address(_sellAddr), buyAmt);
|
||||||
unitAmt = getSellUnitAmt(_sellAddr, expectedRate, _buyAddr, buyAmt, slippage);
|
unitAmt = getSellUnitAmt(_sellAddr, sellAmt, _buyAddr, buyAmt, slippage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDepositAmount(
|
function getDepositAmount(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user