helloworld kathy (#569)
* Alpha7 * Checker * Move AbacusCoreChecker to deploy * Actually check inbox domain configuration (#544) * Transfer ownership of Router in RouterDeployer (#546) * Transfer ownership of Router in RouterDeployer * Improve router config/deploy/init (#557) * Add default initialize to Router * Remove proxies from router framework Co-authored-by: yorhodes <yorke@useabacus.network> * Update router tests for initialization * Move libs to contracts dir * Publish alpha12 * Publish beta1 * Small adjustments * Fix prettier in core * Fix lint * Add newlines to package json * Publish beta3 * Add hello world commands to infra * Make hello world artifacts consistent with infra * Add back helloworld after merge * Fix kathy scripts for 0.2.2 Hoist resolveJsonModule ts config to root * Run prettier * Cleanup tsconfig trailing commas * Refactor Helloworld Kathy (#616) * Refactor Helloworld Kathy * Move ts-ignore * Throw error when addresses do not exist Co-authored-by: nambrot <nambrot@googlemail.com> Co-authored-by: J M Rossy <jm.rossy@gmail.com>pull/620/head
parent
f566bb40c8
commit
25e6175f50
@ -0,0 +1,9 @@ |
||||
{ |
||||
"alfajores": { "router": "0x9dA6732F0276420B63dB461C7FB9992a32Bb8AA5" }, |
||||
"kovan": { "router": "0x057d38d184d74192B96840D8FbB37e584dDb569A" }, |
||||
"fuji": { "router": "0x73A7bDa325Ad8E5F591179C4ccA61b0CeF70d05C" }, |
||||
"mumbai": { "router": "0x0a71AcC99967829eE305a285750017C4916Ca269" }, |
||||
"bsctestnet": { "router": "0x711166cE892CBa0Fc01FdD74cFBE73b027678e15" }, |
||||
"arbitrumrinkeby": { "router": "0xcCcC2A71810f9D16770F8062dccc47f7F7C7bA2E" }, |
||||
"optimismkovan": { "router": "0x3212977FBE6464c2bB60Fdb85ab0a5E06e25cdFB" } |
||||
} |
@ -0,0 +1,20 @@ |
||||
import { HelloWorldChecker } from '@abacus-network/helloworld'; |
||||
|
||||
import { getCoreEnvironmentConfig, getEnvironment } from '../utils'; |
||||
|
||||
import { getApp, getConfiguration } from './utils'; |
||||
|
||||
async function main() { |
||||
const environment = await getEnvironment(); |
||||
const coreConfig = getCoreEnvironmentConfig(environment); |
||||
const multiProvider = await coreConfig.getMultiProvider(); |
||||
const app = await getApp(coreConfig); |
||||
const configMap = await getConfiguration(environment, multiProvider); |
||||
const checker = new HelloWorldChecker(multiProvider, app, configMap); |
||||
await checker.check(); |
||||
checker.expectEmpty(); |
||||
} |
||||
|
||||
main() |
||||
.then(() => console.info('HelloWorld check complete')) |
||||
.catch(console.error); |
@ -0,0 +1,29 @@ |
||||
import path from 'path'; |
||||
|
||||
import { HelloWorldDeployer } from '@abacus-network/helloworld'; |
||||
import { AbacusCore, serializeContracts } from '@abacus-network/sdk'; |
||||
|
||||
import { writeJSON } from '../../src/utils/utils'; |
||||
import { |
||||
getCoreEnvironmentConfig, |
||||
getEnvironment, |
||||
getEnvironmentDirectory, |
||||
} from '../utils'; |
||||
|
||||
import { getConfiguration } from './utils'; |
||||
|
||||
async function main() { |
||||
const environment = await getEnvironment(); |
||||
const coreConfig = getCoreEnvironmentConfig(environment); |
||||
const multiProvider = await coreConfig.getMultiProvider(); |
||||
const configMap = await getConfiguration(environment, multiProvider); |
||||
const core = AbacusCore.fromEnvironment(environment, multiProvider as any); |
||||
const deployer = new HelloWorldDeployer(multiProvider, configMap, core); |
||||
const contracts = await deployer.deploy(); |
||||
const dir = path.join(getEnvironmentDirectory(environment), 'helloworld'); |
||||
writeJSON(dir, 'addresses.json', serializeContracts(contracts)); |
||||
} |
||||
|
||||
main() |
||||
.then(() => console.info('Deployment complete')) |
||||
.catch(console.error); |
@ -0,0 +1,40 @@ |
||||
import { HelloWorldApp } from '@abacus-network/helloworld'; |
||||
import { ChainName } from '@abacus-network/sdk'; |
||||
|
||||
import { getCoreEnvironmentConfig, getEnvironment } from '../utils'; |
||||
|
||||
import { getApp } from './utils'; |
||||
|
||||
async function main() { |
||||
const environment = await getEnvironment(); |
||||
const coreConfig = getCoreEnvironmentConfig(environment); |
||||
const app = await getApp(coreConfig); |
||||
const sources = app.chains(); |
||||
await Promise.all( |
||||
sources.map((source) => { |
||||
const destinations = sources.slice().filter((d) => d !== source); |
||||
return Promise.all( |
||||
destinations.map((destination) => |
||||
sendMessage(app, source, destination), |
||||
), |
||||
); |
||||
}), |
||||
); |
||||
} |
||||
|
||||
async function sendMessage( |
||||
app: HelloWorldApp<any>, |
||||
source: ChainName, |
||||
destination: ChainName, |
||||
) { |
||||
const receipt = await app.sendHelloWorld( |
||||
source, |
||||
destination, |
||||
`Hello from ${source} to ${destination}!`, |
||||
); |
||||
console.log(JSON.stringify(receipt.events || receipt.logs)); |
||||
} |
||||
|
||||
main() |
||||
.then(() => console.info('HelloWorld sent')) |
||||
.catch(console.error); |
@ -0,0 +1,59 @@ |
||||
import { HelloWorldApp, HelloWorldContracts } from '@abacus-network/helloworld'; |
||||
import { helloWorldFactories } from '@abacus-network/helloworld/dist/sdk/contracts'; |
||||
import { |
||||
AbacusCore, |
||||
ChainMap, |
||||
ChainName, |
||||
MultiProvider, |
||||
buildContracts, |
||||
objMap, |
||||
promiseObjAll, |
||||
} from '@abacus-network/sdk'; |
||||
|
||||
import { CoreEnvironmentConfig, DeployEnvironment } from '../../src/config'; |
||||
|
||||
export async function getConfiguration<Chain extends ChainName>( |
||||
environment: DeployEnvironment, |
||||
multiProvider: MultiProvider<Chain>, |
||||
): Promise< |
||||
ChainMap<Chain, { owner: string; abacusConnectionManager: string }> |
||||
> { |
||||
const signerMap = await promiseObjAll( |
||||
multiProvider.map(async (_, dc) => dc.signer!), |
||||
); |
||||
const ownerMap = await promiseObjAll( |
||||
objMap(signerMap, async (_, signer) => { |
||||
return { |
||||
owner: await signer.getAddress(), |
||||
}; |
||||
}), |
||||
); |
||||
|
||||
// Currently can't be typed as per https://github.com/abacus-network/abacus-monorepo/pull/594/files#diff-40a12589668de942078f498e0ab0fda512e1eb7397189d6d286b590ae87c45d1R31
|
||||
// @ts-ignore
|
||||
const core: AbacusCore<Chain> = AbacusCore.fromEnvironment( |
||||
environment, |
||||
multiProvider as any, |
||||
); |
||||
|
||||
const configMap = core.extendWithConnectionManagers(ownerMap); |
||||
return configMap; |
||||
} |
||||
|
||||
export async function getApp<Chain extends ChainName>( |
||||
coreConfig: CoreEnvironmentConfig<Chain>, |
||||
) { |
||||
const addresses = coreConfig.helloWorldAddresses; |
||||
if (!addresses) { |
||||
throw new Error( |
||||
`Environment ${coreConfig.environment} does not have addresses for HelloWorld`, |
||||
); |
||||
} |
||||
const contracts = buildContracts(addresses, helloWorldFactories) as ChainMap< |
||||
Chain, |
||||
HelloWorldContracts |
||||
>; |
||||
const multiProvider = await coreConfig.getMultiProvider(); |
||||
const app = new HelloWorldApp(contracts, multiProvider as any); |
||||
return app; |
||||
} |
Loading…
Reference in new issue