|
1 | 1 | import assert from 'assert'; |
2 | | -import { integrationBootstrap } from './bootstrap'; |
| 2 | +import { ethers } from 'ethers'; |
| 3 | +import { WormholeChainSelector, integrationBootstrap } from './bootstrap'; |
| 4 | +import { typedValues } from '../helpers/object'; |
| 5 | +import { WormholeMock__factory } from '../generated/typechain'; |
3 | 6 |
|
4 | 7 | describe('cross chain nft distribution', function () { |
5 | 8 | const { chains } = integrationBootstrap(); |
6 | 9 |
|
7 | | - it('allows onwer mint nft', async function () { |
| 10 | + before('register emitters', async function () { |
| 11 | + for (const chain of typedValues(chains)) { |
| 12 | + const _chains = [ |
| 13 | + WormholeChainSelector.mothership, |
| 14 | + WormholeChainSelector.satellite1, |
| 15 | + WormholeChainSelector.satellite2, |
| 16 | + ]; |
| 17 | + const _emitters = [ |
| 18 | + chains.mothership.GovernanceProxy.address, |
| 19 | + chains.satellite1.GovernanceProxy.address, |
| 20 | + chains.satellite2.GovernanceProxy.address, |
| 21 | + ]; |
| 22 | + await chain.GovernanceProxy.connect(chain.signer).setRegisteredEmitters(_chains, _emitters); |
| 23 | + } |
| 24 | + }); |
| 25 | + |
| 26 | + it('allows owner mint nft', async function () { |
8 | 27 | for (const chain of Object.values(chains)) { |
9 | 28 | const ownerAddress = await chain.signer.getAddress(); |
10 | 29 | assert.equal((await chain.CouncilToken.balanceOf(ownerAddress)).toString(), '1'); |
11 | 30 | } |
12 | 31 | }); |
| 32 | + |
| 33 | + it.only('dimisses members', async function () { |
| 34 | + const ownerAddress = await chains.mothership.signer.getAddress(); |
| 35 | + const tx = await chains.mothership.GovernanceProxy.dismissMembers([await chains.mothership.signer.getAddress()]); |
| 36 | + // const rx = await tx.wait(); |
| 37 | + |
| 38 | + // // TODO use json abi here |
| 39 | + // const abi = [ |
| 40 | + // 'event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)', |
| 41 | + // ]; |
| 42 | + // const iface = new ethers.utils.Interface(abi); |
| 43 | + |
| 44 | + // console.log("rx: ",rx) |
| 45 | + |
| 46 | + // // Parsing the last event from the receipt |
| 47 | + // const events = []; |
| 48 | + |
| 49 | + // for (const evt of rx.events!) { |
| 50 | + // try { |
| 51 | + // events.push(iface.parseLog(evt)); |
| 52 | + // } catch (_) { |
| 53 | + // // If the event is not parsed is not the one we are looking for |
| 54 | + // } |
| 55 | + // } |
| 56 | + |
| 57 | + // if (events.length === 0) { |
| 58 | + // throw new Error('Could not find cross chain event'); |
| 59 | + // } |
| 60 | + |
| 61 | + // console.log(events) |
| 62 | + |
| 63 | + // await chains.satellite1.WormholeRelayerMock.deliver( |
| 64 | + // [encodedValue1], |
| 65 | + // event?.args?.payload, |
| 66 | + // await voter.satellite1.getAddress(), |
| 67 | + // [] |
| 68 | + // ); |
| 69 | + |
| 70 | + }) |
13 | 71 | }); |
0 commit comments