forked from kangarang/tcr-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
314 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import Ethjs from 'ethjs' | ||
import EthEvents from 'eth-events' | ||
|
||
import { | ||
buildContract, | ||
printCommitVote, | ||
printTokenTransfer, | ||
printClaimReward, | ||
} from './utils' | ||
|
||
const provider = new Ethjs.HttpProvider(`https://mainnet.infura.io`) | ||
const ethjs = new Ethjs(provider) | ||
|
||
const contract = buildContract('adChain', 'registry') | ||
const ethEvents = new EthEvents(ethjs, contract) | ||
|
||
const fromBlock = '6000000' | ||
const toBlock = 'latest' | ||
|
||
const eventNames = ['_RewardClaimed'] | ||
const indexedFilterValues = { | ||
// _to: '0xb4b26709ffed2cd165b9b49eea1ac38d133d7975', | ||
} | ||
|
||
ethEvents.getLogs(fromBlock, toBlock, eventNames, indexedFilterValues).then(logs => { | ||
console.log(`${logs.length} logs`) | ||
|
||
logs.forEach(({ logData, txData }) => { | ||
// console.log('logData:', logData) | ||
// console.log('txData:', txData) | ||
|
||
printClaimReward(logData, txData) | ||
|
||
// find matching log | ||
// const match = find({ 'logData': { 'challengeID': logData.challengeID } }, logsC) | ||
// console.log('match:', match) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import Token from './abis/EIP20.json' | ||
import PLCRVoting from './abis/PLCRVoting.json' | ||
import Registry from './abis/Registry.json' | ||
|
||
import { baseToConvertedUnit } from 'libs/units' | ||
|
||
export const contracts = { | ||
abis: { | ||
token: Token.abi, | ||
voting: PLCRVoting.abi, | ||
registry: Registry.abi, | ||
}, | ||
addresses: { | ||
adChain: { | ||
token: '0xd0d6d6c5fe4a677d343cc433536bb717bae167dd', | ||
voting: '0xb4b26709ffed2cd165b9b49eea1ac38d133d7975', | ||
registry: '0x5e2eb68a31229b469e34999c467b017222677183', | ||
}, | ||
}, | ||
} | ||
|
||
export function buildContract(tcr = 'adChain', contract) { | ||
return { | ||
abi: contracts.abis[contract], | ||
address: contracts.addresses[tcr][contract], | ||
} | ||
} | ||
|
||
export function printTokenTransfer(logData, txData) { | ||
console.log('from:', logData._from) | ||
console.log('value:', baseToConvertedUnit(logData._value, '9')) | ||
console.log('txHash:', txData.txHash) | ||
console.log('blockNumber:', txData.blockNumber) | ||
console.log('date:', txData.date) | ||
console.log('') | ||
} | ||
|
||
export function printCommitVote(logData, txData) { | ||
console.log('pollID:', logData.pollID.toString()) | ||
console.log('numTokens:', logData.numTokens.toString()) | ||
console.log('voter:', logData.voter) | ||
console.log('txHash:', txData.txHash) | ||
console.log('blockNumber:', txData.blockNumber) | ||
console.log('date:', txData.date) | ||
console.log('') | ||
} | ||
|
||
export function printClaimReward(logData) { | ||
console.log('pollID:', logData.challengeID.toString()) | ||
console.log('voter:', logData.voter) | ||
console.log('reward:', baseToConvertedUnit(logData.reward, '9')) | ||
console.log('reward:', logData.reward.toString()) | ||
console.log('') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.