Publish for infra (#15)

* Setup for publish of 0.2.1
* Add stats to app
* Fix build issue from older OpenZepplin package version
* Fix typing in helloWorld.test
* Move test dir to src for ts and lint coverage
* Fix prettier and lint configs

Co-authored-by: J M Rossy <jm.rossy@gmail.com>
pull/2435/head 0.2.1
Yorke Rhodes 2 years ago committed by GitHub
parent b1c826540c
commit 3c5f8c1056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .eslintignore
  2. 2
      contracts/HelloWorld.sol
  3. 42
      package.json
  4. 6
      src/index.ts
  5. 59
      src/sdk/app.ts
  6. 10
      src/test/deploy.test.ts
  7. 15
      src/test/helloworld.test.ts
  8. 6
      tsconfig.json
  9. 164
      yarn.lock

@ -2,3 +2,4 @@ node_modules
dist
coverage
src/types
hardhat.config.ts

@ -1,4 +1,4 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.13;
// ============ External Imports ============

@ -3,19 +3,19 @@
"description": "A basic skeleton of an Abacus app",
"version": "0.2.1",
"dependencies": {
"@abacus-network/app": "0.2.1-beta1",
"@abacus-network/sdk": "0.2.1-beta1",
"@openzeppelin/contracts-upgradeable": "~4.5.0",
"@abacus-network/app": "0.2.1",
"@abacus-network/sdk": "0.2.1",
"@openzeppelin/contracts-upgradeable": "^4.6.0",
"ethers": "^5.4.7"
},
"devDependencies": {
"@abacus-network/core": "^0.2.1-beta1",
"@abacus-network/deploy": "0.2.1-beta1",
"@abacus-network/hardhat": "0.2.1-beta1",
"@abacus-network/core": "0.2.1",
"@abacus-network/deploy": "0.2.1",
"@abacus-network/hardhat": "0.2.1",
"@nomiclabs/hardhat-ethers": "^2.0.1",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@typechain/ethers-v5": "^10.0.0",
"@typechain/hardhat": "^6.0.0",
"@typechain/ethers-v5": "10.0.0",
"@typechain/hardhat": "6.0.0",
"@types/mocha": "^9.1.0",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
@ -30,20 +30,34 @@
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.7.14",
"ts-node": "^10.8.0",
"typechain": "^8.0.0",
"typechain": "8.0.0",
"typescript": "^4.7.2"
},
"files": [
"/dist",
"/contracts"
],
"homepage": "https://www.useabacus.network",
"keywords": [
"Abacus",
"HelloWorld",
"Solidity",
"Typescript"
],
"license": "Apache-2.0",
"main": "dist/index.js",
"packageManager": "yarn@3.2.0",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/abacus-network/abacus-app-template"
},
"scripts": {
"clean": "hardhat clean && rm -r dist",
"build": "hardhat compile && tsc",
"test": "hardhat test",
"clean": "hardhat clean && rm -rf dist cache src/types",
"coverage": "hardhat coverage",
"prettier": "prettier --write ./contracts ./src ./test",
"lint": "eslint . --ext .ts"
"lint": "eslint . --ext .ts",
"prettier": "prettier --write ./contracts ./src",
"test": "hardhat test ./src/test/*"
},
"types": "dist/index.d.ts"
}

@ -0,0 +1,6 @@
export { HelloWorldChecker } from './deploy/check';
export { HelloWorldConfig } from './deploy/config';
export { HelloWorldDeployer } from './deploy/deploy';
export { HelloWorldApp } from './sdk/app';
export { HelloWorldContracts } from './sdk/contracts';
export * as types from './types';

