You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the docs, we are instructed to implement the following function in our contract:
function swapEtherToTokenWithChange (KyberNetworkProxyInterface _kyberNetworkProxy, ERC20 token, address destAddress, uint maxDestQty, uint minRate) public payable{
//note that this.balance has increased by msg.value before the execution of this function
uint startEthBalance = this.balance;
//send swapped tokens to dest address. change will be sent to this contract.
_kyberNetworkProxy.trade.value(msg.value)(ETH_TOKEN_ADDRESS, msg.value, token, destAddress, maxDestQty, minRate, 0);
//calculate contract starting ETH balance before receiving msg.value (startEthBalance - msg.value)
//change = current balance after trade - starting ETH contract balance (this.balance - (startEthBalance - msg.value))
uint change = this.balance - (startEthBalance - msg.value);
SwapEtherChange(startEthBalance, this.balance, change);
//return change to get_sender()
get_sender().transfer(change); //get_sender()
}
However, this gives a compile error : TypeError: Member "trade" not found or not visible after argument-dependent lookup in contract KyberNetworkProxyInterface
Indeed, when the KyberNetworkProxyInterface.sol contract is inspected, it does not have a trade() method, only a tradeWithHint() method.
Changing KyberNetworkProxyInterface to KyberNetworkProxy in ...swapEtherToTokenWithChange (KyberNetworkProxyInterface _kyberNetworkProxy,... does not result in a type error.
The text was updated successfully, but these errors were encountered:
From the docs, we are instructed to implement the following function in our contract:
However, this gives a compile error :
TypeError: Member "trade" not found or not visible after argument-dependent lookup in contract KyberNetworkProxyInterface
Indeed, when the KyberNetworkProxyInterface.sol contract is inspected, it does not have a trade() method, only a tradeWithHint() method.
Changing KyberNetworkProxyInterface to KyberNetworkProxy in
...swapEtherToTokenWithChange (KyberNetworkProxyInterface _kyberNetworkProxy,...
does not result in a type error.The text was updated successfully, but these errors were encountered: