Skip to content

Commit

Permalink
Added support of the poa-xdai OB (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
akolotov authored Sep 22, 2021
1 parent 939a672 commit f2d19f8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bridge-faucet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

BSC_OB = getenv('BSC_OB', '0x59447362798334d3485c64D1e4870Fde2DDC0d75')
ETH_OB = getenv('ETH_OB', '0xf6A78083ca3e2a662D6dd1703c939c8aCE2e268d')
POA_OB = getenv('POA_OB', '0x63be59CF177cA9bb317DE8C4aa965Ddda93CB9d7')

MOONS_EXT = getenv('MOONS_EXT', '0x1E0507046130c31DEb20EC2f870ad070Ff266079')
BRICKS_EXT = getenv('BRICKS_EXT', '0xf85b17E64Bc788D0CB1A8c8C87c0d74e520c2A54')
Expand Down Expand Up @@ -54,6 +55,7 @@
info(f'XDAI_RPC = {XDAI_RPC}')
info(f'BSC_OB = {BSC_OB}')
info(f'ETH_OB = {ETH_OB}')
info(f'POA_OB = {POA_OB}')
info(f'MOONS_EXT = {MOONS_EXT}')
info(f'BRICKS_EXT = {BRICKS_EXT}')
info(f'FAUCET_PRIVKEY = ...')
Expand Down Expand Up @@ -137,6 +139,7 @@

bsc_ob = xdai_w3.eth.contract(abi = ABI, address = BSC_OB)
eth_ob = xdai_w3.eth.contract(abi = ABI, address = ETH_OB)
poa_ob = xdai_w3.eth.contract(abi = ABI, address = POA_OB)

moons_mediator = xdai_w3.eth.contract(abi = EXT_ABI, address = MOONS_EXT)
bricks_mediator = xdai_w3.eth.contract(abi = EXT_ABI, address = BRICKS_EXT)
Expand Down Expand Up @@ -189,6 +192,17 @@
raise BaseException('Cannot get ETH-xDAI OB logs')
info(f'Found {len(eth_logs)} TokensBridged events on ETH-xDAI OB')

filter = poa_ob.events.TokensBridged.build_filter()
info(f'Looking for TokensBridged events on POA-xDAI OB from {start_block} to {last_block}')
try:
poa_logs = xdai_w3.eth.getLogs({'fromBlock': start_block,
'toBlock': last_block,
'address': filter.address,
'topics': filter.topics})
except:
raise BaseException('Cannot get POA-xDAI OB logs')
info(f'Found {len(poa_logs)} TokensBridged events on POA-xDAI OB')

filter = moons_mediator.events.TokensBridged.build_filter()
info(f'Looking for TokensBridged events on MOONs extension from {start_block} to {last_block}')
try:
Expand Down Expand Up @@ -224,6 +238,12 @@
recipients.add(recipient)
info(f'Identified {len(recipients) - tmp} tokens recipients from ETH-xDAI OB events')

tmp = len(recipients)
for log in poa_logs:
recipient = poa_ob.events.TokensBridged().processLog(log).args.recipient
recipients.add(recipient)
info(f'Identified {len(recipients) - tmp} tokens recipients from POA-xDAI OB events')

tmp = len(recipients)
for log in moons_logs:
recipient = moons_mediator.events.TokensBridged().processLog(log).args.recipient
Expand Down

0 comments on commit f2d19f8

Please sign in to comment.