SHARE
TWEET

Untitled

a guest Jun 25th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require('module-alias/register');
  2.  
  3. import * as ABIDecoder from 'abi-decoder';
  4. import * as chai from 'chai';
  5. import { Address } from 'set-protocol-utils';
  6. import { BigNumber } from 'bignumber.js';
  7.  
  8. import { CoreWrapper } from '@utils/wrappers/coreWrapper';
  9. import { ERC20Wrapper } from '@utils/wrappers/erc20Wrapper';
  10. import { KyberNetworkWrapper } from '@utils/wrappers/kyberNetworkWrapper';
  11.  
  12. const token = await erc20Wrapper.deployTokenAsync(operatorAccount);
  13. const token2 = await erc20Wrapper.deployTokenAsync(operatorAccount);
  14.  
  15. await kyberNetworkWrapper.setExpectedRateOnKyberReserve();
  16.  
  17. await kyberNetworkWrapper.enableTokensForReserve(token.address);
  18. await kyberNetworkWrapper.enableTokensForReserve(token2.address);
  19.  
  20. await kyberNetworkWrapper.setUpConversionRates(
  21.   [token.address, token2.address],
  22.   [new BigNumber(549000000000000000000), new BigNumber(61079439106994400000)],
  23.   [new BigNumber(1813123931381047), new BigNumber(16400993988000000)],
  24. );
  25.  
  26. await kyberNetworkWrapper.approveToReserve(
  27.   token,
  28.   new BigNumber(1000000000000000000000000000),
  29.   operatorAccount,
  30. );
  31.  
  32. await kyberNetworkWrapper.approveToReserve(
  33.   token2,
  34.   new BigNumber(1000000000000000000000000000),
  35.   operatorAccount,
  36. );
  37.  
  38. await web3.eth.sendTransaction(
  39.   {
  40.     to: '0x038F9B392Fb9A9676DbAddF78EA5fdbf6C7d9710',
  41.     from: operatorAccount,
  42.     value: '1000000000000000000'
  43.   }
  44. );
  45.  
  46. // Get Kyber Rate
  47. const ethAddress = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';
  48. console.log("TOken address", token.address, ethAddress);
  49. await kyberNetworkWrapper.getKyberRate(
  50.   ethAddress,
  51.   token.address,
  52.   // token2.address,
  53.   new BigNumber(100000000000000000000),
  54. );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top