Open djarbz opened 3 years ago
@djarbz did you ever figure this out? @gwmccubbin can you help?
Same here! Any hints?
I haven't found a solution yet.
I too am having the same issue. I find it very strange that the issue is specific to token and exchange combinations. If it were all the swaps on kyber I would think it to be a problem with the API or addresses for Kyber. If the tokens didn't work on both exchanges, I'd say the issue would lie in the token addresses. But strangely it's a mix of the two and I am still racking my brain for a solution.
Got it to work. Just had to update the Factory Address and the ABI.
Look for KyberNetworkProxy address
and I used the KyberNetworkProxy (V1)
ABI
Check out the documentation for Kyber Network Address and ABI
@Genoux thanks man, that did it for me. (I went with the new KyberNetworkProxy, worked with some very light modifications, I did submit PR #13 for that)
Thanks @mohamedalichelbi -- you made it so easy.
Whic ABI did you use I am getting errors when I use it
specifically this error
Error: Please pass numbers as strings or BN objects to avoid precision errors.
Got it to work. Just had to update the Factory Address and the ABI. Look for
KyberNetworkProxy address
and I used theKyberNetworkProxy (V1)
ABICheck out the documentation for Kyber Network Address and ABI
@Genoux In which file did you change the factory address and the ABI? I can't find it in index.js
Got it to work. Just had to update the Factory Address and the ABI. Look for
KyberNetworkProxy address
and I used theKyberNetworkProxy (V1)
ABI Check out the documentation for Kyber Network Address and ABI@Genoux In which file did you change the factory address and the ABI? I can't find it in index.js
It's in index.js
look for KYBER_RATE_ADDRESS
and KYBER_RATE_ABI
Have a look at mohamedalichelbi PR
Thanks for the info.
I already changed all changes made by @mohanedalichelbi_PR, but now I am getting the error: expected 4, received 3.This is, as far as I can tell, because of line 40, where he deleted true in the methods call. Any suggestion what to do there?
let kyberResult = await kyberRateContract.methods.getExpectedRate( inputTokenAddress, outputTokenAddress, inputAmount).call()
On Sun, Mar 21, 2021 at 10:02 PM John Barry @.***> wrote:
Got it to work. Just had to update the Factory Address and the ABI. Look for KyberNetworkProxy address and I used the KyberNetworkProxy (V1) ABI Check out the documentation for Kyber Network Address https://developer.kyber.network/docs/Addresses-Intro/ and ABI https://developer.kyber.network/docs/API_ABI-ABI/
@Genoux https://github.com/Genoux In which file did you change the factory address and the ABI? I can't find it in index.js
It's in index.js look for KYBER_RATE_ADDRESS and KYBER_RATE_ABI Have a look at mohamedalichelbi PR https://github.com/mohamedalichelbi/price-bot/commit/9e6053a3930bc229e7a87bde5a14bb38ee71d006
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dappuniversity/price-bot/issues/12#issuecomment-803659420, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATKZ73OJMRY7IKG6OKGOB4TTEZNIBANCNFSM4UKRRHCA .
//https://developer.kyber.network/docs/API_ABI-ABI/ const KEYBER_NETWORK_PROXY_ABI = [{ "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, { "indexed": false, "internalType": "contract IERC20", "name": "src", "type": "address" }, { "indexed": false, "internalType": "contract IERC20", "name": "dest", "type": "address" }, { "indexed": false, "internalType": "address", "name": "destAddress", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "actualSrcAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "actualDestAmount", "type": "uint256" }, { "indexed": false, "internalType": "address", "name": "platformWallet", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "platformFeeBps", "type": "uint256" }], "name": "ExecuteTrade", "type": "event" }, { "inputs": [{ "internalType": "contract ERC20", "name": "src", "type": "address" }, { "internalType": "contract ERC20", "name": "dest", "type": "address" }, { "internalType": "uint256", "name": "srcQty", "type": "uint256" }], "name": "getExpectedRate", "outputs": [{ "internalType": "uint256", "name": "expectedRate", "type": "uint256" }, { "internalType": "uint256", "name": "worstRate", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "contract IERC20", "name": "src", "type": "address" }, { "internalType": "contract IERC20", "name": "dest", "type": "address" }, { "internalType": "uint256", "name": "srcQty", "type": "uint256" }, { "internalType": "uint256", "name": "platformFeeBps", "type": "uint256" }, { "internalType": "bytes", "name": "hint", "type": "bytes" }], "name": "getExpectedRateAfterFee", "outputs": [{ "internalType": "uint256", "name": "expectedRate", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "contract IERC20", "name": "src", "type": "address" }, { "internalType": "uint256", "name": "srcAmount", "type": "uint256" }, { "internalType": "contract IERC20", "name": "dest", "type": "address" }, { "internalType": "address payable", "name": "destAddress", "type": "address" }, { "internalType": "uint256", "name": "maxDestAmount", "type": "uint256" }, { "internalType": "uint256", "name": "minConversionRate", "type": "uint256" }, { "internalType": "address payable", "name": "platformWallet", "type": "address" }], "name": "trade", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "contract ERC20", "name": "src", "type": "address" }, { "internalType": "uint256", "name": "srcAmount", "type": "uint256" }, { "internalType": "contract ERC20", "name": "dest", "type": "address" }, { "internalType": "address payable", "name": "destAddress", "type": "address" }, { "internalType": "uint256", "name": "maxDestAmount", "type": "uint256" }, { "internalType": "uint256", "name": "minConversionRate", "type": "uint256" }, { "internalType": "address payable", "name": "walletId", "type": "address" }, { "internalType": "bytes", "name": "hint", "type": "bytes" }], "name": "tradeWithHint", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "contract IERC20", "name": "src", "type": "address" }, { "internalType": "uint256", "name": "srcAmount", "type": "uint256" }, { "internalType": "contract IERC20", "name": "dest", "type": "address" }, { "internalType": "address payable", "name": "destAddress", "type": "address" }, { "internalType": "uint256", "name": "maxDestAmount", "type": "uint256" }, { "internalType": "uint256", "name": "minConversionRate", "type": "uint256" }, { "internalType": "address payable", "name": "platformWallet", "type": "address" }, { "internalType": "uint256", "name": "platformFeeBps", "type": "uint256" }, { "internalType": "bytes", "name": "hint", "type": "bytes" }], "name": "tradeWithHintAndFee", "outputs": [{ "internalType": "uint256", "name": "destAmount", "type": "uint256" }], "stateMutability": "payable", "type": "function" }] //https://developer.kyber.network/docs/Addresses-Mainnet/ const KYBER_NETWORK_PROXY_ADDRESS = '0x9AAb3f75489902f3a48495025729a0AF77d4b11e' const kyberRateContract = new web3.eth.Contract(KEYBER_NETWORK_PROXY_ABI, KYBER_NETWORK_PROXY_ADDRESS)
then replace keyber call by
kyberResult = await kyberRateContract.methods.getExpectedRate(inputTokenAddress, outputTokenAddress, inputAmount).call()
Kyber Rates for DAI, KNC, and LINK all return 0