@ -1,18 +1,63 @@
import { AbacusApp, ChainName, ChainNameToDomainId } from '@abacus-network/sdk';
import { TypedListener } from '@abacus-network/core/dist/common';
import {
AbacusApp,
ChainName,
ChainNameToDomainId,
Remotes,
} from '@abacus-network/sdk';
import { ethers } from 'ethers';
import { ReceivedHelloWorldEvent } from '../types/contracts/HelloWorld';
import { HelloWorldContracts } from './contracts';
export class HelloWorldApp<
Chain extends ChainName = ChainName,
> extends AbacusApp<HelloWorldContracts, Chain> {
async sendHelloWorld(
from: Chain,
to: Chain,
async sendHelloWorld<From extends Chain>(
from: From,
to: Remotes<Chain, From>,
message: string,
receiveHandler?: TypedListener<ReceivedHelloWorldEvent>,
): Promise<ethers.ContractReceipt> {
const helloWorldContract = this.getContracts(from).router;
const sender = this.getContracts(from).router;
const toDomain = ChainNameToDomainId[to];
const tx = await helloWorldContract.sendHelloWorld(toDomain, message);
return tx.wait();
const tx = await sender.sendHelloWorld(toDomain, message);
const receipt = await tx.wait();
if (receiveHandler) {
const recipient = this.getContracts(to).router;
const filter = recipient.filters.ReceivedHelloWorld(
ChainNameToDomainId[from],
ChainNameToDomainId[to],
);
recipient.once(filter, receiveHandler);
}
return receipt;
}
async channelStats<From extends Chain>(from: From, to: Remotes<Chain, From>) {
const sent = await this.getContracts(from).router.sentTo(
ChainNameToDomainId[to],
);
const received = await this.getContracts(to).router.receivedFrom(
ChainNameToDomainId[from],
);
return { sent: sent.toNumber(), received: received.toNumber() };
}
async stats() {
const entries = await Promise.all(
this.chains().map(async (source) => {
const destinationEntries = await Promise.all(
this.remoteChains(source).map(async (destination) => [
destination,
await this.channelStats(source, destination),
]),
);
return [source, Object.fromEntries(destinationEntries)];
}),
);
return Object.fromEntries(entries);
}
}

@ -6,11 +6,11 @@ import { TestCoreDeploy } from '@abacus-network/hardhat/dist/src/TestCoreDeploy'
import { MultiProvider, TestChainNames } from '@abacus-network/sdk';
import '@nomiclabs/hardhat-waffle';
import { ethers } from 'hardhat';
import { HelloWorldChecker } from '../src/deploy/check';
import { getConfigMap, testConfigs } from '../src/deploy/config';
import { HelloWorldDeployer } from '../src/deploy/deploy';
import { HelloWorldApp } from '../src/sdk/app';
import { HelloWorldContracts } from '../src/sdk/contracts';
import { HelloWorldChecker } from '../deploy/check';
import { getConfigMap, testConfigs } from '../deploy/config';
import { HelloWorldDeployer } from '../deploy/deploy';
import { HelloWorldApp } from '../sdk/app';
import { HelloWorldContracts } from '../sdk/contracts';
describe('deploy', async () => {
let multiProvider: MultiProvider<TestChainNames>;

@ -4,13 +4,17 @@ import '@abacus-network/hardhat';
import { TestCoreApp } from '@abacus-network/hardhat/dist/src/TestCoreApp';
// TODO export TestCoreDeploy from @abacus-network/hardhat properly
import { TestCoreDeploy } from '@abacus-network/hardhat/dist/src/TestCoreDeploy';
import { ChainNameToDomainId } from '@abacus-network/sdk';
import {
ChainNameToDomainId,
MultiProvider,
TestChainNames,
} from '@abacus-network/sdk';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { expect } from 'chai';
import { ethers } from 'hardhat';
import { getConfigMap, testConfigs } from '../src/deploy/config';
import { HelloWorldDeployer } from '../src/deploy/deploy';
import { HelloWorld } from '../src/types';
import { getConfigMap, testConfigs } from '../deploy/config';
import { HelloWorldDeployer } from '../deploy/deploy';
import { HelloWorld } from '../types';
describe('HelloWorld', async () => {
const localChain = 'test1';
@ -21,8 +25,7 @@ describe('HelloWorld', async () => {
let signer: SignerWithAddress;
let local: HelloWorld;
let remote: HelloWorld;
// TODO fix multiProvider type issues
let multiProvider: any; /*MultiProvider<TestChainNames>;*/
let multiProvider: MultiProvider<TestChainNames>;
let coreApp: TestCoreApp;
before(async () => {

@ -19,10 +19,10 @@
"sourceMap": true,
"target": "es6",
"strict": true,
"outDir": "./dist/",
"rootDir": "./",
"outDir": "./dist",
"rootDir": "./src",
"resolveJsonModule": true
},
"exclude": ["./node_modules/", "./dist/", "./src/types/hardhat.d.ts"],
"include": ["./src/", "./test", "hardhat.config.ts"]
"include": ["./src/"]
}

@ -5,62 +5,60 @@ __metadata:
version: 6
cacheKey: 8
"@abacus-network/app@npm:0.2.1-beta1, @abacus-network/app@npm:^0.2.1-beta1":
version: 0.2.1-beta1
resolution: "@abacus-network/app@npm:0.2.1-beta1"
"@abacus-network/app@npm:0.2.1, @abacus-network/app@npm:^0.2.1":
version: 0.2.1
resolution: "@abacus-network/app@npm:0.2.1"
dependencies:
"@abacus-network/core": ^0.2.1-beta1
"@abacus-network/utils": ^0.2.1-beta1
"@abacus-network/core": ^0.2.1
"@abacus-network/utils": ^0.2.1
"@openzeppelin/contracts-upgradeable": ^4.5.0
checksum: e54b98e0cbf49203131b6279589d297052391743468b84f12efc0802f8c6ac92a56334249d43cd2d303cf874a066646647fa78a69cad9447e2002a0f7108b61b
checksum: 26ace76830fd92984e6e58daf8464f2d9b3d617547f85c33fc558b47b8acf08baf3010332cee8c82064682f6e03e3d3e2c7e6b9a5be9f7c3692f33f9515f9230
languageName: node
linkType: hard
"@abacus-network/core@npm:^0.2.1-beta1":
version: 0.2.1-beta1
resolution: "@abacus-network/core@npm:0.2.1-beta1"
"@abacus-network/core@npm:0.2.1, @abacus-network/core@npm:^0.2.1":
version: 0.2.1
resolution: "@abacus-network/core@npm:0.2.1"
dependencies:
"@abacus-network/utils": ^0.2.1-beta1
"@abacus-network/utils": ^0.2.1
"@openzeppelin/contracts": ^4.6.0
"@openzeppelin/contracts-upgradeable": ^4.6.0
"@summa-tx/memview-sol": ^2.0.0
checksum: 6270666f29717d78f427157d38e4429a2c2b664a5b0be1ad8c25ffbb6f6d9c78eee2b589ca8bd5f4cc406a8d76709ef643c11dcf3a7be1a1db1f900e33b4ca69
checksum: eddcca2b8cb618bb785ccede62514e71ed178155a2acceeaa4b52bbe2a7971aa31dfcf795b8f20f95ffb4b93409831fa0aa790eab468459d70f5798b7e253e1c
languageName: node
linkType: hard
"@abacus-network/deploy@npm:0.2.1-beta1, @abacus-network/deploy@npm:^0.2.1-beta1":
version: 0.2.1-beta1
resolution: "@abacus-network/deploy@npm:0.2.1-beta1"
"@abacus-network/deploy@npm:0.2.1, @abacus-network/deploy@npm:^0.2.1":
version: 0.2.1
resolution: "@abacus-network/deploy@npm:0.2.1"
dependencies:
"@abacus-network/app": ^0.2.1-beta1
"@abacus-network/core": ^0.2.1-beta1
"@abacus-network/sdk": ^0.2.1-beta1
"@abacus-network/utils": ^0.2.1-beta1
"@abacus-network/app": ^0.2.1
"@abacus-network/core": ^0.2.1
"@abacus-network/sdk": ^0.2.1
"@abacus-network/utils": ^0.2.1
"@types/debug": ^4.1.7
"@types/yargs": ^17.0.10
axios: ^0.21.3
debug: ^4.3.4
yargs: ^17.4.1
checksum: 7a9a6531d19784d4530c13f1a7b649f137bf15875aae8e41251f1d5a180ef81aba13098894a42dd74f35d9779502490535224c3be82e05fa4b6775d1f0e7f2a2
checksum: 0ec8c7c4c0db09e7866242656ee9caee23badfcab63c95509018abbd2cbd3c4908eb8fcb5f348d9ee7c74ac08dff5794390a75e99a1ea2de12e1e81caa6202b8
languageName: node
linkType: hard
"@abacus-network/hardhat@npm:0.2.1-beta1":
version: 0.2.1-beta1
resolution: "@abacus-network/hardhat@npm:0.2.1-beta1"
"@abacus-network/hardhat@npm:0.2.1":
version: 0.2.1
resolution: "@abacus-network/hardhat@npm:0.2.1"
dependencies:
"@abacus-network/core": ^0.2.1-beta1
"@abacus-network/deploy": ^0.2.1-beta1
"@abacus-network/sdk": ^0.2.1-beta1
"@abacus-network/utils": ^0.2.1-beta1
"@abacus-network/core": ^0.2.1
"@abacus-network/deploy": ^0.2.1
"@abacus-network/sdk": ^0.2.1
"@abacus-network/utils": ^0.2.1
"@nomiclabs/hardhat-ethers": ^2.0.5
"@nomiclabs/hardhat-waffle": ^2.0.2
ethereum-waffle: ^3.2.2
ethers: ^5.4.7
hardhat: ^2.8.4
ts-node: ^10.8.0
typescript: ^4.7.2
checksum: 807c9d1abdcfc7c166cf449a727422d6011e2c56745029d43b1409b0e6641e5519b1b5abf7641434750e24e855a5b7f723ba5f7d7165471614f0022367a804ec
checksum: 281ecc6f38f494295e1ae3d5cd9b25fdd927f533e15a69f1784020d33966931b4c96378c64d708253cf3e3b58ae5c23b3dbb4ed6df45934eeb892bc6c4804e06
languageName: node
linkType: hard
@ -68,16 +66,16 @@ __metadata:
version: 0.0.0-use.local
resolution: "@abacus-network/helloworld@workspace:."
dependencies:
"@abacus-network/app": 0.2.1-beta1
"@abacus-network/core": ^0.2.1-beta1
"@abacus-network/deploy": 0.2.1-beta1
"@abacus-network/hardhat": 0.2.1-beta1
"@abacus-network/sdk": 0.2.1-beta1
"@abacus-network/app": 0.2.1
"@abacus-network/core": 0.2.1
"@abacus-network/deploy": 0.2.1
"@abacus-network/hardhat": 0.2.1
"@abacus-network/sdk": 0.2.1
"@nomiclabs/hardhat-ethers": ^2.0.1
"@nomiclabs/hardhat-waffle": ^2.0.1
"@openzeppelin/contracts-upgradeable": ~4.5.0
"@typechain/ethers-v5": ^10.0.0
"@typechain/hardhat": ^6.0.0
"@openzeppelin/contracts-upgradeable": ^4.6.0
"@typechain/ethers-v5": 10.0.0
"@typechain/hardhat": 6.0.0
"@types/mocha": ^9.1.0
"@typescript-eslint/eslint-plugin": ^5.27.0
"@typescript-eslint/parser": ^5.27.0
@ -93,32 +91,32 @@ __metadata:
solhint-plugin-prettier: ^0.0.5
solidity-coverage: ^0.7.14
ts-node: ^10.8.0
typechain: ^8.0.0
typechain: 8.0.0
typescript: ^4.7.2
languageName: unknown
linkType: soft
"@abacus-network/sdk@npm:0.2.1-beta1, @abacus-network/sdk@npm:^0.2.1-beta1":
version: 0.2.1-beta1
resolution: "@abacus-network/sdk@npm:0.2.1-beta1"
"@abacus-network/sdk@npm:0.2.1, @abacus-network/sdk@npm:^0.2.1":
version: 0.2.1
resolution: "@abacus-network/sdk@npm:0.2.1"
dependencies:
"@abacus-network/core": ^0.2.1-beta1
"@abacus-network/utils": ^0.2.1-beta1
"@abacus-network/core": ^0.2.1
"@abacus-network/utils": ^0.2.1
"@ethersproject/bignumber": ^5.5.0
"@ethersproject/bytes": ^5.5.0
celo-ethers-provider: ^0.0.0
ethers: ^5.4.7
checksum: 16733fabd5c907f828bbffaf77fee0812e5e6f81573538aabf4cb0d595f06232c0fe5be9d07bc2962eab2a6e89b47952a08cb2883cc86221b606604df5bc545e
checksum: baa8b676ab3c0cebbd2ab08362b9e079a1607bfa0d865c8eff8d8caa61b9d4d8921fb04f1cee7de59ea54be8024cc27e63a0541e1fa851c8b00b928c8ab0de4e
languageName: node
linkType: hard
"@abacus-network/utils@npm:^0.2.1-beta1":
version: 0.2.1-beta1
resolution: "@abacus-network/utils@npm:0.2.1-beta1"
"@abacus-network/utils@npm:^0.2.1":
version: 0.2.1
resolution: "@abacus-network/utils@npm:0.2.1"
dependencies:
chai: ^4.3.0
ethers: ^5.4.7
checksum: 5c37be5d178b705bd4b94d41eacf09bbcb9e8b4580224cb76a5a9654f48934af5935c996a5b18a858d733820b5d5ad3225c5fc04e459d640cacdc0063d81d750
checksum: c7ef6336ff21da75737dbf4455e9f22a564b7088f7d29fd66de8aee23f932ed67bd3239f4c52f6534e1d79bdf6da82e78678c60cdb4f01869d074b96685802dc
languageName: node
linkType: hard
@ -929,13 +927,6 @@ __metadata:
languageName: node
linkType: hard
"@openzeppelin/contracts-upgradeable@npm:~4.5.0":
version: 4.5.2
resolution: "@openzeppelin/contracts-upgradeable@npm:4.5.2"
checksum: bd6a12eb83d8e3194e0847ffb248a1063668e2bf723afd21066316090de9b02e95af6057086a95fa21b0d09a2ef0ea057459bb5f5645dfff298e59e8c3267692
languageName: node
linkType: hard
"@openzeppelin/contracts@npm:^4.6.0":
version: 4.6.0
resolution: "@openzeppelin/contracts@npm:4.6.0"
@ -1194,7 +1185,7 @@ __metadata:
languageName: node
linkType: hard
"@typechain/ethers-v5@npm:^10.0.0":
"@typechain/ethers-v5@npm:10.0.0":
version: 10.0.0
resolution: "@typechain/ethers-v5@npm:10.0.0"
dependencies:
@ -1223,7 +1214,7 @@ __metadata:
languageName: node
linkType: hard
"@typechain/hardhat@npm:^6.0.0":
"@typechain/hardhat@npm:6.0.0":
version: 6.0.0
resolution: "@typechain/hardhat@npm:6.0.0"
dependencies:
@ -3409,9 +3400,9 @@ __metadata:
linkType: hard
"caniuse-lite@npm:^1.0.30000844":
version: 1.0.30001351
resolution: "caniuse-lite@npm:1.0.30001351"
checksum: 0d8fedb1cc7f58beefc0216f1426feff6d3fb8d72b57cb343cf0b72a940f1f8691d5a67a166631195ba16c4e12f358780a8876a4071b9a4ae56e7883335ec6d8
version: 1.0.30001352
resolution: "caniuse-lite@npm:1.0.30001352"
checksum: 575ad031349e56224471859decd100d0f90c804325bf1b543789b212d6126f6e18925766b325b1d96f75e48df0036e68f92af26d1fb175803fd6ad935bc807ac
languageName: node
linkType: hard
@ -4481,9 +4472,9 @@ __metadata:
linkType: hard
"electron-to-chromium@npm:^1.3.47":
version: 1.4.149
resolution: "electron-to-chromium@npm:1.4.149"
checksum: 82a3337e62a4cf62c465ab4d3c2f3906e40694b9deb22753c66c037c8c48e2a8c5dbcd39c76e45cdc9b8156a8d24ca11e7fd7576ba61de8ac80a15d9f4e9d890
version: 1.4.154
resolution: "electron-to-chromium@npm:1.4.154"
checksum: e04c6f8eb630a0ae9c62a9d00272fb154b5f5576bcd5f71cc4f8eb288603099a19b1544facd462f11bd3c52418d51b32de6d1c03050c8aadfcec995adc9ef8e6
languageName: node
linkType: hard
@ -10158,7 +10149,16 @@ __metadata:
languageName: node
linkType: hard
"prettier@npm:^2.1.2, prettier@npm:^2.3.1, prettier@npm:^2.4.1":
"prettier@npm:^2.1.2":
version: 2.7.0
resolution: "prettier@npm:2.7.0"
bin:
prettier: bin-prettier.js
checksum: 5b55bb1dced9d16635b83229df8e670d150890fdb343f19e8a66e610094a108e960c0f57352b3e5cdbc4eff4ef00a834406047ffcd9f20bd22a6497ba143c81f
languageName: node
linkType: hard
"prettier@npm:^2.3.1, prettier@npm:^2.4.1":
version: 2.6.2
resolution: "prettier@npm:2.6.2"
bin:
@ -12539,24 +12539,7 @@ __metadata:
languageName: node
linkType: hard
"typechain@npm:^3.0.0":
version: 3.0.0
resolution: "typechain@npm:3.0.0"
dependencies:
command-line-args: ^4.0.7
debug: ^4.1.1
fs-extra: ^7.0.0
js-sha3: ^0.8.0
lodash: ^4.17.15
ts-essentials: ^6.0.3
ts-generator: ^0.1.1
bin:
typechain: ./dist/cli/cli.js
checksum: a38aff5e89c41e20e2c3a1f7b5f04666dbc94b5592eba70ba7d1e0aeb49089d22ed3d35e55a0b0d1f0bfdcea9818157fa4ee3854ef818f46f6aa899520fe7c25
languageName: node
linkType: hard
"typechain@npm:^8.0.0":
"typechain@npm:8.0.0":
version: 8.0.0
resolution: "typechain@npm:8.0.0"
dependencies:
@ -12578,6 +12561,23 @@ __metadata:
languageName: node
linkType: hard
"typechain@npm:^3.0.0":
version: 3.0.0
resolution: "typechain@npm:3.0.0"
dependencies:
command-line-args: ^4.0.7
debug: ^4.1.1
fs-extra: ^7.0.0
js-sha3: ^0.8.0
lodash: ^4.17.15
ts-essentials: ^6.0.3
ts-generator: ^0.1.1
bin:
typechain: ./dist/cli/cli.js
checksum: a38aff5e89c41e20e2c3a1f7b5f04666dbc94b5592eba70ba7d1e0aeb49089d22ed3d35e55a0b0d1f0bfdcea9818157fa4ee3854ef818f46f6aa899520fe7c25
languageName: node
linkType: hard
"typedarray-to-buffer@npm:^3.1.5":
version: 3.1.5
resolution: "typedarray-to-buffer@npm:3.1.5"

Loading…
Cancel
Save