Advertisement
Guest User

web3.js

a guest
Aug 18th, 2019
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import Web3 from 'web3';
  2.  
  3. // abi from here https://etherscan.io/address/0x1e0447b19bb6ecfdae1e4ae1694b0c3659614e4e#code
  4. const solo = require('../abi/dydx/solo.json')
  5. const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/5b39e9ad55d7499797ffcf33c93e666a'));
  6.  
  7. // address taken from here - https://docs.dydx.exchange/#/contracts
  8. const soloContract = new web3.eth.Contract(solo, '0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e')
  9.  
  10. // Get events
  11. soloContract.getPastEvents('LogLiquidate', {
  12. fromBlock: 7575711,
  13. toBlock: 'latest'
  14. }, function(error, events){ console.log(events); })
  15. .then(function(events){
  16. console.log(events) // same results as the optional callback above
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement