mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
Merge pull request #2 from Sowmayjain/InstaKyber-changes
few changes for better code structure and one error
This commit is contained in:
commit
afba9e63f8
|
@ -104,8 +104,8 @@ contract Helper {
|
||||||
uint slippageRate
|
uint slippageRate
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
(expectedRate, slippageRate) = KyberInterface(getAddressKyber()).getExpectedRate(src, dest, srcAmt);
|
(expectedRate,) = KyberInterface(getAddressKyber()).getExpectedRate(src, dest, srcAmt);
|
||||||
slippageRate = (slippageRate / 97) * 99; // changing slippage rate upto 99%
|
slippageRate = (expectedRate / 100) * 99; // changing slippage rate upto 99%
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -181,7 +181,8 @@ contract Swap is Helper {
|
||||||
|
|
||||||
(uint ethBal, uint tknBal) = getBal(src);
|
(uint ethBal, uint tknBal) = getBal(src);
|
||||||
|
|
||||||
destAmt = KyberInterface(getAddressKyber()).trade.value(ethQty)(
|
KyberInterface swapCall = KyberInterface(getAddressKyber());
|
||||||
|
destAmt = swapCall.trade.value(ethQty)(
|
||||||
src,
|
src,
|
||||||
srcAmt,
|
srcAmt,
|
||||||
dest,
|
dest,
|
||||||
|
@ -224,11 +225,11 @@ contract Swap is Helper {
|
||||||
function sell(
|
function sell(
|
||||||
address src,
|
address src,
|
||||||
address dest,
|
address dest,
|
||||||
uint srcAmt
|
uint srcAmt,
|
||||||
|
uint minDestAmt
|
||||||
) public payable returns (uint destAmt)
|
) public payable returns (uint destAmt)
|
||||||
{
|
{
|
||||||
uint ethQty = getToken(msg.sender, src, srcAmt);
|
uint ethQty = getToken(msg.sender, src, srcAmt);
|
||||||
(, uint slippageRate) = getExpectedRate(src, dest, srcAmt);
|
|
||||||
|
|
||||||
KyberInterface swapCall = KyberInterface(getAddressKyber());
|
KyberInterface swapCall = KyberInterface(getAddressKyber());
|
||||||
destAmt = swapCall.trade.value(ethQty)(
|
destAmt = swapCall.trade.value(ethQty)(
|
||||||
|
@ -237,7 +238,7 @@ contract Swap is Helper {
|
||||||
dest,
|
dest,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
2**255,
|
2**255,
|
||||||
slippageRate,
|
minDestAmt,
|
||||||
getAddressAdmin()
|
getAddressAdmin()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -248,7 +249,7 @@ contract Swap is Helper {
|
||||||
dest,
|
dest,
|
||||||
destAmt,
|
destAmt,
|
||||||
msg.sender,
|
msg.sender,
|
||||||
slippageRate,
|
minDestAmt,
|
||||||
getAddressAdmin()
|
getAddressAdmin()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user