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
Yorke Rhodes 2 years ago committed by GitHub
parent f566bb40c8
commit 25e6175f50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      solidity/core/tsconfig.json
  2. 1
      tsconfig.json
  3. 1
      typescript/infra/config/environments/dev/index.ts
  4. 1
      typescript/infra/config/environments/mainnet/index.ts
  5. 1
      typescript/infra/config/environments/test/index.ts
  6. 1
      typescript/infra/config/environments/testnet/index.ts
  7. 9
      typescript/infra/config/environments/testnet2/helloworld/addresses.json
  8. 3
      typescript/infra/config/environments/testnet2/index.ts
  9. 1
      typescript/infra/package.json
  10. 20
      typescript/infra/scripts/helloworld/check.ts
  11. 29
      typescript/infra/scripts/helloworld/deploy.ts
  12. 40
      typescript/infra/scripts/helloworld/kathy.ts
  13. 59
      typescript/infra/scripts/helloworld/utils.ts
  14. 2
      typescript/infra/src/config/environment.ts
  15. 3
      typescript/sdk/tsconfig.json
  16. 19
      yarn.lock

@ -1,8 +1,7 @@
{
"compilerOptions": {
"outDir": "./dist/",
"rootDir": "./types/",
"resolveJsonModule": true
"rootDir": "./types/"
},
"exclude": ["./node_modules/", "./dist/", "./types/hardhat.d.ts"],
"extends": "../../tsconfig.json",

@ -16,6 +16,7 @@
"preserveSymlinks": true,
"preserveWatchOutput": true,
"pretty": false,
"resolveJsonModule": true,
"sourceMap": true,
"target": "es6",
"strict": true

@ -7,6 +7,7 @@ import { core } from './core';
import { infrastructure } from './infrastructure';
export const environment: CoreEnvironmentConfig<DevChains> = {
environment: 'dev',
transactionConfigs: devConfigs,
getMultiProvider: () => getMultiProviderFromGCP(devConfigs, 'dev'),
agent,

@ -7,6 +7,7 @@ import { core } from './core';
import { infrastructure } from './infrastructure';
export const environment: CoreEnvironmentConfig<MainnetChains> = {
environment: 'mainnet',
transactionConfigs: mainnetConfigs,
getMultiProvider: () => getMultiProviderFromGCP(mainnetConfigs, 'mainnet'),
agent,

@ -10,6 +10,7 @@ import { core } from './core';
import { infra } from './infra';
export const environment: CoreEnvironmentConfig<TestChains> = {
environment: 'test',
transactionConfigs: testConfigs,
agent,
core,

@ -7,6 +7,7 @@ import { core } from './core';
import { infrastructure } from './infrastructure';
export const environment: CoreEnvironmentConfig<TestnetChains> = {
environment: 'testnet',
transactionConfigs: testnetConfigs,
getMultiProvider: () => getMultiProviderFromGCP(testnetConfigs, 'testnet'),
agent,

@ -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" }
}

@ -4,12 +4,15 @@ import { CoreEnvironmentConfig } from '../../../src/config';
import { agent } from './agent';
import { TestnetChains, testnetConfigs } from './chains';
import { core } from './core';
import helloWorldAddresses from './helloworld/addresses.json';
import { infrastructure } from './infrastructure';
export const environment: CoreEnvironmentConfig<TestnetChains> = {
environment: 'testnet2',
transactionConfigs: testnetConfigs,
getMultiProvider: () => getMultiProviderFromGCP(testnetConfigs, 'testnet2'),
agent,
core,
infra: infrastructure,
helloWorldAddresses,
};

@ -5,6 +5,7 @@
"dependencies": {
"@abacus-network/core": "^0.2.2",
"@abacus-network/deploy": "^0.2.2",
"@abacus-network/helloworld": "0.2.2",
"@abacus-network/sdk": "^0.2.2",
"@aws-sdk/client-iam": "^3.74.0",
"@aws-sdk/client-kms": "3.48.0",

@ -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;
}

@ -14,9 +14,11 @@ export type EnvironmentChain<E extends DeployEnvironment> = Extract<
>;
export type CoreEnvironmentConfig<Chain extends ChainName> = {
environment: DeployEnvironment;
transactionConfigs: EnvironmentConfig<Chain>;
agent: AgentConfig<Chain>;
core: ChainMap<Chain, CoreConfig>;
infra: InfrastructureConfig;
getMultiProvider: () => Promise<MultiProvider<Chain>>;
helloWorldAddresses?: ChainMap<Chain, { router: string }>;
};

@ -2,8 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist/",
"rootDir": "./src/",
"resolveJsonModule": true
"rootDir": "./src/"
},
"exclude": ["./node_modules/", "./dist/", "./test/"],
"include": ["./src/*.ts", "./src/**/*.ts"]

@ -5,7 +5,7 @@ __metadata:
version: 6
cacheKey: 8
"@abacus-network/app@^0.2.2, @abacus-network/app@workspace:solidity/app":
"@abacus-network/app@0.2.2, @abacus-network/app@^0.2.2, @abacus-network/app@workspace:solidity/app":
version: 0.0.0-use.local
resolution: "@abacus-network/app@workspace:solidity/app"
dependencies:
@ -101,12 +101,25 @@ __metadata:
languageName: unknown
linkType: soft
"@abacus-network/helloworld@npm:0.2.2":
version: 0.2.2
resolution: "@abacus-network/helloworld@npm:0.2.2"
dependencies:
"@abacus-network/app": 0.2.2
"@abacus-network/sdk": 0.2.2
"@openzeppelin/contracts-upgradeable": ^4.6.0
ethers: ^5.4.7
checksum: c4aaff98c7d311bb654029f44a30a811957ac1051ea89499265ac19676e55f10737ae2420e5443891371f4d74cbb69b9f6a0ead075027d15416b9a8351e7f460
languageName: node
linkType: hard
"@abacus-network/infra@workspace:typescript/infra":
version: 0.0.0-use.local
resolution: "@abacus-network/infra@workspace:typescript/infra"
dependencies:
"@abacus-network/core": ^0.2.2
"@abacus-network/deploy": ^0.2.2
"@abacus-network/helloworld": 0.2.2
"@abacus-network/sdk": ^0.2.2
"@aws-sdk/client-iam": ^3.74.0
"@aws-sdk/client-kms": 3.48.0
@ -148,7 +161,7 @@ __metadata:
languageName: unknown
linkType: soft
"@abacus-network/sdk@^0.2.2, @abacus-network/sdk@workspace:typescript/sdk":
"@abacus-network/sdk@0.2.2, @abacus-network/sdk@^0.2.2, @abacus-network/sdk@workspace:typescript/sdk":
version: 0.0.0-use.local
resolution: "@abacus-network/sdk@workspace:typescript/sdk"
dependencies:
@ -7844,7 +7857,7 @@ __metadata:
languageName: node
linkType: hard
"ethers@npm:^5.0.1, ethers@npm:^5.0.2, ethers@npm:^5.5.2, ethers@npm:^5.6.8":
"ethers@npm:^5.0.1, ethers@npm:^5.0.2, ethers@npm:^5.4.7, ethers@npm:^5.5.2, ethers@npm:^5.6.8":
version: 5.6.8
resolution: "ethers@npm:5.6.8"
dependencies:

Loading…
Cancel
Save