diff --git a/.changeset/afraid-seas-cross.md b/.changeset/afraid-seas-cross.md new file mode 100644 index 000000000..b1ff580de --- /dev/null +++ b/.changeset/afraid-seas-cross.md @@ -0,0 +1,5 @@ +--- +'@celo/celocli': patch +--- + +fix governance:build-proposal with contracts from mento or which use solidity 0.8 diff --git a/.changeset/famous-cherries-kick.md b/.changeset/famous-cherries-kick.md new file mode 100644 index 000000000..2cb3e5510 --- /dev/null +++ b/.changeset/famous-cherries-kick.md @@ -0,0 +1,5 @@ +--- +'@celo/governance': patch +--- + +minor update to inquirer lib diff --git a/.changeset/few-seals-matter.md b/.changeset/few-seals-matter.md new file mode 100644 index 000000000..0331144a7 --- /dev/null +++ b/.changeset/few-seals-matter.md @@ -0,0 +1,12 @@ +--- +'@celo/wallet-hsm-azure': patch +'@celo/wallet-hsm-aws': patch +'@celo/wallet-hsm-gcp': patch +'@celo/wallet-ledger': patch +'@celo/wallet-remote': patch +'@celo/wallet-local': patch +'@celo/wallet-base': patch +'@celo/wallet-hsm': patch +--- + +Force patch bump wallets to deal with version conflict diff --git a/.changeset/lemon-gorillas-explain.md b/.changeset/lemon-gorillas-explain.md new file mode 100644 index 000000000..3bf059217 --- /dev/null +++ b/.changeset/lemon-gorillas-explain.md @@ -0,0 +1,5 @@ +--- +'@celo/celocli': minor +--- + +Adds support for safe integration for L2 hotfix security council approvals diff --git a/.changeset/orange-penguins-sneeze.md b/.changeset/orange-penguins-sneeze.md new file mode 100644 index 000000000..fddd03027 --- /dev/null +++ b/.changeset/orange-penguins-sneeze.md @@ -0,0 +1,5 @@ +--- +'@celo/celocli': minor +--- + +Removes L2 BLS keys support for account:authorize diff --git a/.changeset/pre.json b/.changeset/pre.json index e6b219b9b..9c15f8072 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -2,8 +2,8 @@ "mode": "pre", "tag": "beta", "initialVersions": { - "@celo/celocli": "5.2.1", - "@celo/dev-utils": "0.0.5", + "@celo/celocli": "5.2.3", + "@celo/dev-utils": "0.0.6", "@celo/base": "6.1.0", "@celo/connect": "6.0.2", "@celo/contractkit": "8.3.0", @@ -16,37 +16,45 @@ "@celo/phone-utils": "6.0.3", "@celo/transactions-uri": "5.0.11", "@celo/utils": "7.0.0", - "@celo/wallet-base": "6.0.1", - "@celo/wallet-hsm": "6.0.1", - "@celo/wallet-hsm-aws": "6.0.1", - "@celo/wallet-hsm-azure": "6.0.1", - "@celo/wallet-hsm-gcp": "6.0.1", - "@celo/wallet-ledger": "6.0.1", - "@celo/wallet-local": "6.0.1", - "@celo/wallet-remote": "6.0.1", + "@celo/wallet-base": "6.0.3", + "@celo/wallet-hsm": "6.0.3", + "@celo/wallet-hsm-aws": "6.0.3", + "@celo/wallet-hsm-azure": "6.0.3", + "@celo/wallet-hsm-gcp": "6.0.3", + "@celo/wallet-ledger": "6.0.3", + "@celo/wallet-local": "6.0.3", + "@celo/wallet-remote": "6.0.3", "@celo/typescript": "0.0.1", "@celo/viem-account-ledger": "0.0.1" }, "changesets": [ + "afraid-seas-cross", "calm-sheep-tie", "chilled-cycles-smell", "dry-gifts-love", "dull-windows-travel", "fair-points-beg", + "famous-cherries-kick", + "few-seals-matter", "fifty-roses-explain", "gold-pumas-fry", "good-trees-reply", "hot-pugs-nail", "hungry-cups-juggle", + "lemon-gorillas-explain", "little-carpets-argue", "many-cobras-live", "moody-falcons-remain", + "orange-penguins-sneeze", "polite-pets-push", "rude-parrots-know", + "sharp-shirts-count", "smart-berries-accept", "smart-guests-refuse", "thirty-pugs-smile", "twenty-rocks-pull", + "warm-papayas-smile", + "weak-beers-itch", "wild-impalas-smoke" ] } diff --git a/.changeset/sharp-shirts-count.md b/.changeset/sharp-shirts-count.md new file mode 100644 index 000000000..38f28f2e5 --- /dev/null +++ b/.changeset/sharp-shirts-count.md @@ -0,0 +1,5 @@ +--- +'@celo/dev-utils': patch +--- + +Adds actual Celo chain id when running anvil diff --git a/.changeset/warm-papayas-smile.md b/.changeset/warm-papayas-smile.md new file mode 100644 index 000000000..714615872 --- /dev/null +++ b/.changeset/warm-papayas-smile.md @@ -0,0 +1,5 @@ +--- +'@celo/connect': minor +--- + +Now CeloProvider can be wrapped in EIP-1193 partially compatible object (request + args) diff --git a/.changeset/weak-beers-itch.md b/.changeset/weak-beers-itch.md new file mode 100644 index 000000000..c9654affc --- /dev/null +++ b/.changeset/weak-beers-itch.md @@ -0,0 +1,5 @@ +--- +'@celo/governance': patch +--- + +Fix being unable to use 08 and mento contracts with proposal builder diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03ac8102b..5f12fd928 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: - master - changeset-release/master - prerelease/* + - hotfixes pull_request: types: [opened, reopened, synchronize, edited, ready_for_review] diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5c35874d0..5fd95d32b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,9 +3,8 @@ name: Release Packages on: push: branches: - - main - master - - 'prerelease/*' + - hotfixes concurrency: ${{ github.workflow }}-${{ github.ref }} diff --git a/docs/command-line-interface/governance.md b/docs/command-line-interface/governance.md index 90c12732f..69f2674b6 100644 --- a/docs/command-line-interface/governance.md +++ b/docs/command-line-interface/governance.md @@ -33,7 +33,7 @@ Approve a dequeued governance proposal (or hotfix) USAGE $ celocli governance:approvehotfix --from 0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d [--gasCurrency 0x1234567890123456789012345678901234567890] [--globalHelp] - [--proposalID | --hotfix ] [--useMultiSig] [--type + [--proposalID | --hotfix ] [--useMultiSig | --useSafe] [--type approver|securityCouncil ] FLAGS @@ -55,6 +55,8 @@ FLAGS approver|securityCouncil> --useMultiSig True means the request will be sent through multisig. + --useSafe True means the request will + be sent through safe. DESCRIPTION Approve a dequeued governance proposal (or hotfix) diff --git a/docs/sdk/connect/classes/celo_provider.CeloProvider.md b/docs/sdk/connect/classes/celo_provider.CeloProvider.md index 2f313f62a..8aa763c5f 100644 --- a/docs/sdk/connect/classes/celo_provider.CeloProvider.md +++ b/docs/sdk/connect/classes/celo_provider.CeloProvider.md @@ -32,6 +32,7 @@ - [send](celo_provider.CeloProvider.md#send) - [stop](celo_provider.CeloProvider.md#stop) - [supportsSubscriptions](celo_provider.CeloProvider.md#supportssubscriptions) +- [toEip1193Provider](celo_provider.CeloProvider.md#toeip1193provider) ## Constructors @@ -52,7 +53,7 @@ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:54](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L54) +[packages/sdk/connect/src/celo-provider.ts:56](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L56) ## Properties @@ -62,7 +63,7 @@ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:54](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L54) +[packages/sdk/connect/src/celo-provider.ts:56](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L56) ___ @@ -72,7 +73,7 @@ ___ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:54](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L54) +[packages/sdk/connect/src/celo-provider.ts:56](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L56) ## Accessors @@ -86,7 +87,7 @@ ___ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:261](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L261) +[packages/sdk/connect/src/celo-provider.ts:287](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L287) ## Methods @@ -106,7 +107,7 @@ ___ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:59](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L59) +[packages/sdk/connect/src/celo-provider.ts:61](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L61) ___ @@ -120,7 +121,7 @@ ___ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:69](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L69) +[packages/sdk/connect/src/celo-provider.ts:71](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L71) ___ @@ -140,7 +141,7 @@ ___ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:73](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L73) +[packages/sdk/connect/src/celo-provider.ts:75](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L75) ___ @@ -160,7 +161,7 @@ ___ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:64](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L64) +[packages/sdk/connect/src/celo-provider.ts:66](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L66) ___ @@ -187,7 +188,7 @@ Send method as expected by web3.js #### Defined in -[packages/sdk/connect/src/celo-provider.ts:80](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L80) +[packages/sdk/connect/src/celo-provider.ts:82](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L82) ___ @@ -201,7 +202,7 @@ ___ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:159](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L159) +[packages/sdk/connect/src/celo-provider.ts:161](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L161) ___ @@ -215,4 +216,18 @@ ___ #### Defined in -[packages/sdk/connect/src/celo-provider.ts:265](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L265) +[packages/sdk/connect/src/celo-provider.ts:291](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L291) + +___ + +### toEip1193Provider + +▸ **toEip1193Provider**(): [`Eip1193Provider`](../interfaces/types.Eip1193Provider.md) + +#### Returns + +[`Eip1193Provider`](../interfaces/types.Eip1193Provider.md) + +#### Defined in + +[packages/sdk/connect/src/celo-provider.ts:173](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L173) diff --git a/docs/sdk/connect/interfaces/types.Eip1193Provider.md b/docs/sdk/connect/interfaces/types.Eip1193Provider.md new file mode 100644 index 000000000..bfa7c16f8 --- /dev/null +++ b/docs/sdk/connect/interfaces/types.Eip1193Provider.md @@ -0,0 +1,31 @@ +[@celo/connect](../README.md) / [Exports](../modules.md) / [types](../modules/types.md) / Eip1193Provider + +# Interface: Eip1193Provider + +[types](../modules/types.md).Eip1193Provider + +## Table of contents + +### Methods + +- [request](types.Eip1193Provider.md#request) + +## Methods + +### request + +▸ **request**(`args`): `Promise`\<`unknown`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `args` | [`Eip1193RequestArguments`](types.Eip1193RequestArguments.md) | + +#### Returns + +`Promise`\<`unknown`\> + +#### Defined in + +[packages/sdk/connect/src/types.ts:158](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/types.ts#L158) diff --git a/docs/sdk/connect/interfaces/types.Eip1193RequestArguments.md b/docs/sdk/connect/interfaces/types.Eip1193RequestArguments.md new file mode 100644 index 000000000..c2a60c430 --- /dev/null +++ b/docs/sdk/connect/interfaces/types.Eip1193RequestArguments.md @@ -0,0 +1,32 @@ +[@celo/connect](../README.md) / [Exports](../modules.md) / [types](../modules/types.md) / Eip1193RequestArguments + +# Interface: Eip1193RequestArguments + +[types](../modules/types.md).Eip1193RequestArguments + +## Table of contents + +### Properties + +- [method](types.Eip1193RequestArguments.md#method) +- [params](types.Eip1193RequestArguments.md#params) + +## Properties + +### method + +• `Readonly` **method**: `string` + +#### Defined in + +[packages/sdk/connect/src/types.ts:153](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/types.ts#L153) + +___ + +### params + +• `Optional` `Readonly` **params**: `object` \| readonly `unknown`[] + +#### Defined in + +[packages/sdk/connect/src/types.ts:154](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/types.ts#L154) diff --git a/docs/sdk/connect/modules/celo_provider.md b/docs/sdk/connect/modules/celo_provider.md index e10e08a1f..cb1f48557 100644 --- a/docs/sdk/connect/modules/celo_provider.md +++ b/docs/sdk/connect/modules/celo_provider.md @@ -30,4 +30,4 @@ asserts provider is CeloProvider #### Defined in -[packages/sdk/connect/src/celo-provider.ts:35](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L35) +[packages/sdk/connect/src/celo-provider.ts:37](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/connect/src/celo-provider.ts#L37) diff --git a/docs/sdk/connect/modules/index.md b/docs/sdk/connect/modules/index.md index 0d8dc7b92..d095c7b2f 100644 --- a/docs/sdk/connect/modules/index.md +++ b/docs/sdk/connect/modules/index.md @@ -30,6 +30,8 @@ - [DecodedParamsArray](index.md#decodedparamsarray) - [DecodedParamsObject](index.md#decodedparamsobject) - [EIP1559TXProperties](index.md#eip1559txproperties) +- [Eip1193Provider](index.md#eip1193provider) +- [Eip1193RequestArguments](index.md#eip1193requestarguments) - [EncodedTransaction](index.md#encodedtransaction) - [Error](index.md#error) - [EthereumLegacyTXProperties](index.md#ethereumlegacytxproperties) @@ -226,6 +228,18 @@ Re-exports [EIP1559TXProperties](../interfaces/types.EIP1559TXProperties.md) ___ +### Eip1193Provider + +Re-exports [Eip1193Provider](../interfaces/types.Eip1193Provider.md) + +___ + +### Eip1193RequestArguments + +Re-exports [Eip1193RequestArguments](../interfaces/types.Eip1193RequestArguments.md) + +___ + ### EncodedTransaction Re-exports [EncodedTransaction](../interfaces/types.EncodedTransaction.md) diff --git a/docs/sdk/connect/modules/types.md b/docs/sdk/connect/modules/types.md index 65631debf..141edea0a 100644 --- a/docs/sdk/connect/modules/types.md +++ b/docs/sdk/connect/modules/types.md @@ -25,6 +25,8 @@ - [CeloParams](../interfaces/types.CeloParams.md) - [CeloTxObject](../interfaces/types.CeloTxObject.md) - [EIP1559TXProperties](../interfaces/types.EIP1559TXProperties.md) +- [Eip1193Provider](../interfaces/types.Eip1193Provider.md) +- [Eip1193RequestArguments](../interfaces/types.Eip1193RequestArguments.md) - [EncodedTransaction](../interfaces/types.EncodedTransaction.md) - [Error](../interfaces/types.Error.md) - [EthereumLegacyTXProperties](../interfaces/types.EthereumLegacyTXProperties.md) diff --git a/docs/sdk/governance/README.md b/docs/sdk/governance/README.md index 6ffd21158..068a66b4a 100644 --- a/docs/sdk/governance/README.md +++ b/docs/sdk/governance/README.md @@ -7,4 +7,8 @@ ### Modules - [index](modules/index.md) +- [interactive-proposal-builder](modules/interactive_proposal_builder.md) +- [proposal-builder](modules/proposal_builder.md) - [proposals](modules/proposals.md) +- [test-utils/globals](modules/test_utils_globals.md) +- [test-utils/setup.global](modules/test_utils_setup_global.md) diff --git a/docs/sdk/governance/classes/interactive_proposal_builder.InteractiveProposalBuilder.md b/docs/sdk/governance/classes/interactive_proposal_builder.InteractiveProposalBuilder.md new file mode 100644 index 000000000..85a764f72 --- /dev/null +++ b/docs/sdk/governance/classes/interactive_proposal_builder.InteractiveProposalBuilder.md @@ -0,0 +1,64 @@ +[@celo/governance](../README.md) / [interactive-proposal-builder](../modules/interactive_proposal_builder.md) / InteractiveProposalBuilder + +# Class: InteractiveProposalBuilder + +[interactive-proposal-builder](../modules/interactive_proposal_builder.md).InteractiveProposalBuilder + +## Table of contents + +### Constructors + +- [constructor](interactive_proposal_builder.InteractiveProposalBuilder.md#constructor) + +### Methods + +- [outputTransactions](interactive_proposal_builder.InteractiveProposalBuilder.md#outputtransactions) +- [promptTransactions](interactive_proposal_builder.InteractiveProposalBuilder.md#prompttransactions) + +## Constructors + +### constructor + +• **new InteractiveProposalBuilder**(`builder`): [`InteractiveProposalBuilder`](interactive_proposal_builder.InteractiveProposalBuilder.md) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `builder` | [`ProposalBuilder`](proposal_builder.ProposalBuilder.md) | + +#### Returns + +[`InteractiveProposalBuilder`](interactive_proposal_builder.InteractiveProposalBuilder.md) + +#### Defined in + +[packages/sdk/governance/src/interactive-proposal-builder.ts:14](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/interactive-proposal-builder.ts#L14) + +## Methods + +### outputTransactions + +▸ **outputTransactions**(): `Promise`\<`void`\> + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[packages/sdk/governance/src/interactive-proposal-builder.ts:16](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/interactive-proposal-builder.ts#L16) + +___ + +### promptTransactions + +▸ **promptTransactions**(): `Promise`\<[`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md)[]\> + +#### Returns + +`Promise`\<[`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md)[]\> + +#### Defined in + +[packages/sdk/governance/src/interactive-proposal-builder.ts:21](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/interactive-proposal-builder.ts#L21) diff --git a/docs/sdk/governance/classes/proposal_builder.ProposalBuilder.md b/docs/sdk/governance/classes/proposal_builder.ProposalBuilder.md new file mode 100644 index 000000000..1eb980adb --- /dev/null +++ b/docs/sdk/governance/classes/proposal_builder.ProposalBuilder.md @@ -0,0 +1,420 @@ +[@celo/governance](../README.md) / [proposal-builder](../modules/proposal_builder.md) / ProposalBuilder + +# Class: ProposalBuilder + +[proposal-builder](../modules/proposal_builder.md).ProposalBuilder + +Builder class to construct proposals from JSON or transaction objects. + +## Table of contents + +### Constructors + +- [constructor](proposal_builder.ProposalBuilder.md#constructor) + +### Properties + +- [buildFunctionCallToExternalContract](proposal_builder.ProposalBuilder.md#buildfunctioncalltoexternalcontract) +- [externalCallProxyRepoint](proposal_builder.ProposalBuilder.md#externalcallproxyrepoint) +- [isRegistered](proposal_builder.ProposalBuilder.md#isregistered) +- [registryAdditions](proposal_builder.ProposalBuilder.md#registryadditions) + +### Methods + +- [addJsonTx](proposal_builder.ProposalBuilder.md#addjsontx) +- [addProxyRepointingTx](proposal_builder.ProposalBuilder.md#addproxyrepointingtx) +- [addTx](proposal_builder.ProposalBuilder.md#addtx) +- [addWeb3Tx](proposal_builder.ProposalBuilder.md#addweb3tx) +- [build](proposal_builder.ProposalBuilder.md#build) +- [buildCallToCoreContract](proposal_builder.ProposalBuilder.md#buildcalltocorecontract) +- [buildCallToExternalContract](proposal_builder.ProposalBuilder.md#buildcalltoexternalcontract) +- [fromJsonTx](proposal_builder.ProposalBuilder.md#fromjsontx) +- [fromWeb3tx](proposal_builder.ProposalBuilder.md#fromweb3tx) +- [getRegistryAddition](proposal_builder.ProposalBuilder.md#getregistryaddition) +- [isRegistryContract](proposal_builder.ProposalBuilder.md#isregistrycontract) +- [lookupExternalMethodABI](proposal_builder.ProposalBuilder.md#lookupexternalmethodabi) +- [setRegistryAddition](proposal_builder.ProposalBuilder.md#setregistryaddition) +- [transformArgs](proposal_builder.ProposalBuilder.md#transformargs) + +## Constructors + +### constructor + +• **new ProposalBuilder**(`kit`, `builders?`, `registryAdditions?`): [`ProposalBuilder`](proposal_builder.ProposalBuilder.md) + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `kit` | `ContractKit` | `undefined` | +| `builders` | () => `Promise`\<`ProposalTransaction`\>[] | `[]` | +| `registryAdditions` | [`RegistryAdditions`](../interfaces/proposals.RegistryAdditions.md) | `{}` | + +#### Returns + +[`ProposalBuilder`](proposal_builder.ProposalBuilder.md) + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:40](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L40) + +## Properties + +### buildFunctionCallToExternalContract + +• **buildFunctionCallToExternalContract**: (`tx`: [`ExternalProposalTransactionJSON`](../modules/proposals.md#externalproposaltransactionjson)) => `Promise`\<`ProposalTransaction`\> + +#### Type declaration + +▸ (`tx`): `Promise`\<`ProposalTransaction`\> + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | [`ExternalProposalTransactionJSON`](../modules/proposals.md#externalproposaltransactionjson) | + +##### Returns + +`Promise`\<`ProposalTransaction`\> + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:182](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L182) + +___ + +### externalCallProxyRepoint + +• **externalCallProxyRepoint**: `Map`\<`string`, `string`\> + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:38](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L38) + +___ + +### isRegistered + +• **isRegistered**: (`contract`: `CeloContract`) => `boolean` + +#### Type declaration + +▸ (`contract`): `boolean` + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `contract` | `CeloContract` | + +##### Returns + +`boolean` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:122](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L122) + +___ + +### registryAdditions + +• `Readonly` **registryAdditions**: [`RegistryAdditions`](../interfaces/proposals.RegistryAdditions.md) = `{}` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:43](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L43) + +## Methods + +### addJsonTx + +▸ **addJsonTx**(`tx`): `number` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md) | + +#### Returns + +`number` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:260](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L260) + +___ + +### addProxyRepointingTx + +▸ **addProxyRepointingTx**(`contract`, `newImplementationAddress`): `void` + +Adds a transaction to set the implementation on a proxy to the given address. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `contract` | `CeloContract` | Celo contract name of the proxy which should have its implementation set. | +| `newImplementationAddress` | `string` | Address of the new contract implementation. | + +#### Returns + +`void` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:74](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L74) + +___ + +### addTx + +▸ **addTx**(`tx`, `params?`): `void` + +Adds a Celo transaction to the list for proposal construction. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tx` | `CeloTransactionObject`\<`any`\> | A Celo transaction object to add to the proposal. | +| `params` | `Partial`\<[`ProposalTxParams`](../modules/proposals.md#proposaltxparams)\> | Optional parameters for how the transaction should be executed. | + +#### Returns + +`void` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:100](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L100) + +___ + +### addWeb3Tx + +▸ **addWeb3Tx**(`tx`, `params`): `number` + +Adds a Web3 transaction to the list for proposal construction. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tx` | `CeloTxObject`\<`any`\> | A Web3 transaction object to add to the proposal. | +| `params` | [`ProposalTxParams`](../modules/proposals.md#proposaltxparams) | Parameters for how the transaction should be executed. | + +#### Returns + +`number` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:92](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L92) + +___ + +### build + +▸ **build**(): `Promise`\<`ProposalTransaction`[]\> + +Build calls all of the added build steps and returns the final proposal. + +#### Returns + +`Promise`\<`ProposalTransaction`[]\> + +A constructed Proposal object (i.e. a list of ProposalTransaction) + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:50](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L50) + +___ + +### buildCallToCoreContract + +▸ **buildCallToCoreContract**(`tx`): `Promise`\<`ProposalTransaction`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md) | + +#### Returns + +`Promise`\<`ProposalTransaction`\> + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:203](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L203) + +___ + +### buildCallToExternalContract + +▸ **buildCallToExternalContract**(`tx`): `Promise`\<`ProposalTransaction`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | [`ExternalProposalTransactionJSON`](../modules/proposals.md#externalproposaltransactionjson) | + +#### Returns + +`Promise`\<`ProposalTransaction`\> + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:146](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L146) + +___ + +### fromJsonTx + +▸ **fromJsonTx**(`tx`): `Promise`\<`ProposalTransaction`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md) \| [`ExternalProposalTransactionJSON`](../modules/proposals.md#externalproposaltransactionjson) | + +#### Returns + +`Promise`\<`ProposalTransaction`\> + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:233](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L233) + +___ + +### fromWeb3tx + +▸ **fromWeb3tx**(`tx`, `params`): `ProposalTransaction` + +Converts a Web3 transaction into a proposal transaction object. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tx` | `CeloTxObject`\<`any`\> | A Web3 transaction object to convert. | +| `params` | [`ProposalTxParams`](../modules/proposals.md#proposaltxparams) | Parameters for how the transaction should be executed. | + +#### Returns + +`ProposalTransaction` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:63](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L63) + +___ + +### getRegistryAddition + +▸ **getRegistryAddition**(`contract`): `undefined` \| `string` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `contract` | `CeloContract` | + +#### Returns + +`undefined` \| `string` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:112](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L112) + +___ + +### isRegistryContract + +▸ **isRegistryContract**(`contract`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `contract` | `CeloContract` | + +#### Returns + +`boolean` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:115](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L115) + +___ + +### lookupExternalMethodABI + +▸ **lookupExternalMethodABI**(`address`, `tx`): `Promise`\<``null`` \| `AbiItem`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `address` | `string` | +| `tx` | [`ExternalProposalTransactionJSON`](../modules/proposals.md#externalproposaltransactionjson) | + +#### Returns + +`Promise`\<``null`` \| `AbiItem`\> + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:124](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L124) + +___ + +### setRegistryAddition + +▸ **setRegistryAddition**(`contract`, `address`): `string` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `contract` | `CeloContract` | +| `address` | `string` | + +#### Returns + +`string` + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:109](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L109) + +___ + +### transformArgs + +▸ **transformArgs**(`abi`, `args`): `any`[] + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `abi` | `AbiItem` | +| `args` | `any`[] | + +#### Returns + +`any`[] + +#### Defined in + +[packages/sdk/governance/src/proposal-builder.ts:184](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposal-builder.ts#L184) diff --git a/docs/sdk/governance/classes/proposals.InteractiveProposalBuilder.md b/docs/sdk/governance/classes/proposals.InteractiveProposalBuilder.md deleted file mode 100644 index d2fe9c299..000000000 --- a/docs/sdk/governance/classes/proposals.InteractiveProposalBuilder.md +++ /dev/null @@ -1,64 +0,0 @@ -[@celo/governance](../README.md) / [proposals](../modules/proposals.md) / InteractiveProposalBuilder - -# Class: InteractiveProposalBuilder - -[proposals](../modules/proposals.md).InteractiveProposalBuilder - -## Table of contents - -### Constructors - -- [constructor](proposals.InteractiveProposalBuilder.md#constructor) - -### Methods - -- [outputTransactions](proposals.InteractiveProposalBuilder.md#outputtransactions) -- [promptTransactions](proposals.InteractiveProposalBuilder.md#prompttransactions) - -## Constructors - -### constructor - -• **new InteractiveProposalBuilder**(`builder`): [`InteractiveProposalBuilder`](proposals.InteractiveProposalBuilder.md) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `builder` | [`ProposalBuilder`](proposals.ProposalBuilder.md) | - -#### Returns - -[`InteractiveProposalBuilder`](proposals.InteractiveProposalBuilder.md) - -#### Defined in - -[proposals.ts:466](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L466) - -## Methods - -### outputTransactions - -▸ **outputTransactions**(): `Promise`\<`void`\> - -#### Returns - -`Promise`\<`void`\> - -#### Defined in - -[proposals.ts:468](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L468) - -___ - -### promptTransactions - -▸ **promptTransactions**(): `Promise`\<[`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md)[]\> - -#### Returns - -`Promise`\<[`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md)[]\> - -#### Defined in - -[proposals.ts:473](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L473) diff --git a/docs/sdk/governance/classes/proposals.ProposalBuilder.md b/docs/sdk/governance/classes/proposals.ProposalBuilder.md deleted file mode 100644 index 5a123e945..000000000 --- a/docs/sdk/governance/classes/proposals.ProposalBuilder.md +++ /dev/null @@ -1,420 +0,0 @@ -[@celo/governance](../README.md) / [proposals](../modules/proposals.md) / ProposalBuilder - -# Class: ProposalBuilder - -[proposals](../modules/proposals.md).ProposalBuilder - -Builder class to construct proposals from JSON or transaction objects. - -## Table of contents - -### Constructors - -- [constructor](proposals.ProposalBuilder.md#constructor) - -### Properties - -- [buildFunctionCallToExternalContract](proposals.ProposalBuilder.md#buildfunctioncalltoexternalcontract) -- [externalCallProxyRepoint](proposals.ProposalBuilder.md#externalcallproxyrepoint) -- [isRegistered](proposals.ProposalBuilder.md#isregistered) -- [registryAdditions](proposals.ProposalBuilder.md#registryadditions) - -### Methods - -- [addJsonTx](proposals.ProposalBuilder.md#addjsontx) -- [addProxyRepointingTx](proposals.ProposalBuilder.md#addproxyrepointingtx) -- [addTx](proposals.ProposalBuilder.md#addtx) -- [addWeb3Tx](proposals.ProposalBuilder.md#addweb3tx) -- [build](proposals.ProposalBuilder.md#build) -- [buildCallToCoreContract](proposals.ProposalBuilder.md#buildcalltocorecontract) -- [buildCallToExternalContract](proposals.ProposalBuilder.md#buildcalltoexternalcontract) -- [fromJsonTx](proposals.ProposalBuilder.md#fromjsontx) -- [fromWeb3tx](proposals.ProposalBuilder.md#fromweb3tx) -- [getRegistryAddition](proposals.ProposalBuilder.md#getregistryaddition) -- [isRegistryContract](proposals.ProposalBuilder.md#isregistrycontract) -- [lookupExternalMethodABI](proposals.ProposalBuilder.md#lookupexternalmethodabi) -- [setRegistryAddition](proposals.ProposalBuilder.md#setregistryaddition) -- [transformArgs](proposals.ProposalBuilder.md#transformargs) - -## Constructors - -### constructor - -• **new ProposalBuilder**(`kit`, `builders?`, `registryAdditions?`): [`ProposalBuilder`](proposals.ProposalBuilder.md) - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `kit` | `ContractKit` | `undefined` | -| `builders` | () => `Promise`\<`ProposalTransaction`\>[] | `[]` | -| `registryAdditions` | `RegistryAdditions` | `{}` | - -#### Returns - -[`ProposalBuilder`](proposals.ProposalBuilder.md) - -#### Defined in - -[proposals.ts:241](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L241) - -## Properties - -### buildFunctionCallToExternalContract - -• **buildFunctionCallToExternalContract**: (`tx`: [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md)) => `Promise`\<`ProposalTransaction`\> - -#### Type declaration - -▸ (`tx`): `Promise`\<`ProposalTransaction`\> - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md) | - -##### Returns - -`Promise`\<`ProposalTransaction`\> - -#### Defined in - -[proposals.ts:384](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L384) - -___ - -### externalCallProxyRepoint - -• **externalCallProxyRepoint**: `Map`\<`string`, `string`\> - -#### Defined in - -[proposals.ts:239](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L239) - -___ - -### isRegistered - -• **isRegistered**: (`contract`: `CeloContract`) => `boolean` - -#### Type declaration - -▸ (`contract`): `boolean` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `contract` | `CeloContract` | - -##### Returns - -`boolean` - -#### Defined in - -[proposals.ts:324](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L324) - -___ - -### registryAdditions - -• `Readonly` **registryAdditions**: `RegistryAdditions` = `{}` - -#### Defined in - -[proposals.ts:244](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L244) - -## Methods - -### addJsonTx - -▸ **addJsonTx**(`tx`): `number` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md) | - -#### Returns - -`number` - -#### Defined in - -[proposals.ts:460](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L460) - -___ - -### addProxyRepointingTx - -▸ **addProxyRepointingTx**(`contract`, `newImplementationAddress`): `void` - -Adds a transaction to set the implementation on a proxy to the given address. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `contract` | `CeloContract` | Celo contract name of the proxy which should have its implementation set. | -| `newImplementationAddress` | `string` | Address of the new contract implementation. | - -#### Returns - -`void` - -#### Defined in - -[proposals.ts:275](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L275) - -___ - -### addTx - -▸ **addTx**(`tx`, `params?`): `void` - -Adds a Celo transaction to the list for proposal construction. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tx` | `CeloTransactionObject`\<`any`\> | A Celo transaction object to add to the proposal. | -| `params` | `Partial`\<`ProposalTxParams`\> | Optional parameters for how the transaction should be executed. | - -#### Returns - -`void` - -#### Defined in - -[proposals.ts:301](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L301) - -___ - -### addWeb3Tx - -▸ **addWeb3Tx**(`tx`, `params`): `number` - -Adds a Web3 transaction to the list for proposal construction. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tx` | `CeloTxObject`\<`any`\> | A Web3 transaction object to add to the proposal. | -| `params` | `ProposalTxParams` | Parameters for how the transaction should be executed. | - -#### Returns - -`number` - -#### Defined in - -[proposals.ts:293](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L293) - -___ - -### build - -▸ **build**(): `Promise`\<`ProposalTransaction`[]\> - -Build calls all of the added build steps and returns the final proposal. - -#### Returns - -`Promise`\<`ProposalTransaction`[]\> - -A constructed Proposal object (i.e. a list of ProposalTransaction) - -#### Defined in - -[proposals.ts:251](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L251) - -___ - -### buildCallToCoreContract - -▸ **buildCallToCoreContract**(`tx`): `Promise`\<`ProposalTransaction`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md) | - -#### Returns - -`Promise`\<`ProposalTransaction`\> - -#### Defined in - -[proposals.ts:405](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L405) - -___ - -### buildCallToExternalContract - -▸ **buildCallToExternalContract**(`tx`): `Promise`\<`ProposalTransaction`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md) | - -#### Returns - -`Promise`\<`ProposalTransaction`\> - -#### Defined in - -[proposals.ts:348](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L348) - -___ - -### fromJsonTx - -▸ **fromJsonTx**(`tx`): `Promise`\<`ProposalTransaction`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `tx` | [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md) | - -#### Returns - -`Promise`\<`ProposalTransaction`\> - -#### Defined in - -[proposals.ts:435](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L435) - -___ - -### fromWeb3tx - -▸ **fromWeb3tx**(`tx`, `params`): `ProposalTransaction` - -Converts a Web3 transaction into a proposal transaction object. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `tx` | `CeloTxObject`\<`any`\> | A Web3 transaction object to convert. | -| `params` | `ProposalTxParams` | Parameters for how the transaction should be executed. | - -#### Returns - -`ProposalTransaction` - -#### Defined in - -[proposals.ts:264](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L264) - -___ - -### getRegistryAddition - -▸ **getRegistryAddition**(`contract`): `undefined` \| `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `contract` | `CeloContract` | - -#### Returns - -`undefined` \| `string` - -#### Defined in - -[proposals.ts:314](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L314) - -___ - -### isRegistryContract - -▸ **isRegistryContract**(`contract`): `boolean` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `contract` | `CeloContract` | - -#### Returns - -`boolean` - -#### Defined in - -[proposals.ts:317](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L317) - -___ - -### lookupExternalMethodABI - -▸ **lookupExternalMethodABI**(`address`, `tx`): `Promise`\<``null`` \| `AbiItem`\> - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `address` | `string` | -| `tx` | [`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md) | - -#### Returns - -`Promise`\<``null`` \| `AbiItem`\> - -#### Defined in - -[proposals.ts:326](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L326) - -___ - -### setRegistryAddition - -▸ **setRegistryAddition**(`contract`, `address`): `string` - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `contract` | `CeloContract` | -| `address` | `string` | - -#### Returns - -`string` - -#### Defined in - -[proposals.ts:311](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L311) - -___ - -### transformArgs - -▸ **transformArgs**(`abi`, `args`): `any`[] - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `abi` | `AbiItem` | -| `args` | `any`[] | - -#### Returns - -`any`[] - -#### Defined in - -[proposals.ts:386](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L386) diff --git a/docs/sdk/governance/interfaces/proposals.ProposalTransactionJSON.md b/docs/sdk/governance/interfaces/proposals.ProposalTransactionJSON.md index 9233d2915..d334a431a 100644 --- a/docs/sdk/governance/interfaces/proposals.ProposalTransactionJSON.md +++ b/docs/sdk/governance/interfaces/proposals.ProposalTransactionJSON.md @@ -35,7 +35,7 @@ Example: #### Defined in -[proposals.ts:75](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L75) +[packages/sdk/governance/src/proposals.ts:55](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L55) ___ @@ -45,7 +45,7 @@ ___ #### Defined in -[proposals.ts:77](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L77) +[packages/sdk/governance/src/proposals.ts:57](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L57) ___ @@ -55,7 +55,7 @@ ___ #### Defined in -[proposals.ts:74](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L74) +[packages/sdk/governance/src/proposals.ts:54](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L54) ___ @@ -65,7 +65,7 @@ ___ #### Defined in -[proposals.ts:76](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L76) +[packages/sdk/governance/src/proposals.ts:56](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L56) ___ @@ -75,7 +75,7 @@ ___ #### Defined in -[proposals.ts:78](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L78) +[packages/sdk/governance/src/proposals.ts:58](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L58) ___ @@ -85,4 +85,4 @@ ___ #### Defined in -[proposals.ts:79](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L79) +[packages/sdk/governance/src/proposals.ts:59](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L59) diff --git a/docs/sdk/governance/interfaces/proposals.RegistryAdditions.md b/docs/sdk/governance/interfaces/proposals.RegistryAdditions.md new file mode 100644 index 000000000..39e273bfc --- /dev/null +++ b/docs/sdk/governance/interfaces/proposals.RegistryAdditions.md @@ -0,0 +1,9 @@ +[@celo/governance](../README.md) / [proposals](../modules/proposals.md) / RegistryAdditions + +# Interface: RegistryAdditions + +[proposals](../modules/proposals.md).RegistryAdditions + +## Indexable + +▪ [contractName: `string`]: `Address` diff --git a/docs/sdk/governance/modules/index.md b/docs/sdk/governance/modules/index.md index 2febc3f60..c011a1753 100644 --- a/docs/sdk/governance/modules/index.md +++ b/docs/sdk/governance/modules/index.md @@ -6,25 +6,39 @@ ### References +- [ExternalProposalTransactionJSON](index.md#externalproposaltransactionjson) - [InteractiveProposalBuilder](index.md#interactiveproposalbuilder) - [ProposalBuilder](index.md#proposalbuilder) - [ProposalTransactionJSON](index.md#proposaltransactionjson) +- [ProposalTxParams](index.md#proposaltxparams) +- [RegistryAdditions](index.md#registryadditions) +- [debug](index.md#debug) - [hotfixExecuteAbi](index.md#hotfixexecuteabi) - [hotfixToEncodedParams](index.md#hotfixtoencodedparams) - [hotfixToHash](index.md#hotfixtohash) +- [isProxySetAndInitFunction](index.md#isproxysetandinitfunction) +- [isProxySetFunction](index.md#isproxysetfunction) +- [isRegistryRepoint](index.md#isregistryrepoint) - [proposalToJSON](index.md#proposaltojson) +- [registryRepointArgs](index.md#registryrepointargs) ## References +### ExternalProposalTransactionJSON + +Re-exports [ExternalProposalTransactionJSON](proposals.md#externalproposaltransactionjson) + +___ + ### InteractiveProposalBuilder -Re-exports [InteractiveProposalBuilder](../classes/proposals.InteractiveProposalBuilder.md) +Re-exports [InteractiveProposalBuilder](../classes/interactive_proposal_builder.InteractiveProposalBuilder.md) ___ ### ProposalBuilder -Re-exports [ProposalBuilder](../classes/proposals.ProposalBuilder.md) +Re-exports [ProposalBuilder](../classes/proposal_builder.ProposalBuilder.md) ___ @@ -34,6 +48,24 @@ Re-exports [ProposalTransactionJSON](../interfaces/proposals.ProposalTransaction ___ +### ProposalTxParams + +Re-exports [ProposalTxParams](proposals.md#proposaltxparams) + +___ + +### RegistryAdditions + +Re-exports [RegistryAdditions](../interfaces/proposals.RegistryAdditions.md) + +___ + +### debug + +Re-exports [debug](proposals.md#debug) + +___ + ### hotfixExecuteAbi Re-exports [hotfixExecuteAbi](proposals.md#hotfixexecuteabi) @@ -52,6 +84,30 @@ Re-exports [hotfixToHash](proposals.md#hotfixtohash) ___ +### isProxySetAndInitFunction + +Re-exports [isProxySetAndInitFunction](proposals.md#isproxysetandinitfunction) + +___ + +### isProxySetFunction + +Re-exports [isProxySetFunction](proposals.md#isproxysetfunction) + +___ + +### isRegistryRepoint + +Re-exports [isRegistryRepoint](proposals.md#isregistryrepoint) + +___ + ### proposalToJSON Re-exports [proposalToJSON](proposals.md#proposaltojson) + +___ + +### registryRepointArgs + +Re-exports [registryRepointArgs](proposals.md#registryrepointargs) diff --git a/docs/sdk/governance/modules/interactive_proposal_builder.md b/docs/sdk/governance/modules/interactive_proposal_builder.md new file mode 100644 index 000000000..7f70f22a3 --- /dev/null +++ b/docs/sdk/governance/modules/interactive_proposal_builder.md @@ -0,0 +1,33 @@ +[@celo/governance](../README.md) / interactive-proposal-builder + +# Module: interactive-proposal-builder + +## Table of contents + +### Classes + +- [InteractiveProposalBuilder](../classes/interactive_proposal_builder.InteractiveProposalBuilder.md) + +### Functions + +- [requireABI](interactive_proposal_builder.md#requireabi) + +## Functions + +### requireABI + +▸ **requireABI**(`contractName`): `ABIDefinition`[] + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `contractName` | `CeloContract` | + +#### Returns + +`ABIDefinition`[] + +#### Defined in + +[packages/sdk/governance/src/interactive-proposal-builder.ts:122](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/interactive-proposal-builder.ts#L122) diff --git a/docs/sdk/governance/modules/proposal_builder.md b/docs/sdk/governance/modules/proposal_builder.md new file mode 100644 index 000000000..dcc760823 --- /dev/null +++ b/docs/sdk/governance/modules/proposal_builder.md @@ -0,0 +1,9 @@ +[@celo/governance](../README.md) / proposal-builder + +# Module: proposal-builder + +## Table of contents + +### Classes + +- [ProposalBuilder](../classes/proposal_builder.ProposalBuilder.md) diff --git a/docs/sdk/governance/modules/proposals.md b/docs/sdk/governance/modules/proposals.md index a52a9de4f..72e417ef7 100644 --- a/docs/sdk/governance/modules/proposals.md +++ b/docs/sdk/governance/modules/proposals.md @@ -4,14 +4,20 @@ ## Table of contents -### Classes +### References -- [InteractiveProposalBuilder](../classes/proposals.InteractiveProposalBuilder.md) -- [ProposalBuilder](../classes/proposals.ProposalBuilder.md) +- [InteractiveProposalBuilder](proposals.md#interactiveproposalbuilder) +- [ProposalBuilder](proposals.md#proposalbuilder) ### Interfaces - [ProposalTransactionJSON](../interfaces/proposals.ProposalTransactionJSON.md) +- [RegistryAdditions](../interfaces/proposals.RegistryAdditions.md) + +### Type Aliases + +- [ExternalProposalTransactionJSON](proposals.md#externalproposaltransactionjson) +- [ProposalTxParams](proposals.md#proposaltxparams) ### Variables @@ -19,9 +25,46 @@ ### Functions +- [debug](proposals.md#debug) - [hotfixToEncodedParams](proposals.md#hotfixtoencodedparams) - [hotfixToHash](proposals.md#hotfixtohash) +- [isProxySetAndInitFunction](proposals.md#isproxysetandinitfunction) +- [isProxySetFunction](proposals.md#isproxysetfunction) +- [isRegistryRepoint](proposals.md#isregistryrepoint) - [proposalToJSON](proposals.md#proposaltojson) +- [registryRepointArgs](proposals.md#registryrepointargs) + +## References + +### InteractiveProposalBuilder + +Re-exports [InteractiveProposalBuilder](../classes/interactive_proposal_builder.InteractiveProposalBuilder.md) + +___ + +### ProposalBuilder + +Re-exports [ProposalBuilder](../classes/proposal_builder.ProposalBuilder.md) + +## Type Aliases + +### ExternalProposalTransactionJSON + +Ƭ **ExternalProposalTransactionJSON**: `Omit`\<[`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md), ``"contract"``\> & \{ `contract?`: `string` } + +#### Defined in + +[packages/sdk/governance/src/proposals.ts:62](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L62) + +___ + +### ProposalTxParams + +Ƭ **ProposalTxParams**: `Pick`\<`ProposalTransaction`, ``"to"`` \| ``"value"``\> + +#### Defined in + +[packages/sdk/governance/src/proposals.ts:218](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L218) ## Variables @@ -31,10 +74,31 @@ #### Defined in -[proposals.ts:49](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L49) +[packages/sdk/governance/src/proposals.ts:29](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L29) ## Functions +### debug + +▸ **debug**(`formatter`, `...args`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `formatter` | `any` | +| `...args` | `any`[] | + +#### Returns + +`void` + +#### Defined in + +[packages/sdk/governance/src/proposals.ts:27](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L27) + +___ + ### hotfixToEncodedParams ▸ **hotfixToEncodedParams**(`kit`, `proposal`, `salt`): `string` @@ -53,7 +117,7 @@ #### Defined in -[proposals.ts:51](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L51) +[packages/sdk/governance/src/proposals.ts:31](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L31) ___ @@ -75,7 +139,67 @@ ___ #### Defined in -[proposals.ts:57](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L57) +[packages/sdk/governance/src/proposals.ts:37](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L37) + +___ + +### isProxySetAndInitFunction + +▸ **isProxySetAndInitFunction**(`tx`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | `Pick`\<[`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md), ``"function"``\> | + +#### Returns + +`boolean` + +#### Defined in + +[packages/sdk/governance/src/proposals.ts:103](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L103) + +___ + +### isProxySetFunction + +▸ **isProxySetFunction**(`tx`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | `Pick`\<[`ProposalTransactionJSON`](../interfaces/proposals.ProposalTransactionJSON.md), ``"function"``\> | + +#### Returns + +`boolean` + +#### Defined in + +[packages/sdk/governance/src/proposals.ts:106](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L106) + +___ + +### isRegistryRepoint + +▸ **isRegistryRepoint**(`tx`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | `Pick`\<[`ExternalProposalTransactionJSON`](proposals.md#externalproposaltransactionjson), ``"function"`` \| ``"contract"``\> | + +#### Returns + +`boolean` + +#### Defined in + +[packages/sdk/governance/src/proposals.ts:66](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L66) ___ @@ -91,7 +215,7 @@ Convert a compiled proposal to a human-readable JSON form using network informat | :------ | :------ | :------ | | `kit` | `ContractKit` | Contract kit instance used to resolve addresses to contract names. | | `proposal` | `Proposal` | A constructed proposal object. | -| `registryAdditions?` | `RegistryAdditions` | Registry remappings prior to parsing the proposal as a map of name to corresponding contract address. | +| `registryAdditions?` | [`RegistryAdditions`](../interfaces/proposals.RegistryAdditions.md) | Registry remappings prior to parsing the proposal as a map of name to corresponding contract address. | #### Returns @@ -101,4 +225,29 @@ The JSON encoding of the proposal. #### Defined in -[proposals.ts:128](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L128) +[packages/sdk/governance/src/proposals.ts:116](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L116) + +___ + +### registryRepointArgs + +▸ **registryRepointArgs**(`tx`): `Object` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tx` | `Pick`\<[`ExternalProposalTransactionJSON`](proposals.md#externalproposaltransactionjson), ``"function"`` \| ``"contract"`` \| ``"args"``\> | + +#### Returns + +`Object` + +| Name | Type | +| :------ | :------ | +| `address` | `string` | +| `name` | `CeloContract` | + +#### Defined in + +[packages/sdk/governance/src/proposals.ts:74](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/proposals.ts#L74) diff --git a/docs/sdk/governance/modules/test_utils_globals.md b/docs/sdk/governance/modules/test_utils_globals.md new file mode 100644 index 000000000..03db95b85 --- /dev/null +++ b/docs/sdk/governance/modules/test_utils_globals.md @@ -0,0 +1,19 @@ +[@celo/governance](../README.md) / test-utils/globals + +# Module: test-utils/globals + +## Table of contents + +### Variables + +- [fetchMock](test_utils_globals.md#fetchmock) + +## Variables + +### fetchMock + +• `Const` **fetchMock**: `FetchMockSandbox` + +#### Defined in + +[packages/sdk/governance/src/test-utils/globals.d.ts:5](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/test-utils/globals.d.ts#L5) diff --git a/docs/sdk/governance/modules/test_utils_setup_global.md b/docs/sdk/governance/modules/test_utils_setup_global.md new file mode 100644 index 000000000..4c05fa4f0 --- /dev/null +++ b/docs/sdk/governance/modules/test_utils_setup_global.md @@ -0,0 +1,23 @@ +[@celo/governance](../README.md) / test-utils/setup.global + +# Module: test-utils/setup.global + +## Table of contents + +### Functions + +- [default](test_utils_setup_global.md#default) + +## Functions + +### default + +▸ **default**(): `Promise`\<`void`\> + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[packages/sdk/governance/src/test-utils/setup.global.ts:4](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/governance/src/test-utils/setup.global.ts#L4) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 5de96be9a..e70abef54 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 6.0.0-beta.3 + +### Minor Changes + +- [#420](https://github.com/celo-org/developer-tooling/pull/420) [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444) Thanks [@shazarre](https://github.com/shazarre)! - Adds support for safe integration for L2 hotfix security council approvals + +- [#429](https://github.com/celo-org/developer-tooling/pull/429) [`5b02036`](https://github.com/celo-org/developer-tooling/commit/5b0203634e14697ffbe1e93491bf7c35bbf1ef52) Thanks [@shazarre](https://github.com/shazarre)! - Removes L2 BLS keys support for account:authorize + +### Patch Changes + +- [#421](https://github.com/celo-org/developer-tooling/pull/421) [`7d42a05`](https://github.com/celo-org/developer-tooling/commit/7d42a059f1effa8953ee1fe2e66f7e26bca73181) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - fix governance:build-proposal with contracts from mento or which use solidity 0.8 + +- Updated dependencies [[`7d42a05`](https://github.com/celo-org/developer-tooling/commit/7d42a059f1effa8953ee1fe2e66f7e26bca73181), [`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3), [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444), [`7d42a05`](https://github.com/celo-org/developer-tooling/commit/7d42a059f1effa8953ee1fe2e66f7e26bca73181)]: + - @celo/governance@5.1.4-beta.1 + - @celo/wallet-hsm-azure@6.0.3-beta.1 + - @celo/wallet-ledger@6.0.3-beta.1 + - @celo/wallet-local@6.0.3-beta.1 + - @celo/connect@6.1.0-beta.1 + - @celo/contractkit@9.0.0-beta.2 + - @celo/explorer@5.0.13-beta.1 + ## 6.0.0-beta.2 ### Patch Changes @@ -73,6 +94,19 @@ - @celo/wallet-hsm-azure@6.0.2-beta.0 - @celo/wallet-local@6.0.2-beta.0 +## 5.2.2 + +### Patch Changes + +- [#396](https://github.com/celo-org/developer-tooling/pull/396) [`d58929c`](https://github.com/celo-org/developer-tooling/commit/d58929c5160b334cb91b109645381aa49fa76011) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Fix incorrect message where the transfered token was used as gas token in the messaging but not in actuality + +- [#396](https://github.com/celo-org/developer-tooling/pull/396) [`d58929c`](https://github.com/celo-org/developer-tooling/commit/d58929c5160b334cb91b109645381aa49fa76011) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Fix Transfering, exchanging cusd (and other fee tokens) and or using gasCurrency flag with ledger devices prior to 1.2 + +- Updated dependencies [[`d58929c`](https://github.com/celo-org/developer-tooling/commit/d58929c5160b334cb91b109645381aa49fa76011)]: + - @celo/wallet-ledger@6.0.2 + - @celo/wallet-hsm-azure@6.0.2 + - @celo/wallet-local@6.0.2 + ## 5.2.1 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 2d1f450bb..74023d59e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "name": "@celo/celocli", "description": "CLI Tool for transacting with the Celo protocol", - "version": "6.0.0-beta.2", + "version": "6.0.0-beta.3", "author": "Celo", "license": "Apache-2.0", "repository": "celo-org/developer-tooling", @@ -40,18 +40,18 @@ "@celo/abis": "11.0.0", "@celo/base": "^7.0.0-beta.0", "@celo/compliance": "~1.0.23", - "@celo/connect": "^6.0.3-beta.0", - "@celo/contractkit": "^9.0.0-beta.1", + "@celo/connect": "^6.1.0-beta.1", + "@celo/contractkit": "^9.0.0-beta.2", "@celo/cryptographic-utils": "^5.1.1-beta.0", - "@celo/explorer": "^5.0.13-beta.0", - "@celo/governance": "^5.1.4-beta.0", + "@celo/explorer": "^5.0.13-beta.1", + "@celo/governance": "^5.1.4-beta.1", "@celo/identity": "^5.1.2", "@celo/metadata-claims": "^1.0.0-beta.0", "@celo/phone-utils": "^6.0.4-beta.0", "@celo/utils": "^8.0.0-beta.0", - "@celo/wallet-hsm-azure": "^6.0.2-beta.2", - "@celo/wallet-ledger": "^6.0.2-beta.2", - "@celo/wallet-local": "^6.0.2-beta.2", + "@celo/wallet-hsm-azure": "^6.0.4-beta.0", + "@celo/wallet-ledger": "^6.0.4-beta.0", + "@celo/wallet-local": "^6.0.4-beta.0", "@ethereumjs/util": "8.0.5", "@ledgerhq/hw-transport-node-hid": "^6.28.5", "@mento-protocol/mento-sdk": "^1.0.1", @@ -62,6 +62,8 @@ "@oclif/plugin-not-found": "^3.2.15", "@oclif/plugin-plugins": "^4.3.10", "@oclif/plugin-warn-if-update-available": "^3.1.11", + "@safe-global/protocol-kit": "^5.0.4", + "@safe-global/types-kit": "^1.0.0", "@types/command-exists": "^1.2.3", "bignumber.js": "9.0.0", "chalk": "^2.4.2", @@ -79,7 +81,7 @@ }, "devDependencies": { "@celo/celo-devchain": "^7.0.0", - "@celo/dev-utils": "0.0.6-beta.1", + "@celo/dev-utils": "0.0.7-beta.1", "@celo/typescript": "workspace:^", "@types/debug": "^4.1.4", "@types/fs-extra": "^8.0.0", diff --git a/packages/cli/src/commands/account/authorize-l2.test.ts b/packages/cli/src/commands/account/authorize-l2.test.ts index b024593d7..01de9a477 100644 --- a/packages/cli/src/commands/account/authorize-l2.test.ts +++ b/packages/cli/src/commands/account/authorize-l2.test.ts @@ -28,6 +28,8 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) + logMock.mockClear() + await testLocallyWithWeb3Node( Authorize, [ @@ -42,23 +44,9 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { ], web3 ) + expect(stripAnsiCodesFromNestedArray(logMock.mock.calls)).toMatchInlineSnapshot(` [ - [ - "Running Checks:", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not a registered Account ", - ], - [ - "All checks passed", - ], - [ - "SendTransaction: register", - ], - [ - "txHash: 0xtxhash", - ], [ "Running Checks:", ], @@ -84,6 +72,9 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { const signerNotRegisteredAccount = accounts[1] await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) + + logMock.mockClear() + await testLocallyWithWeb3Node( Authorize, [ @@ -98,23 +89,9 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { ], web3 ) + expect(stripAnsiCodesFromNestedArray(logMock.mock.calls)).toMatchInlineSnapshot(` [ - [ - "Running Checks:", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not a registered Account ", - ], - [ - "All checks passed", - ], - [ - "SendTransaction: register", - ], - [ - "txHash: 0xtxhash", - ], [ "Running Checks:", ], @@ -140,6 +117,9 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { const signerNotRegisteredAccount = accounts[1] await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) + + logMock.mockClear() + await testLocallyWithWeb3Node( Authorize, [ @@ -154,32 +134,15 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { ], web3 ) + expect(stripAnsiCodesFromNestedArray(logMock.mock.calls)).toMatchInlineSnapshot(` [ - [ - "Running Checks:", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not a registered Account ", - ], - [ - "All checks passed", - ], - [ - "SendTransaction: register", - ], - [ - "txHash: 0xtxhash", - ], [ "Running Checks:", ], [ " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is a registered Account ", ], - [ - " ✔ undefined is not a registered Validator ", - ], [ "All checks passed", ], @@ -194,13 +157,10 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { expect(stripAnsiCodesFromNestedArray(errorMock.mock.calls)).toMatchInlineSnapshot(`[]`) }) - // TODO figure out how we tackle this failure - test.failing('can authorize validator signer after validator is registered', async () => { + it('can authorize validator signer after validator is registered', async () => { const accounts = await web3.eth.getAccounts() const notRegisteredAccount = accounts[0] const signerNotRegisteredAccount = accounts[1] - const newBlsPublicKey = web3.utils.randomHex(96) - const newBlsPoP = web3.utils.randomHex(48) const ecdsaPublicKey = await addressToPublicKey(notRegisteredAccount, web3.eth.sign) await testLocallyWithWeb3Node(Register, ['--from', notRegisteredAccount], web3) await testLocallyWithWeb3Node( @@ -210,20 +170,12 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { ) await testLocallyWithWeb3Node( ValidatorRegister, - [ - '--from', - notRegisteredAccount, - '--ecdsaKey', - ecdsaPublicKey, - '--blsKey', - '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', - '--blsSignature', - '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', - '--yes', - ], + ['--from', notRegisteredAccount, '--ecdsaKey', ecdsaPublicKey, '--yes'], web3 ) + logMock.mockClear() + await testLocallyWithWeb3Node( Authorize, [ @@ -235,17 +187,32 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { signerNotRegisteredAccount, '--signature', PROOF_OF_POSSESSION_SIGNATURE, - '--blsKey', - newBlsPublicKey, - '--blsPop', - newBlsPoP, ], web3 ) - expect(stripAnsiCodesFromNestedArray(logMock.mock.calls)).toMatchInlineSnapshot() + + expect(stripAnsiCodesFromNestedArray(logMock.mock.calls)).toMatchInlineSnapshot(` + [ + [ + "Running Checks:", + ], + [ + " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is a registered Account ", + ], + [ + "All checks passed", + ], + [ + "SendTransaction: authorizeTx", + ], + [ + "txHash: 0xtxhash", + ], + ] + `) }) - test('cannot authorize validator signer without BLS after validator is registered', async () => { + it('fails when using BLS keys on L2', async () => { const accounts = await web3.eth.getAccounts() const notRegisteredAccount = accounts[0] const signerNotRegisteredAccount = accounts[1] @@ -258,19 +225,12 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { ) await testLocallyWithWeb3Node( ValidatorRegister, - [ - '--from', - notRegisteredAccount, - '--ecdsaKey', - ecdsaPublicKey, - '--blsKey', - '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', - '--blsSignature', - '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', - '--yes', - ], + ['--from', notRegisteredAccount, '--ecdsaKey', ecdsaPublicKey, '--yes'], web3 ) + + logMock.mockClear() + await expect( testLocallyWithWeb3Node( Authorize, @@ -283,97 +243,17 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { signerNotRegisteredAccount, '--signature', PROOF_OF_POSSESSION_SIGNATURE, + '--blsKey', + '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', + '--blsPop', + '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', ], web3 ) - ).rejects.toThrowErrorMatchingInlineSnapshot(`"Some checks didn't pass!"`) - expect(stripAnsiCodesFromNestedArray(errorMock.mock.calls)).toMatchInlineSnapshot(`[]`) - expect(stripAnsiCodesFromNestedArray(logMock.mock.calls)).toMatchInlineSnapshot(` - [ - [ - "Running Checks:", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not a registered Account ", - ], - [ - "All checks passed", - ], - [ - "SendTransaction: register", - ], - [ - "txHash: 0xtxhash", - ], - [ - "Running Checks:", - ], - [ - " ✔ Value [10000000000000000000000] is > 0 ", - ], - [ - "All checks passed", - ], - [ - "Running Checks:", - ], - [ - " ✔ Account has at least 10000 CELO ", - ], - [ - "All checks passed", - ], - [ - "SendTransaction: lock", - ], - [ - "txHash: 0xtxhash", - ], - [ - "Running Checks:", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is Signer or registered Account ", - ], - [ - " ✔ Signer can sign Validator Txs ", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not a registered Validator ", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not a registered ValidatorGroup ", - ], - [ - " ✔ Signer's account has enough locked celo for registration ", - ], - [ - "All checks passed", - ], - [ - "SendTransaction: registerValidator", - ], - [ - "txHash: 0xtxhash", - ], - [ - "SendTransaction: Set encryption key", - ], - [ - "txHash: 0xtxhash", - ], - [ - "Running Checks:", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is a registered Account ", - ], - [ - " ✘ undefined is not a registered Validator ", - ], - ] - `) + ).rejects.toMatchInlineSnapshot(`[Error: BLS keys are not supported on L2]`) + + expect(stripAnsiCodesFromNestedArray(logMock.mock.calls)).toMatchInlineSnapshot(`[]`) }) test('can force authorize validator signer without BLS after validator is registered', async () => { @@ -389,19 +269,12 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { ) await testLocallyWithWeb3Node( ValidatorRegister, - [ - '--from', - notRegisteredAccount, - '--ecdsaKey', - ecdsaPublicKey, - '--blsKey', - '0x4fa3f67fc913878b068d1fa1cdddc54913d3bf988dbe5a36a20fa888f20d4894c408a6773f3d7bde11154f2a3076b700d345a42fd25a0e5e83f4db5586ac7979ac2053cd95d8f2efd3e959571ceccaa743e02cf4be3f5d7aaddb0b06fc9aff00', - '--blsSignature', - '0xcdb77255037eb68897cd487fdd85388cbda448f617f874449d4b11588b0b7ad8ddc20d9bb450b513bb35664ea3923900', - '--yes', - ], + ['--from', notRegisteredAccount, '--ecdsaKey', ecdsaPublicKey, '--yes'], web3 ) + + logMock.mockClear() + await testLocallyWithWeb3Node( Authorize, [ @@ -420,78 +293,6 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { expect(stripAnsiCodesFromNestedArray(errorMock.mock.calls)).toMatchInlineSnapshot(`[]`) expect(stripAnsiCodesFromNestedArray(logMock.mock.calls)).toMatchInlineSnapshot(` [ - [ - "Running Checks:", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not a registered Account ", - ], - [ - "All checks passed", - ], - [ - "SendTransaction: register", - ], - [ - "txHash: 0xtxhash", - ], - [ - "Running Checks:", - ], - [ - " ✔ Value [10000000000000000000000] is > 0 ", - ], - [ - "All checks passed", - ], - [ - "Running Checks:", - ], - [ - " ✔ Account has at least 10000 CELO ", - ], - [ - "All checks passed", - ], - [ - "SendTransaction: lock", - ], - [ - "txHash: 0xtxhash", - ], - [ - "Running Checks:", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is Signer or registered Account ", - ], - [ - " ✔ Signer can sign Validator Txs ", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not a registered Validator ", - ], - [ - " ✔ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not a registered ValidatorGroup ", - ], - [ - " ✔ Signer's account has enough locked celo for registration ", - ], - [ - "All checks passed", - ], - [ - "SendTransaction: registerValidator", - ], - [ - "txHash: 0xtxhash", - ], - [ - "SendTransaction: Set encryption key", - ], - [ - "txHash: 0xtxhash", - ], [ "Running Checks:", ], @@ -515,6 +316,9 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { const accounts = await web3.eth.getAccounts() const notRegisteredAccount = accounts[0] const signerNotRegisteredAccount = accounts[1] + + logMock.mockClear() + await expect( testLocallyWithWeb3Node( Authorize, @@ -541,9 +345,6 @@ testWithAnvilL2('account:authorize cmd', (web3: Web3) => { [ " ✘ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is a registered Account 0x5409ED021D9299bf6814279A6A1411A7e866A631 is not registered as an account. Try running account:register", ], - [ - " ✔ undefined is not a registered Validator ", - ], ] `) }) diff --git a/packages/cli/src/commands/account/authorize.ts b/packages/cli/src/commands/account/authorize.ts index 96f3ae1bf..0be84faf0 100644 --- a/packages/cli/src/commands/account/authorize.ts +++ b/packages/cli/src/commands/account/authorize.ts @@ -26,11 +26,13 @@ export default class Authorize extends BaseCommand { description: 'The BLS public key that the validator is using for consensus, should pass proof of possession. 96 bytes.', dependsOn: ['blsPop'], + required: false, }), blsPop: CustomFlags.blsProofOfPossession({ description: 'The BLS public key proof-of-possession, which consists of a signature on the account address. 48 bytes.', dependsOn: ['blsKey'], + required: false, }), force: Flags.boolean({ description: @@ -56,6 +58,15 @@ export default class Authorize extends BaseCommand { res.flags.signer, res.flags.signature ) + const isCel2 = await this.isCel2() + + if (res.flags.role === 'validator') { + if (isCel2) { + if (res.flags.blsKey || res.flags.blsPop) { + this.error('BLS keys are not supported on L2', { exit: 1 }) + } + } + } // Check that the account is registered on-chain. // Additionally, if the authorization is for a validator, the BLS key must be provided when the @@ -63,7 +74,7 @@ export default class Authorize extends BaseCommand { // (Because the BLS key is stored on the validator entry, which would not exist yet) // Using the --force flag allows setting the ECDSA key on the validator without the BLS key. const checker = newCheckBuilder(this).isAccount(res.flags.from) - if (res.flags.role === 'validator' && !res.flags.force) { + if (res.flags.role === 'validator' && !res.flags.force && !isCel2) { if (res.flags.blsKey && res.flags.blsPop) { checker.isValidator(res.flags.from) } else { @@ -75,7 +86,8 @@ export default class Authorize extends BaseCommand { let tx: any if (res.flags.role === 'vote') { tx = await accounts.authorizeVoteSigner(res.flags.signer, sig) - } else if (res.flags.role === 'validator' && res.flags.blsKey && res.flags.blsPop) { + } else if (res.flags.role === 'validator' && res.flags.blsKey && res.flags.blsPop && !isCel2) { + // TODO(L2): this is deprecated and not supported in L2 tx = await accounts.authorizeValidatorSignerAndBls( res.flags.signer, sig, diff --git a/packages/cli/src/commands/governance/approve-l2.test.ts b/packages/cli/src/commands/governance/approve-l2.test.ts index fc52bed75..7a6a54e04 100644 --- a/packages/cli/src/commands/governance/approve-l2.test.ts +++ b/packages/cli/src/commands/governance/approve-l2.test.ts @@ -1,71 +1,81 @@ import { hexToBuffer, StrongAddress } from '@celo/base' +import { CeloProvider } from '@celo/connect/lib/celo-provider' import { newKitFromWeb3 } from '@celo/contractkit' import { DEFAULT_OWNER_ADDRESS, + setBalance, testWithAnvilL2, withImpersonatedAccount, } from '@celo/dev-utils/lib/anvil-test' import { ux } from '@oclif/core' +import Safe, { + getSafeAddressFromDeploymentTx, + PredictedSafeProps, + SafeAccountConfig, +} from '@safe-global/protocol-kit' import Web3 from 'web3' import { changeMultiSigOwner } from '../../test-utils/chain-setup' import { stripAnsiCodesAndTxHashes, testLocallyWithWeb3Node } from '../../test-utils/cliUtils' +import { setupSafeContracts } from '../../test-utils/multisigUtils' import Approve from './approve' process.env.NO_SYNCCHECK = 'true' -testWithAnvilL2('governance:approve cmd', (web3: Web3) => { - const HOTFIX_HASH = '0xbf670baa773b342120e1af45433a465bbd6fa289a5cf72763d63d95e4e22482d' - const HOTFIX_BUFFER = hexToBuffer(HOTFIX_HASH) - - describe('hotfix', () => { - it('fails when address is not security council multisig signatory', async () => { - const kit = newKitFromWeb3(web3) - const accounts = await web3.eth.getAccounts() - const governance = await kit.contracts.getGovernance() - const writeMock = jest.spyOn(ux.write, 'stdout') - const logMock = jest.spyOn(console, 'log') - const multisig = await governance.getApproverMultisig() - - await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { - // setApprover to 0x5409ED021D9299bf6814279A6A1411A7e866A631 to avoid "Council cannot be approver" error - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: '0x3156560e0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631', - }) - ).waitReceipt() - - // setSecurityCouncil to multisig address - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - // cast calldata "setSecurityCouncil(address)" - data: `0x1c1083e2000000000000000000000000${multisig.address - .replace('0x', '') - .toLowerCase()}`, - }) - ).waitReceipt() - }) - - await expect( - testLocallyWithWeb3Node( - Approve, - [ - '--from', - accounts[0], - '--hotfix', - HOTFIX_HASH, - '--useMultiSig', - '--type', - 'securityCouncil', - ], - web3 - ) - ).rejects.toThrow("Some checks didn't pass!") - - expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` +testWithAnvilL2( + 'governance:approve cmd', + (web3: Web3) => { + const HOTFIX_HASH = '0xbf670baa773b342120e1af45433a465bbd6fa289a5cf72763d63d95e4e22482d' + const HOTFIX_BUFFER = hexToBuffer(HOTFIX_HASH) + + describe('hotfix', () => { + it('fails when address is not security council multisig signatory', async () => { + const kit = newKitFromWeb3(web3) + const accounts = await web3.eth.getAccounts() + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + const multisig = await governance.getApproverMultisig() + + await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { + // setApprover to 0x5409ED021D9299bf6814279A6A1411A7e866A631 to avoid "Council cannot be approver" error + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: '0x3156560e0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631', + }) + ).waitReceipt() + + // setSecurityCouncil to multisig address + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + // cast calldata "setSecurityCouncil(address)" + data: `0x1c1083e2000000000000000000000000${multisig.address + .replace('0x', '') + .toLowerCase()}`, + }) + ).waitReceipt() + }) + + await expect( + testLocallyWithWeb3Node( + Approve, + [ + '--from', + accounts[0], + '--hotfix', + HOTFIX_HASH, + '--useMultiSig', + '--type', + 'securityCouncil', + ], + web3 + ) + ).rejects.toThrow("Some checks didn't pass!") + + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` { "approved": false, "councilApproved": false, @@ -73,8 +83,8 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { "executionTimeLimit": "0", } `) - expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) - .toMatchInlineSnapshot(` + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` [ [ "Running Checks:", @@ -93,25 +103,25 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { ], ] `) - expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) - }) - - it('fails when address is not approver multisig signatory', async () => { - const kit = newKitFromWeb3(web3) - const accounts = await web3.eth.getAccounts() - const governance = await kit.contracts.getGovernance() - const writeMock = jest.spyOn(ux.write, 'stdout') - const logMock = jest.spyOn(console, 'log') - - await expect( - testLocallyWithWeb3Node( - Approve, - ['--from', accounts[0], '--hotfix', HOTFIX_HASH, '--useMultiSig'], - web3 - ) - ).rejects.toThrow("Some checks didn't pass!") + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) + }) - expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + it('fails when address is not approver multisig signatory', async () => { + const kit = newKitFromWeb3(web3) + const accounts = await web3.eth.getAccounts() + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + + await expect( + testLocallyWithWeb3Node( + Approve, + ['--from', accounts[0], '--hotfix', HOTFIX_HASH, '--useMultiSig'], + web3 + ) + ).rejects.toThrow("Some checks didn't pass!") + + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` { "approved": false, "councilApproved": false, @@ -119,8 +129,8 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { "executionTimeLimit": "0", } `) - expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) - .toMatchInlineSnapshot(` + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` [ [ "Running Checks:", @@ -139,47 +149,47 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { ], ] `) - expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) - }) - - it('fails when address is not security council', async () => { - const [approver, securityCouncil, account] = await web3.eth.getAccounts() - const kit = newKitFromWeb3(web3) - const governance = await kit.contracts.getGovernance() - const writeMock = jest.spyOn(ux.write, 'stdout') - const logMock = jest.spyOn(console, 'log') - - await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { - // setApprover to approver value - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: `0x3156560e000000000000000000000000${approver.replace('0x', '').toLowerCase()}`, - }) - ).waitReceipt() - - // setSecurityCouncil to securityCouncil value - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: `0x1c1083e2000000000000000000000000${securityCouncil - .replace('0x', '') - .toLowerCase()}`, - }) - ).waitReceipt() + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) }) - await expect( - testLocallyWithWeb3Node( - Approve, - ['--from', account, '--hotfix', HOTFIX_HASH, '--type', 'securityCouncil'], - web3 - ) - ).rejects.toThrow("Some checks didn't pass!") - - expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + it('fails when address is not security council', async () => { + const [approver, securityCouncil, account] = await web3.eth.getAccounts() + const kit = newKitFromWeb3(web3) + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + + await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { + // setApprover to approver value + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: `0x3156560e000000000000000000000000${approver.replace('0x', '').toLowerCase()}`, + }) + ).waitReceipt() + + // setSecurityCouncil to securityCouncil value + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: `0x1c1083e2000000000000000000000000${securityCouncil + .replace('0x', '') + .toLowerCase()}`, + }) + ).waitReceipt() + }) + + await expect( + testLocallyWithWeb3Node( + Approve, + ['--from', account, '--hotfix', HOTFIX_HASH, '--type', 'securityCouncil'], + web3 + ) + ).rejects.toThrow("Some checks didn't pass!") + + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` { "approved": false, "councilApproved": false, @@ -187,8 +197,8 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { "executionTimeLimit": "0", } `) - expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) - .toMatchInlineSnapshot(` + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` [ [ "Running Checks:", @@ -204,43 +214,43 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { ], ] `) - expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) - }) - - it('fails when address is not approver', async () => { - const kit = newKitFromWeb3(web3) - const [approver, securityCouncil, account] = await web3.eth.getAccounts() - const governance = await kit.contracts.getGovernance() - const writeMock = jest.spyOn(ux.write, 'stdout') - const logMock = jest.spyOn(console, 'log') - - await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { - // setApprover to approver value - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: `0x3156560e000000000000000000000000${approver.replace('0x', '').toLowerCase()}`, - }) - ).waitReceipt() - - // setSecurityCouncil to securityCouncil value - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: `0x1c1083e2000000000000000000000000${securityCouncil - .replace('0x', '') - .toLowerCase()}`, - }) - ).waitReceipt() + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) }) - await expect( - testLocallyWithWeb3Node(Approve, ['--from', account, '--hotfix', HOTFIX_HASH], web3) - ).rejects.toThrow("Some checks didn't pass!") - - expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + it('fails when address is not approver', async () => { + const kit = newKitFromWeb3(web3) + const [approver, securityCouncil, account] = await web3.eth.getAccounts() + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + + await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { + // setApprover to approver value + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: `0x3156560e000000000000000000000000${approver.replace('0x', '').toLowerCase()}`, + }) + ).waitReceipt() + + // setSecurityCouncil to securityCouncil value + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: `0x1c1083e2000000000000000000000000${securityCouncil + .replace('0x', '') + .toLowerCase()}`, + }) + ).waitReceipt() + }) + + await expect( + testLocallyWithWeb3Node(Approve, ['--from', account, '--hotfix', HOTFIX_HASH], web3) + ).rejects.toThrow("Some checks didn't pass!") + + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` { "approved": false, "councilApproved": false, @@ -248,8 +258,8 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { "executionTimeLimit": "0", } `) - expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) - .toMatchInlineSnapshot(` + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` [ [ "Running Checks:", @@ -265,45 +275,45 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { ], ] `) - expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) - }) - - it('succeeds when address is a direct security council', async () => { - const [approver, securityCouncil] = await web3.eth.getAccounts() - const kit = newKitFromWeb3(web3) - const governance = await kit.contracts.getGovernance() - const writeMock = jest.spyOn(ux.write, 'stdout') - const logMock = jest.spyOn(console, 'log') - - await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { - // setApprover to approver value - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: `0x3156560e000000000000000000000000${approver.replace('0x', '').toLowerCase()}`, - }) - ).waitReceipt() - - // setSecurityCouncil to securityCouncil value - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: `0x1c1083e2000000000000000000000000${securityCouncil - .replace('0x', '') - .toLowerCase()}`, - }) - ).waitReceipt() + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) }) - await testLocallyWithWeb3Node( - Approve, - ['--from', securityCouncil, '--hotfix', HOTFIX_HASH, '--type', 'securityCouncil'], - web3 - ) + it('succeeds when address is a direct security council', async () => { + const [approver, securityCouncil] = await web3.eth.getAccounts() + const kit = newKitFromWeb3(web3) + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + + await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { + // setApprover to approver value + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: `0x3156560e000000000000000000000000${approver.replace('0x', '').toLowerCase()}`, + }) + ).waitReceipt() + + // setSecurityCouncil to securityCouncil value + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: `0x1c1083e2000000000000000000000000${securityCouncil + .replace('0x', '') + .toLowerCase()}`, + }) + ).waitReceipt() + }) + + await testLocallyWithWeb3Node( + Approve, + ['--from', securityCouncil, '--hotfix', HOTFIX_HASH, '--type', 'securityCouncil'], + web3 + ) - expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` { "approved": false, "councilApproved": true, @@ -311,8 +321,8 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { "executionTimeLimit": "0", } `) - expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) - .toMatchInlineSnapshot(` + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` [ [ "Running Checks:", @@ -344,41 +354,41 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { ], ] `) - expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) - }) - - it('succeeds when address is a direct approver', async () => { - const kit = newKitFromWeb3(web3) - const [approver, securityCouncil] = await web3.eth.getAccounts() - const governance = await kit.contracts.getGovernance() - const writeMock = jest.spyOn(ux.write, 'stdout') - const logMock = jest.spyOn(console, 'log') - - await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { - // setApprover to approver value - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: `0x3156560e000000000000000000000000${approver.replace('0x', '').toLowerCase()}`, - }) - ).waitReceipt() - - // setSecurityCouncil to securityCouncil value - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: `0x1c1083e2000000000000000000000000${securityCouncil - .replace('0x', '') - .toLowerCase()}`, - }) - ).waitReceipt() + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) }) - await testLocallyWithWeb3Node(Approve, ['--from', approver, '--hotfix', HOTFIX_HASH], web3) - - expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + it('succeeds when address is a direct approver', async () => { + const kit = newKitFromWeb3(web3) + const [approver, securityCouncil] = await web3.eth.getAccounts() + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + + await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { + // setApprover to approver value + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: `0x3156560e000000000000000000000000${approver.replace('0x', '').toLowerCase()}`, + }) + ).waitReceipt() + + // setSecurityCouncil to securityCouncil value + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: `0x1c1083e2000000000000000000000000${securityCouncil + .replace('0x', '') + .toLowerCase()}`, + }) + ).waitReceipt() + }) + + await testLocallyWithWeb3Node(Approve, ['--from', approver, '--hotfix', HOTFIX_HASH], web3) + + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` { "approved": true, "councilApproved": false, @@ -386,8 +396,8 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { "executionTimeLimit": "0", } `) - expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) - .toMatchInlineSnapshot(` + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` [ [ "Running Checks:", @@ -419,62 +429,62 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { ], ] `) - expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) - }) - - it('succeeds when address is security council multisig signatory', async () => { - const kit = newKitFromWeb3(web3) - const accounts = (await web3.eth.getAccounts()) as StrongAddress[] - const governance = await kit.contracts.getGovernance() - const writeMock = jest.spyOn(ux.write, 'stdout') - const logMock = jest.spyOn(console, 'log') - const multisig = await governance.getApproverMultisig() - - await changeMultiSigOwner(kit, accounts[0]) - - await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { - // setApprover to 0x5409ED021D9299bf6814279A6A1411A7e866A631 to avoid "Council cannot be approver" error - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - // cast calldata "setApprover(address)" "0x5409ED021D9299bf6814279A6A1411A7e866A631" - data: '0x3156560e0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631', - }) - ).waitReceipt() - - // setSecurityCouncil to multisig address - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - // cast calldata "setSecurityCouncil(address)" - data: `0x1c1083e2000000000000000000000000${multisig.address - .replace('0x', '') - .toLowerCase()}`, - }) - ).waitReceipt() + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) }) - // Sanity checks - expect(await governance.getApprover()).toBe(accounts[0]) - expect(await governance.getSecurityCouncil()).toEqual(multisig.address) + it('succeeds when address is security council multisig signatory', async () => { + const kit = newKitFromWeb3(web3) + const accounts = (await web3.eth.getAccounts()) as StrongAddress[] + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + const multisig = await governance.getApproverMultisig() + + await changeMultiSigOwner(kit, accounts[0]) + + await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { + // setApprover to 0x5409ED021D9299bf6814279A6A1411A7e866A631 to avoid "Council cannot be approver" error + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + // cast calldata "setApprover(address)" "0x5409ED021D9299bf6814279A6A1411A7e866A631" + data: '0x3156560e0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631', + }) + ).waitReceipt() + + // setSecurityCouncil to multisig address + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + // cast calldata "setSecurityCouncil(address)" + data: `0x1c1083e2000000000000000000000000${multisig.address + .replace('0x', '') + .toLowerCase()}`, + }) + ).waitReceipt() + }) + + // Sanity checks + expect(await governance.getApprover()).toBe(accounts[0]) + expect(await governance.getSecurityCouncil()).toEqual(multisig.address) + + await testLocallyWithWeb3Node( + Approve, + [ + '--from', + accounts[0], + '--hotfix', + HOTFIX_HASH, + '--useMultiSig', + '--type', + 'securityCouncil', + ], + web3 + ) - await testLocallyWithWeb3Node( - Approve, - [ - '--from', - accounts[0], - '--hotfix', - HOTFIX_HASH, - '--useMultiSig', - '--type', - 'securityCouncil', - ], - web3 - ) - - expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` { "approved": false, "councilApproved": true, @@ -483,8 +493,8 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { } `) - expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) - .toMatchInlineSnapshot(` + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` [ [ "Running Checks:", @@ -512,26 +522,241 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { ], ] `) - expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) - }) + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) + }) + + it('succeeds when address is security council safe signatory', async () => { + await setupSafeContracts(web3) + + const kit = newKitFromWeb3(web3) + const [approver, securityCouncilSafeSignatory1] = + (await web3.eth.getAccounts()) as StrongAddress[] + const securityCouncilSafeSignatory2: StrongAddress = + '0x6C666E57A5E8715cFE93f92790f98c4dFf7b69e2' + const securityCouncilSafeSignatory2PrivateKey = + '0xe99303048756f2eac145377ebffdeec6747b8de31c1d34e004e1ee62f2b3d7a5' + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + + const safeAccountConfig: SafeAccountConfig = { + owners: [securityCouncilSafeSignatory1, securityCouncilSafeSignatory2], + threshold: 2, + } + + const predictSafe: PredictedSafeProps = { + safeAccountConfig, + } + + const protocolKit = await Safe.init({ + predictedSafe: predictSafe, + provider: (web3.currentProvider as any as CeloProvider).toEip1193Provider(), + signer: securityCouncilSafeSignatory1, + }) + + const deploymentTransaction = await protocolKit.createSafeDeploymentTransaction() + + const receipt = await web3.eth.sendTransaction({ + from: securityCouncilSafeSignatory1, + ...deploymentTransaction, + }) + + // @ts-expect-error the function is able to extract safe adddress without having + const safeAddress = getSafeAddressFromDeploymentTx(receipt, '1.3.0') + + protocolKit.connect({ safeAddress }) + + await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { + // setApprover to 0x5409ED021D9299bf6814279A6A1411A7e866A631 to avoid "Council cannot be approver" error + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + // cast calldata "setApprover(address)" "0x5409ED021D9299bf6814279A6A1411A7e866A631" + data: '0x3156560e0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631', + }) + ).waitReceipt() + + // setSecurityCouncil to safe address + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + // cast calldata "setSecurityCouncil(address)" + data: `0x1c1083e2000000000000000000000000${safeAddress + .replace('0x', '') + .toLowerCase()}`, + }) + ).waitReceipt() + }) + + // Sanity checks + expect(await governance.getApprover()).toBe(approver) + expect(await governance.getSecurityCouncil()).toEqual(safeAddress) + expect(await protocolKit.getOwners()).toEqual([ + securityCouncilSafeSignatory1, + securityCouncilSafeSignatory2, + ]) + + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + { + "approved": false, + "councilApproved": false, + "executed": false, + "executionTimeLimit": "0", + } + `) + + await testLocallyWithWeb3Node( + Approve, + [ + '--from', + securityCouncilSafeSignatory1, + '--hotfix', + HOTFIX_HASH, + '--useSafe', + '--type', + 'securityCouncil', + ], + web3 + ) + + // Run the same command twice with same arguments to make sure it doesn't have any effect + await testLocallyWithWeb3Node( + Approve, + [ + '--from', + securityCouncilSafeSignatory1, + '--hotfix', + HOTFIX_HASH, + '--useSafe', + '--type', + 'securityCouncil', + ], + web3 + ) + + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + { + "approved": false, + "councilApproved": false, + "executed": false, + "executionTimeLimit": "0", + } + `) - it('succeeds when address is approver multisig signatory', async () => { - const kit = newKitFromWeb3(web3) - const accounts = (await web3.eth.getAccounts()) as StrongAddress[] + // Make sure the account has enough balance to pay for the transaction + await setBalance( + web3, + securityCouncilSafeSignatory2, + BigInt(web3.utils.toWei('1', 'ether')) + ) + await testLocallyWithWeb3Node( + Approve, + [ + '--from', + securityCouncilSafeSignatory2, + '--hotfix', + HOTFIX_HASH, + '--useSafe', + '--type', + 'securityCouncil', + // We want to test if integration works for accounts that are not added to the node + '--privateKey', + securityCouncilSafeSignatory2PrivateKey, + ], + web3 + ) - await changeMultiSigOwner(kit, accounts[0]) + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + { + "approved": false, + "councilApproved": true, + "executed": false, + "executionTimeLimit": "0", + } + `) - const governance = await kit.contracts.getGovernance() - const writeMock = jest.spyOn(ux.write, 'stdout') - const logMock = jest.spyOn(console, 'log') + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` + [ + [ + "Running Checks:", + ], + [ + " ✔ 0x6Ecbe1DB9EF729CBe972C83Fb886247691Fb6beb is security council safe signatory ", + ], + [ + " ✔ Hotfix 0xbf670baa773b342120e1af45433a465bbd6fa289a5cf72763d63d95e4e22482d is not already approved by security council ", + ], + [ + " ✔ Hotfix 0xbf670baa773b342120e1af45433a465bbd6fa289a5cf72763d63d95e4e22482d is not already executed ", + ], + [ + "All checks passed", + ], + [ + "txHash: 0xtxhash", + ], + [ + "Running Checks:", + ], + [ + " ✔ 0x6Ecbe1DB9EF729CBe972C83Fb886247691Fb6beb is security council safe signatory ", + ], + [ + " ✔ Hotfix 0xbf670baa773b342120e1af45433a465bbd6fa289a5cf72763d63d95e4e22482d is not already approved by security council ", + ], + [ + " ✔ Hotfix 0xbf670baa773b342120e1af45433a465bbd6fa289a5cf72763d63d95e4e22482d is not already executed ", + ], + [ + "All checks passed", + ], + [ + "Running Checks:", + ], + [ + " ✔ 0x6C666E57A5E8715cFE93f92790f98c4dFf7b69e2 is security council safe signatory ", + ], + [ + " ✔ Hotfix 0xbf670baa773b342120e1af45433a465bbd6fa289a5cf72763d63d95e4e22482d is not already approved by security council ", + ], + [ + " ✔ Hotfix 0xbf670baa773b342120e1af45433a465bbd6fa289a5cf72763d63d95e4e22482d is not already executed ", + ], + [ + "All checks passed", + ], + [ + "txHash: 0xtxhash", + ], + [ + "txHash: 0xtxhash", + ], + ] + `) + + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) + }) + + it('succeeds when address is approver multisig signatory', async () => { + const kit = newKitFromWeb3(web3) + const accounts = (await web3.eth.getAccounts()) as StrongAddress[] - await testLocallyWithWeb3Node( - Approve, - ['--from', accounts[0], '--hotfix', HOTFIX_HASH, '--useMultiSig'], - web3 - ) + await changeMultiSigOwner(kit, accounts[0]) - expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + + await testLocallyWithWeb3Node( + Approve, + ['--from', accounts[0], '--hotfix', HOTFIX_HASH, '--useMultiSig'], + web3 + ) + + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` { "approved": true, "councilApproved": false, @@ -539,8 +764,8 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { "executionTimeLimit": "0", } `) - expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) - .toMatchInlineSnapshot(` + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` [ [ "Running Checks:", @@ -568,58 +793,58 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { ], ] `) - expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) - }) - - it('succeeds when address is security council multisig signatory', async () => { - const kit = newKitFromWeb3(web3) - const accounts = (await web3.eth.getAccounts()) as StrongAddress[] - - await changeMultiSigOwner(kit, accounts[0]) - - const governance = await kit.contracts.getGovernance() - const writeMock = jest.spyOn(ux.write, 'stdout') - const logMock = jest.spyOn(console, 'log') - const multisig = await governance.getApproverMultisig() - - await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { - // setApprover to 0x5409ED021D9299bf6814279A6A1411A7e866A631 to avoid "Council cannot be approver" error - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - data: '0x3156560e0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631', - }) - ).waitReceipt() - - // setSecurityCouncil to multisig address - await ( - await kit.sendTransaction({ - to: governance.address, - from: DEFAULT_OWNER_ADDRESS, - // cast calldata "setSecurityCouncil(address)" - data: `0x1c1083e2000000000000000000000000${multisig.address - .replace('0x', '') - .toLowerCase()}`, - }) - ).waitReceipt() + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) }) - await testLocallyWithWeb3Node( - Approve, - [ - '--from', - accounts[0], - '--hotfix', - HOTFIX_HASH, - '--useMultiSig', - '--type', - 'securityCouncil', - ], - web3 - ) - - expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` + it('succeeds when address is security council multisig signatory', async () => { + const kit = newKitFromWeb3(web3) + const accounts = (await web3.eth.getAccounts()) as StrongAddress[] + + await changeMultiSigOwner(kit, accounts[0]) + + const governance = await kit.contracts.getGovernance() + const writeMock = jest.spyOn(ux.write, 'stdout') + const logMock = jest.spyOn(console, 'log') + const multisig = await governance.getApproverMultisig() + + await withImpersonatedAccount(web3, DEFAULT_OWNER_ADDRESS, async () => { + // setApprover to 0x5409ED021D9299bf6814279A6A1411A7e866A631 to avoid "Council cannot be approver" error + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + data: '0x3156560e0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631', + }) + ).waitReceipt() + + // setSecurityCouncil to multisig address + await ( + await kit.sendTransaction({ + to: governance.address, + from: DEFAULT_OWNER_ADDRESS, + // cast calldata "setSecurityCouncil(address)" + data: `0x1c1083e2000000000000000000000000${multisig.address + .replace('0x', '') + .toLowerCase()}`, + }) + ).waitReceipt() + }) + + await testLocallyWithWeb3Node( + Approve, + [ + '--from', + accounts[0], + '--hotfix', + HOTFIX_HASH, + '--useMultiSig', + '--type', + 'securityCouncil', + ], + web3 + ) + + expect(await governance.getHotfixRecord(HOTFIX_BUFFER)).toMatchInlineSnapshot(` { "approved": false, "councilApproved": true, @@ -627,8 +852,8 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { "executionTimeLimit": "0", } `) - expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) - .toMatchInlineSnapshot(` + expect(logMock.mock.calls.map((args) => args.map(stripAnsiCodesAndTxHashes))) + .toMatchInlineSnapshot(` [ [ "Running Checks:", @@ -656,10 +881,14 @@ testWithAnvilL2('governance:approve cmd', (web3: Web3) => { ], ] `) - expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) + expect(writeMock.mock.calls).toMatchInlineSnapshot(`[]`) + }) + }) + afterEach(() => { + jest.clearAllMocks() }) - }) - afterEach(() => { - jest.clearAllMocks() - }) -}) + }, + { + chainId: 42220, + } +) diff --git a/packages/cli/src/commands/governance/approve.ts b/packages/cli/src/commands/governance/approve.ts index 1d05ad3c3..9ec3a78fb 100644 --- a/packages/cli/src/commands/governance/approve.ts +++ b/packages/cli/src/commands/governance/approve.ts @@ -4,10 +4,16 @@ import { GovernanceWrapper } from '@celo/contractkit/lib/wrappers/Governance' import { MultiSigWrapper } from '@celo/contractkit/lib/wrappers/MultiSig' import { toBuffer } from '@ethereumjs/util' import { Flags } from '@oclif/core' +import Web3 from 'web3' import { BaseCommand } from '../../base' import { newCheckBuilder } from '../../utils/checks' import { displaySendTx, failWith } from '../../utils/cli' import { CustomFlags } from '../../utils/command' +import { + createSafeFromWeb3, + performSafeTransaction, + safeTransactionMetadataFromCeloTransactionObject, +} from '../../utils/safe' enum HotfixApprovalType { APPROVER = 'approver', @@ -31,6 +37,11 @@ export default class Approve extends BaseCommand { from: CustomFlags.address({ required: true, description: "Approver's address" }), useMultiSig: Flags.boolean({ description: 'True means the request will be sent through multisig.', + exclusive: ['useSafe'], + }), + useSafe: Flags.boolean({ + description: 'True means the request will be sent through safe.', + exclusive: ['useMultiSig'], }), hotfix: Flags.string({ exclusive: ['proposalID'], @@ -59,6 +70,7 @@ export default class Approve extends BaseCommand { const res = await this.parse(Approve) const account = res.flags.from const useMultiSig = res.flags.useMultiSig + const useSafe = res.flags.useSafe const id = res.flags.proposalID const hotfix = res.flags.hotfix const approvalType = res.flags.type @@ -73,11 +85,13 @@ export default class Approve extends BaseCommand { const approver = useMultiSig ? governanceApproverMultiSig!.address : account await addDefaultChecks( + await this.getWeb3(), checkBuilder, governance, isCel2, !!hotfix, useMultiSig, + useSafe, approvalType as HotfixApprovalType, hotfix as string, approver, @@ -115,7 +129,14 @@ export default class Approve extends BaseCommand { failWith('Proposal ID or hotfix must be provided') } - if ( + if (isCel2 && approvalType === 'securityCouncil' && useSafe) { + await performSafeTransaction( + await this.getWeb3(), + await governance.getSecurityCouncil(), + account, + await safeTransactionMetadataFromCeloTransactionObject(governanceTx, governance.address) + ) + } else if ( isCel2 && approvalType === 'securityCouncil' && useMultiSig && @@ -140,11 +161,13 @@ export default class Approve extends BaseCommand { } const addDefaultChecks = async ( + web3: Web3, checkBuilder: ReturnType, governance: GovernanceWrapper, isCel2: boolean, isHotfix: boolean, useMultiSig: boolean, + useSafe: boolean, approvalType: HotfixApprovalType, hotfix: string, approver: StrongAddress, @@ -178,6 +201,16 @@ const addDefaultChecks = async ( .addCheck(`${account} is security council multisig signatory`, async () => { return await securityCouncilMultisig.isOwner(account) }) + } else if (useSafe) { + checkBuilder.addCheck(`${account} is security council safe signatory`, async () => { + const protocolKit = await createSafeFromWeb3( + web3, + account, + await governance.getSecurityCouncil() + ) + + return await protocolKit.isOwner(account) + }) } else { checkBuilder.isSecurityCouncil(account) } diff --git a/packages/cli/src/commands/governance/build-proposals.test.ts b/packages/cli/src/commands/governance/build-proposals.test.ts new file mode 100644 index 000000000..85b04e085 --- /dev/null +++ b/packages/cli/src/commands/governance/build-proposals.test.ts @@ -0,0 +1,60 @@ +import CeloTokenABI from '@celo/abis/GoldToken.json' +import { testWithAnvilL2 } from '@celo/dev-utils/lib/anvil-test' +import { readJSON, removeSync } from 'fs-extra' +import inquirer from 'inquirer' +import Web3 from 'web3' +import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils' +import BuildProposal from './build-proposal' + +process.env.NO_SYNCCHECK = 'true' + +jest.mock('inquirer') + +const TX_PATH_FOR_TEST = './test-tx.json' + +testWithAnvilL2('governance:build-proposal cmd', (web3: Web3) => { + describe('building proposal to transfer funds from governance', () => { + beforeEach(async () => { + const promptSpy = jest + .spyOn(inquirer, 'prompt') + .mockResolvedValueOnce({ 'Celo Contract': 'GoldToken' }) + .mockResolvedValueOnce({ 'GoldToken Function': 'transfer' }) + CeloTokenABI.abi + .find((f) => f.name === 'transfer')! + .inputs!.forEach((input) => { + switch (input.type) { + case 'address': + promptSpy.mockResolvedValueOnce({ + [input.name!]: '0x19F78d207493Bf6f7E8D54900d01bb387F211b28', + }) + break + case 'uint256': + promptSpy.mockResolvedValueOnce({ [input.name!]: '1000000000000000000' }) + break + } + }) + promptSpy.mockResolvedValueOnce({ 'Celo Contract': '✔ done' }) + }) + it('generates the json', async () => { + await testLocallyWithWeb3Node(BuildProposal, ['--output', TX_PATH_FOR_TEST], web3) + const result = await readJSON(TX_PATH_FOR_TEST) + expect(result).toMatchInlineSnapshot(` + [ + { + "args": [ + "0x19F78d207493Bf6f7E8D54900d01bb387F211b28", + "1000000000000000000", + ], + "contract": "GoldToken", + "function": "transfer", + "value": "0", + }, + ] + `) + }) + }) + afterAll(() => { + jest.restoreAllMocks() + removeSync(TX_PATH_FOR_TEST) + }) +}) diff --git a/packages/cli/src/test-utils/constants.ts b/packages/cli/src/test-utils/constants.ts index f2a725b2a..ec8a4c2c0 100644 --- a/packages/cli/src/test-utils/constants.ts +++ b/packages/cli/src/test-utils/constants.ts @@ -17,3 +17,28 @@ export const multiSigBytecode = export const PROOF_OF_POSSESSION_SIGNATURE = '0x1b9fca4bbb5bfb1dbe69ef1cddbd9b4202dcb6b134c5170611e1e36ecfa468d7b46c85328d504934fce6c2a1571603a50ae224d2b32685e84d4d1a1eebad8452eb' + +/** + * Those are all addresses and bytecodes for contracts required by + * @safe-global/protocol-kit to work for the test cases based on mainnet implementation + */ + +export const SAFE_MULTISEND_ADDRESS = '0x998739BFdAAdde7C933B942a68053933098f9EDa' +export const SAFE_MULTISEND_CODE = + '0x60806040526004361061001e5760003560e01c80638d80ff0a14610023575b600080fd5b6100dc6004803603602081101561003957600080fd5b810190808035906020019064010000000081111561005657600080fd5b82018360208201111561006857600080fd5b8035906020019184600183028401116401000000008311171561008a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506100de565b005b7f000000000000000000000000998739bfdaadde7c933b942a68053933098f9eda73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161415610183576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806102106030913960400191505060405180910390fd5b805160205b8181101561020a578083015160f81c6001820184015160601c6015830185015160358401860151605585018701600085600081146101cd57600181146101dd576101e8565b6000808585888a5af191506101e8565b6000808585895af491505b5060008114156101f757600080fd5b8260550187019650505050505050610188565b50505056fe4d756c746953656e642073686f756c64206f6e6c792062652063616c6c6564207669612064656c656761746563616c6ca26469706673582212205c784303626eec02b71940b551976170b500a8a36cc5adcbeb2c19751a76d05464736f6c63430007060033' + +export const SAFE_MULTISEND_CALL_ONLY_ADDRESS = '0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B' +export const SAFE_MULTISEND_CALL_ONLY_CODE = + '0x60806040526004361061001e5760003560e01c80638d80ff0a14610023575b600080fd5b6100dc6004803603602081101561003957600080fd5b810190808035906020019064010000000081111561005657600080fd5b82018360208201111561006857600080fd5b8035906020019184600183028401116401000000008311171561008a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506100de565b005b805160205b8181101561015f578083015160f81c6001820184015160601c60158301850151603584018601516055850187016000856000811461012857600181146101385761013d565b6000808585888a5af1915061013d565b600080fd5b50600081141561014c57600080fd5b82605501870196505050505050506100e3565b50505056fea264697066735822122035246402746c96964495cae5b36461fd44dfb89f8e6cf6f6b8d60c0aa89f414864736f6c63430007060033' + +export const SAFE_PROXY_FACTORY_ADDRESS = '0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC' +export const SAFE_PROXY_FACTORY_CODE = + '0x608060405234801561001057600080fd5b50600436106100625760003560e01c80631688f0b9146100675780632500510e1461017657806353e5d9351461024357806361b69abd146102c6578063addacc0f146103cb578063d18af54d1461044e575b600080fd5b61014a6004803603606081101561007d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156100ba57600080fd5b8201836020820111156100cc57600080fd5b803590602001918460018302840111640100000000831117156100ee57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061057d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102176004803603606081101561018c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156101c957600080fd5b8201836020820111156101db57600080fd5b803590602001918460018302840111640100000000831117156101fd57600080fd5b909192939192939080359060200190929190505050610624565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61024b610751565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561028b578082015181840152602081019050610270565b50505050905090810190601f1680156102b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61039f600480360360408110156102dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561031957600080fd5b82018360208201111561032b57600080fd5b8035906020019184600183028401116401000000008311171561034d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061077c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103d3610861565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104135780820151818401526020810190506103f8565b50505050905090810190601f1680156104405780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105516004803603608081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156104a157600080fd5b8201836020820111156104b357600080fd5b803590602001918460018302840111640100000000831117156104d557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061088c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600061058a848484610a3b565b90506000835111156105b25760008060008551602087016000865af114156105b157600080fd5b5b7f4f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e2358185604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a19392505050565b60006106758585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505084610a3b565b905080604051602001808273ffffffffffffffffffffffffffffffffffffffff1660601b81526014019150506040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156107165780820151818401526020810190506106fb565b50505050905090810190601f1680156107435780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60606040518060200161076390610bde565b6020820181038252601f19601f82011660405250905090565b60008260405161078b90610bde565b808273ffffffffffffffffffffffffffffffffffffffff168152602001915050604051809103906000f0801580156107c7573d6000803e3d6000fd5b5090506000825111156107f05760008060008451602086016000865af114156107ef57600080fd5b5b7f4f51faf6c4561ff95f067657e43439f0f856d97c04d9ec9070a6199ad418e2358184604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a192915050565b60606040518060200161087390610beb565b6020820181038252601f19601f82011660405250905090565b6000808383604051602001808381526020018273ffffffffffffffffffffffffffffffffffffffff1660601b8152601401925050506040516020818303038152906040528051906020012060001c90506108e786868361057d565b9150600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610a32578273ffffffffffffffffffffffffffffffffffffffff16631e52b518838888886040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b838110156109ca5780820151818401526020810190506109af565b50505050905090810190601f1680156109f75780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610a1957600080fd5b505af1158015610a2d573d6000803e3d6000fd5b505050505b50949350505050565b6000808380519060200120836040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209050600060405180602001610a8890610bde565b6020820181038252601f19601f820116604052508673ffffffffffffffffffffffffffffffffffffffff166040516020018083805190602001908083835b60208310610ae95780518252602082019150602081019050602083039250610ac6565b6001836020036101000a038019825116818451168082178552505050505050905001828152602001925050506040516020818303038152906040529050818151826020016000f59250600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bd5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f437265617465322063616c6c206661696c65640000000000000000000000000081525060200191505060405180910390fd5b50509392505050565b6101e680610bf883390190565b60ab80610dde8339019056fe608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033a26469706673582212200c75fe2196b9f752c82794253f2ebce0d821afef5997e1d5a35ec316ce592f6664736f6c63430007060033' + +export const SAFE_PROXY_ADDRESS = '0xfb1bffC9d739B8D520DaF37dF666da4C687191EA' +export const SAFE_PROXY_CODE = + '0x6080604052600436106101dc5760003560e01c8063affed0e011610102578063e19a9dd911610095578063f08a032311610064578063f08a032314611647578063f698da2514611698578063f8dc5dd9146116c3578063ffa1ad741461173e57610231565b8063e19a9dd91461139b578063e318b52b146113ec578063e75235b81461147d578063e86637db146114a857610231565b8063cc2f8452116100d1578063cc2f8452146110e8578063d4d9bdcd146111b5578063d8d11f78146111f0578063e009cfde1461132a57610231565b8063affed0e014610d94578063b4faba0914610dbf578063b63e800d14610ea7578063c4ca3a9c1461101757610231565b80635624b25b1161017a5780636a761202116101495780636a761202146109945780637d83297414610b50578063934f3a1114610bbf578063a0e67e2b14610d2857610231565b80635624b25b146107fb5780635ae6bd37146108b9578063610b592514610908578063694e80c31461095957610231565b80632f54bf6e116101b65780632f54bf6e146104d35780633408e4701461053a578063468721a7146105655780635229073f1461067a57610231565b80630d582f131461029e57806312fb68e0146102f95780632d9ad53d1461046c57610231565b36610231573373ffffffffffffffffffffffffffffffffffffffff167f3d0ce9bfc3ed7d6862dbb28b2dea94561fe714a1b4d019aa8af39730d1ad7c3d346040518082815260200191505060405180910390a2005b34801561023d57600080fd5b5060007f6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d560001b905080548061027257600080f35b36600080373360601b365260008060143601600080855af13d6000803e80610299573d6000fd5b3d6000f35b3480156102aa57600080fd5b506102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506117ce565b005b34801561030557600080fd5b5061046a6004803603608081101561031c57600080fd5b81019080803590602001909291908035906020019064010000000081111561034357600080fd5b82018360208201111561035557600080fd5b8035906020019184600183028401116401000000008311171561037757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156103da57600080fd5b8201836020820111156103ec57600080fd5b8035906020019184600183028401116401000000008311171561040e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611bbe565b005b34801561047857600080fd5b506104bb6004803603602081101561048f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612440565b60405180821515815260200191505060405180910390f35b3480156104df57600080fd5b50610522600480360360208110156104f657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612512565b60405180821515815260200191505060405180910390f35b34801561054657600080fd5b5061054f6125e4565b6040518082815260200191505060405180910390f35b34801561057157600080fd5b506106626004803603608081101561058857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105cf57600080fd5b8201836020820111156105e157600080fd5b8035906020019184600183028401116401000000008311171561060357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803560ff1690602001909291905050506125f1565b60405180821515815260200191505060405180910390f35b34801561068657600080fd5b506107776004803603608081101561069d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156106e457600080fd5b8201836020820111156106f657600080fd5b8035906020019184600183028401116401000000008311171561071857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803560ff1690602001909291905050506126fc565b60405180831515815260200180602001828103825283818151815260200191508051906020019080838360005b838110156107bf5780820151818401526020810190506107a4565b50505050905090810190601f1680156107ec5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34801561080757600080fd5b5061083e6004803603604081101561081e57600080fd5b810190808035906020019092919080359060200190929190505050612732565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561087e578082015181840152602081019050610863565b50505050905090810190601f1680156108ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108c557600080fd5b506108f2600480360360208110156108dc57600080fd5b81019080803590602001909291905050506127b9565b6040518082815260200191505060405180910390f35b34801561091457600080fd5b506109576004803603602081101561092b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127d1565b005b34801561096557600080fd5b506109926004803603602081101561097c57600080fd5b8101908080359060200190929190505050612b63565b005b610b3860048036036101408110156109ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156109f257600080fd5b820183602082011115610a0457600080fd5b80359060200191846001830284011164010000000083111715610a2657600080fd5b9091929391929390803560ff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115610ab257600080fd5b820183602082011115610ac457600080fd5b80359060200191846001830284011164010000000083111715610ae657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612c9d565b60405180821515815260200191505060405180910390f35b348015610b5c57600080fd5b50610ba960048036036040811015610b7357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612edc565b6040518082815260200191505060405180910390f35b348015610bcb57600080fd5b50610d2660048036036060811015610be257600080fd5b810190808035906020019092919080359060200190640100000000811115610c0957600080fd5b820183602082011115610c1b57600080fd5b80359060200191846001830284011164010000000083111715610c3d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610ca057600080fd5b820183602082011115610cb257600080fd5b80359060200191846001830284011164010000000083111715610cd457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612f01565b005b348015610d3457600080fd5b50610d3d612f90565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610d80578082015181840152602081019050610d65565b505050509050019250505060405180910390f35b348015610da057600080fd5b50610da9613139565b6040518082815260200191505060405180910390f35b348015610dcb57600080fd5b50610ea560048036036040811015610de257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115610e1f57600080fd5b820183602082011115610e3157600080fd5b80359060200191846001830284011164010000000083111715610e5357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061313f565b005b348015610eb357600080fd5b506110156004803603610100811015610ecb57600080fd5b8101908080359060200190640100000000811115610ee857600080fd5b820183602082011115610efa57600080fd5b80359060200191846020830284011164010000000083111715610f1c57600080fd5b909192939192939080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115610f6757600080fd5b820183602082011115610f7957600080fd5b80359060200191846001830284011164010000000083111715610f9b57600080fd5b9091929391929390803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613161565b005b34801561102357600080fd5b506110d26004803603608081101561103a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561108157600080fd5b82018360208201111561109357600080fd5b803590602001918460018302840111640100000000831117156110b557600080fd5b9091929391929390803560ff16906020019092919050505061331f565b6040518082815260200191505060405180910390f35b3480156110f457600080fd5b506111416004803603604081101561110b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613447565b60405180806020018373ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019060200280838360005b838110156111a0578082015181840152602081019050611185565b50505050905001935050505060405180910390f35b3480156111c157600080fd5b506111ee600480360360208110156111d857600080fd5b8101908080359060200190929190505050613639565b005b3480156111fc57600080fd5b50611314600480360361014081101561121457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561125b57600080fd5b82018360208201111561126d57600080fd5b8035906020019184600183028401116401000000008311171561128f57600080fd5b9091929391929390803560ff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506137d8565b6040518082815260200191505060405180910390f35b34801561133657600080fd5b506113996004803603604081101561134d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613805565b005b3480156113a757600080fd5b506113ea600480360360208110156113be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613b96565b005b3480156113f857600080fd5b5061147b6004803603606081101561140f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613c1a565b005b34801561148957600080fd5b5061149261428c565b6040518082815260200191505060405180910390f35b3480156114b457600080fd5b506115cc60048036036101408110156114cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561151357600080fd5b82018360208201111561152557600080fd5b8035906020019184600183028401116401000000008311171561154757600080fd5b9091929391929390803560ff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050614296565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561160c5780820151818401526020810190506115f1565b50505050905090810190601f1680156116395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561165357600080fd5b506116966004803603602081101561166a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061443e565b005b3480156116a457600080fd5b506116ad61449f565b6040518082815260200191505060405180910390f35b3480156116cf57600080fd5b5061173c600480360360608110156116e657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061451d565b005b34801561174a57600080fd5b50611753614950565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015611793578082015181840152602081019050611778565b50505050905090810190601f1680156117c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6117d6614989565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156118405750600173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561187857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b6118ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303300000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303400000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60026000600173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508160026000600173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003600081548092919060010191905055507f9465fa0c962cc76958e6373a993326400c1c94f8be2fe3a952adfa7f60b2ea2682604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a18060045414611bba57611bb981612b63565b5b5050565b611bd2604182614a2c90919063ffffffff16565b82511015611c48576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330323000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000808060008060005b8681101561243457611c648882614a66565b80945081955082965050505060008460ff16141561206d578260001c9450611c96604188614a2c90919063ffffffff16565b8260001c1015611d0e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330323100000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8751611d2760208460001c614a9590919063ffffffff16565b1115611d9b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330323200000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60006020838a01015190508851611dd182611dc360208760001c614a9590919063ffffffff16565b614a9590919063ffffffff16565b1115611e45576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330323300000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60606020848b010190506320c13b0b60e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168773ffffffffffffffffffffffffffffffffffffffff166320c13b0b8d846040518363ffffffff1660e01b8152600401808060200180602001838103835285818151815260200191508051906020019080838360005b83811015611ee7578082015181840152602081019050611ecc565b50505050905090810190601f168015611f145780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015611f4d578082015181840152602081019050611f32565b50505050905090810190601f168015611f7a5780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b158015611f9957600080fd5b505afa158015611fad573d6000803e3d6000fd5b505050506040513d6020811015611fc357600080fd5b81019080805190602001909291905050507bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612066576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330323400000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b50506122b2565b60018460ff161415612181578260001c94508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061210a57506000600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008c81526020019081526020016000205414155b61217c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330323500000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6122b1565b601e8460ff1611156122495760018a60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c018281526020019150506040516020818303038152906040528051906020012060048603858560405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015612238573d6000803e3d6000fd5b5050506020604051035194506122b0565b60018a85858560405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156122a3573d6000803e3d6000fd5b5050506020604051035194505b5b5b8573ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161180156123795750600073ffffffffffffffffffffffffffffffffffffffff16600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b80156123b25750600173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b612424576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330323600000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8495508080600101915050611c52565b50505050505050505050565b60008173ffffffffffffffffffffffffffffffffffffffff16600173ffffffffffffffffffffffffffffffffffffffff161415801561250b5750600073ffffffffffffffffffffffffffffffffffffffff16600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b9050919050565b6000600173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156125dd5750600073ffffffffffffffffffffffffffffffffffffffff16600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b9050919050565b6000804690508091505090565b60007fb648d3644f584ed1c2232d53c46d87e693586486ad0d1175f8656013110b714e3386868686604051808673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183600181111561266b57fe5b8152602001828103825284818151815260200191508051906020019080838360005b838110156126a857808201518184015260208101905061268d565b50505050905090810190601f1680156126d55780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a16126f285858585614ab4565b9050949350505050565b6000606061270c868686866125f1565b915060405160203d0181016040523d81523d6000602083013e8091505094509492505050565b606060006020830267ffffffffffffffff8111801561275057600080fd5b506040519080825280601f01601f1916602001820160405280156127835781602001600182028036833780820191505090505b50905060005b838110156127ae57808501548060208302602085010152508080600101915050612789565b508091505092915050565b60076020528060005260406000206000915090505481565b6127d9614989565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580156128435750600173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b6128b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475331303100000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146129b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475331303200000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60016000600173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060016000600173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fecdf3a3effea5783a3c4c2140e677577666428d44ed9d474a0b3a4c9943f844081604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b612b6b614989565b600354811115612be3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303100000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001811015612c5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303200000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b806004819055507f610f7ff2b304ae8903c3de74c60c6ab1f7d6226b3f52c5161905bb5ad4039c936004546040518082815260200191505060405180910390a150565b6000606060055433600454604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405160208183030381529060405290507f66753cd2356569ee081232e3be8909b950e0a76c1f8460c3a5e3c2be32b11bed8d8d8d8d8d8d8d8d8d8d8d8c604051808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c8152602001806020018a6001811115612d5057fe5b81526020018981526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff168152602001806020018060200184810384528e8e82818152602001925080828437600081840152601f19601f820116905080830192505050848103835286818151815260200191508051906020019080838360005b83811015612e0a578082015181840152602081019050612def565b50505050905090810190601f168015612e375780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b83811015612e70578082015181840152602081019050612e55565b50505050905090810190601f168015612e9d5780820380516001836020036101000a031916815260200191505b509f5050505050505050505050505050505060405180910390a1612eca8d8d8d8d8d8d8d8d8d8d8d614c9a565b9150509b9a5050505050505050505050565b6008602052816000526040600020602052806000526040600020600091509150505481565b6000600454905060008111612f7e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330303100000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b612f8a84848484611bbe565b50505050565b6060600060035467ffffffffffffffff81118015612fad57600080fd5b50604051908082528060200260200182016040528015612fdc5781602001602082028036833780820191505090505b50905060008060026000600173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b600173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614613130578083838151811061308757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508180600101925050613046565b82935050505090565b60055481565b600080825160208401855af4806000523d6020523d600060403e60403d016000fd5b6131ac8a8a80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050896151d7565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146131ea576131e9846156d7565b5b6132388787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050615706565b60008211156132525761325082600060018685615941565b505b3373ffffffffffffffffffffffffffffffffffffffff167f141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a88b8b8b8b8960405180806020018581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281038252878782818152602001925060200280828437600081840152601f19601f820116905080830192505050965050505050505060405180910390a250505050505050505050565b6000805a9050613376878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050865a615b47565b61337f57600080fd5b60005a8203905080604051602001808281526020019150506040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561340c5780820151818401526020810190506133f1565b50505050905090810190601f1680156134395780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b606060008267ffffffffffffffff8111801561346257600080fd5b506040519080825280602002602001820160405280156134915781602001602082028036833780820191505090505b509150600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580156135645750600173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b801561356f57508482105b1561362a578084838151811061358157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081806001019250506134fa565b80925081845250509250929050565b600073ffffffffffffffffffffffffffffffffffffffff16600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561373b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330333000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16817ff2a0eb156472d1440255b0d7c1e19cc07115d1051fe605b0dce69acfec884d9c60405160405180910390a350565b60006137ed8c8c8c8c8c8c8c8c8c8c8c614296565b8051906020012090509b9a5050505050505050505050565b61380d614989565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580156138775750600173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b6138e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475331303100000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146139e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475331303300000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507faab4fa2b463f581b2b32cb3b7e3b704b9ce37cc209b5fb4d77e593ace405427681604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15050565b613b9e614989565b60007f4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c860001b90508181557f1151116914515bc0891ff9047a6cb32cf902546f83066499bcf8ba33d2353fa282604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15050565b613c22614989565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015613c8c5750600173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b8015613cc457503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b613d36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303300000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614613e37576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303400000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015613ea15750600173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b613f13576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303300000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614614013576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303500000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507ff8d49fc529812e9a7c5c50e69c20f0dccc0db8fa95c98bc58cc9a4f1c1299eaf82604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a17f9465fa0c962cc76958e6373a993326400c1c94f8be2fe3a952adfa7f60b2ea2681604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1505050565b6000600454905090565b606060007fbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d860001b8d8d8d8d60405180838380828437808301925050509250505060405180910390208c8c8c8c8c8c8c604051602001808c81526020018b73ffffffffffffffffffffffffffffffffffffffff1681526020018a815260200189815260200188600181111561432757fe5b81526020018781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019b505050505050505050505050604051602081830303815290604052805190602001209050601960f81b600160f81b6143b361449f565b8360405160200180857effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152600101847effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526001018381526020018281526020019450505050506040516020818303038152906040529150509b9a5050505050505050505050565b614446614989565b61444f816156d7565b7f5ac6c46c93c8d0e53714ba3b53db3e7c046da994313d7ed0d192028bc7c228b081604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60007f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a7946921860001b6144cd6125e4565b30604051602001808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405160208183030381529060405280519060200120905090565b614525614989565b8060016003540310156145a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303100000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561460a5750600173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b61467c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303300000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461477c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303500000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360008154809291906001900391905055507ff8d49fc529812e9a7c5c50e69c20f0dccc0db8fa95c98bc58cc9a4f1c1299eaf82604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1806004541461494b5761494a81612b63565b5b505050565b6040518060400160405280600581526020017f312e332e3000000000000000000000000000000000000000000000000000000081525081565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614614a2a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330333100000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b565b600080831415614a3f5760009050614a60565b6000828402905082848281614a5057fe5b0414614a5b57600080fd5b809150505b92915050565b60008060008360410260208101860151925060408101860151915060ff60418201870151169350509250925092565b600080828401905083811015614aaa57600080fd5b8091505092915050565b6000600173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015614b7f5750600073ffffffffffffffffffffffffffffffffffffffff16600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b614bf1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475331303400000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b614bfe858585855a615b47565b90508015614c4e573373ffffffffffffffffffffffffffffffffffffffff167f6895c13664aa4f67288b25d7a21d7aaa34916e355fb9b6fae0a139a9085becb860405160405180910390a2614c92565b3373ffffffffffffffffffffffffffffffffffffffff167facd2c8702804128fdb0db2bb49f6d127dd0181c13fd45dbfe16de0930e2bd37560405160405180910390a25b949350505050565b6000806000614cb48e8e8e8e8e8e8e8e8e8e600554614296565b905060056000815480929190600101919050555080805190602001209150614cdd828286612f01565b506000614ce8615b93565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614614ece578073ffffffffffffffffffffffffffffffffffffffff166375f0bb528f8f8f8f8f8f8f8f8f8f8f336040518d63ffffffff1660e01b8152600401808d73ffffffffffffffffffffffffffffffffffffffff1681526020018c8152602001806020018a6001811115614d8b57fe5b81526020018981526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff168152602001806020018473ffffffffffffffffffffffffffffffffffffffff16815260200183810383528d8d82818152602001925080828437600081840152601f19601f820116905080830192505050838103825285818151815260200191508051906020019080838360005b83811015614e5d578082015181840152602081019050614e42565b50505050905090810190601f168015614e8a5780820380516001836020036101000a031916815260200191505b509e505050505050505050505050505050600060405180830381600087803b158015614eb557600080fd5b505af1158015614ec9573d6000803e3d6000fd5b505050505b6101f4614ef56109c48b01603f60408d0281614ee657fe5b04615bc490919063ffffffff16565b015a1015614f6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330313000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005a9050614fd48f8f8f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508e60008d14614fc9578e614fcf565b6109c45a035b615b47565b9350614fe95a82615bde90919063ffffffff16565b90508380614ff8575060008a14155b80615004575060008814155b615076576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330313300000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000808911156150905761508d828b8b8b8b615941565b90505b84156150da577f442e715f626346e8c54381002da614f62bee8d27386535b2521ec8540898556e8482604051808381526020018281526020019250505060405180910390a161511a565b7f23428b18acfb3ea64b08dc0c1d296ea9c09702c09083ca5272e64d115b687d238482604051808381526020018281526020019250505060405180910390a15b5050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146151c6578073ffffffffffffffffffffffffffffffffffffffff16639327136883856040518363ffffffff1660e01b815260040180838152602001821515815260200192505050600060405180830381600087803b1580156151ad57600080fd5b505af11580156151c1573d6000803e3d6000fd5b505050505b50509b9a5050505050505050505050565b60006004541461524f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b81518111156152c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303100000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600181101561533d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303200000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60006001905060005b835181101561564357600084828151811061535d57fe5b60200260200101519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580156153d15750600173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b801561540957503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b801561544157508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b6154b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303300000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146155b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475332303400000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550809250508080600101915050615346565b506001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550825160038190555081600481905550505050565b60007f6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d560001b90508181555050565b600073ffffffffffffffffffffffffffffffffffffffff1660016000600173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614615808576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475331303000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001806000600173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461593d576158ca8260008360015a615b47565b61593c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330303000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b5050565b600080600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461597e5782615980565b325b9050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415615a98576159ea3a86106159c7573a6159c9565b855b6159dc888a614a9590919063ffffffff16565b614a2c90919063ffffffff16565b91508073ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050615a93576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330313100000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b615b3d565b615abd85615aaf888a614a9590919063ffffffff16565b614a2c90919063ffffffff16565b9150615aca848284615bfe565b615b3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f475330313200000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b5095945050505050565b6000600180811115615b5557fe5b836001811115615b6157fe5b1415615b7a576000808551602087018986f49050615b8a565b600080855160208701888a87f190505b95945050505050565b6000807f4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c860001b9050805491505090565b600081831015615bd45781615bd6565b825b905092915050565b600082821115615bed57600080fd5b600082840390508091505092915050565b60008063a9059cbb8484604051602401808373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050602060008251602084016000896127105a03f13d60008114615ca55760208114615cad5760009350615cb8565b819350615cb8565b600051158215171593505b505050939250505056fea2646970667358221220047fac33099ca576d1c4f1ac6a8abdb0396e42ad6a397d2cb2f4dc1624cc0c5b64736f6c63430007060033' + +export const SAFE_FALLBACK_HANDLER_ADDRESS = '0x017062a1dE2FE6b99BE3d9d37841FeD19F573804' +export const SAFE_FALLBACK_HANDLER_CODE = + '0x608060405234801561001057600080fd5b50600436106100ce5760003560e01c80636ac247841161008c578063bc197c8111610066578063bc197c81146107bb578063bd61951d14610951578063f23a6e6114610a63578063ffa1ad7414610b63576100ce565b80636ac24784146105ea578063a3f4df7e146106d9578063b2494df31461075c576100ce565b806223de29146100d357806301ffc9a71461020b5780630a1028c41461026e578063150b7a021461033d5780631626ba7e1461043357806320c13b0b146104e9575b600080fd5b610209600480360360c08110156100e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561017057600080fd5b82018360208201111561018257600080fd5b803590602001918460018302840111640100000000831117156101a457600080fd5b9091929391929390803590602001906401000000008111156101c557600080fd5b8201836020820111156101d757600080fd5b803590602001918460018302840111640100000000831117156101f957600080fd5b9091929391929390505050610be6565b005b6102566004803603602081101561022157600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050610bf0565b60405180821515815260200191505060405180910390f35b6103276004803603602081101561028457600080fd5b81019080803590602001906401000000008111156102a157600080fd5b8201836020820111156102b357600080fd5b803590602001918460018302840111640100000000831117156102d557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610d2a565b6040518082815260200191505060405180910390f35b6103fe6004803603608081101561035357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156103ba57600080fd5b8201836020820111156103cc57600080fd5b803590602001918460018302840111640100000000831117156103ee57600080fd5b9091929391929390505050610d3d565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b6104b46004803603604081101561044957600080fd5b81019080803590602001909291908035906020019064010000000081111561047057600080fd5b82018360208201111561048257600080fd5b803590602001918460018302840111640100000000831117156104a457600080fd5b9091929391929390505050610d52565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b6105b5600480360360408110156104ff57600080fd5b810190808035906020019064010000000081111561051c57600080fd5b82018360208201111561052e57600080fd5b8035906020019184600183028401116401000000008311171561055057600080fd5b90919293919293908035906020019064010000000081111561057157600080fd5b82018360208201111561058357600080fd5b803590602001918460018302840111640100000000831117156105a557600080fd5b9091929391929390505050610f0a565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b6106c36004803603604081101561060057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561063d57600080fd5b82018360208201111561064f57600080fd5b8035906020019184600183028401116401000000008311171561067157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061115b565b6040518082815260200191505060405180910390f35b6106e16112cd565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610721578082015181840152602081019050610706565b50505050905090810190601f16801561074e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610764611306565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107a757808201518184015260208101905061078c565b505050509050019250505060405180910390f35b61091c600480360360a08110156107d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561082e57600080fd5b82018360208201111561084057600080fd5b8035906020019184602083028401116401000000008311171561086257600080fd5b90919293919293908035906020019064010000000081111561088357600080fd5b82018360208201111561089557600080fd5b803590602001918460208302840111640100000000831117156108b757600080fd5b9091929391929390803590602001906401000000008111156108d857600080fd5b8201836020820111156108ea57600080fd5b8035906020019184600183028401116401000000008311171561090c57600080fd5b909192939192939050505061146d565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b6109e86004803603604081101561096757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156109a457600080fd5b8201836020820111156109b657600080fd5b803590602001918460018302840111640100000000831117156109d857600080fd5b9091929391929390505050611485565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a28578082015181840152602081019050610a0d565b50505050905090810190601f168015610a555780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610b2e600480360360a0811015610a7957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190640100000000811115610aea57600080fd5b820183602082011115610afc57600080fd5b80359060200191846001830284011164010000000083111715610b1e57600080fd5b90919293919293905050506114ef565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b610b6b611505565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610bab578082015181840152602081019050610b90565b50505050905090810190601f168015610bd85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b5050505050505050565b60007f4e2312e0000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610cbb57507f150b7a02000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610d2357507f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b6000610d36338361115b565b9050919050565b600063150b7a0260e01b905095945050505050565b60008033905060008173ffffffffffffffffffffffffffffffffffffffff166320c13b0b876040516020018082815260200191505060405160208183030381529060405287876040518463ffffffff1660e01b8152600401808060200180602001838103835286818151815260200191508051906020019080838360005b83811015610deb578082015181840152602081019050610dd0565b50505050905090810190601f168015610e185780820380516001836020036101000a031916815260200191505b508381038252858582818152602001925080828437600081840152601f19601f8201169050808301925050509550505050505060206040518083038186803b158015610e6357600080fd5b505afa158015610e77573d6000803e3d6000fd5b505050506040513d6020811015610e8d57600080fd5b810190808051906020019092919050505090506320c13b0b60e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610ef657600060e01b610eff565b631626ba7e60e01b5b925050509392505050565b6000803390506000610f608288888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061115b565b905060008585905014156110755760008273ffffffffffffffffffffffffffffffffffffffff16635ae6bd37836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610fc157600080fd5b505afa158015610fd5573d6000803e3d6000fd5b505050506040513d6020811015610feb57600080fd5b81019080805190602001909291905050501415611070576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f48617368206e6f7420617070726f76656400000000000000000000000000000081525060200191505060405180910390fd5b611147565b8173ffffffffffffffffffffffffffffffffffffffff1663934f3a1182898989896040518663ffffffff1660e01b81526004018086815260200180602001806020018381038352878782818152602001925080828437600081840152601f19601f8201169050808301925050508381038252858582818152602001925080828437600081840152601f19601f82011690508083019250505097505050505050505060006040518083038186803b15801561112e57600080fd5b505afa158015611142573d6000803e3d6000fd5b505050505b6320c13b0b60e01b92505050949350505050565b6000807f60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca60001b83805190602001206040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209050601960f81b600160f81b8573ffffffffffffffffffffffffffffffffffffffff1663f698da256040518163ffffffff1660e01b815260040160206040518083038186803b15801561120957600080fd5b505afa15801561121d573d6000803e3d6000fd5b505050506040513d602081101561123357600080fd5b81019080805190602001909291905050508360405160200180857effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152600101847effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526001018381526020018281526020019450505050506040516020818303038152906040528051906020012091505092915050565b6040518060400160405280601881526020017f44656661756c742043616c6c6261636b2048616e646c6572000000000000000081525081565b6060600033905060008173ffffffffffffffffffffffffffffffffffffffff1663cc2f84526001600a6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060006040518083038186803b15801561138057600080fd5b505afa158015611394573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060408110156113be57600080fd5b81019080805160405193929190846401000000008211156113de57600080fd5b838201915060208201858111156113f457600080fd5b825186602082028301116401000000008211171561141157600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561144857808201518184015260208101905061142d565b5050505090500160405260200180519060200190929190505050509050809250505090565b600063bc197c8160e01b905098975050505050505050565b60606040517fb4faba09000000000000000000000000000000000000000000000000000000008152600436036004808301376020600036836000335af15060203d036040519250808301604052806020843e6000516114e657825160208401fd5b50509392505050565b600063f23a6e6160e01b90509695505050505050565b6040518060400160405280600581526020017f312e302e300000000000000000000000000000000000000000000000000000008152508156fea26469706673582212204251d58f2a197439239faafa82818b7696d25bb75655794a81cc773a0e39ed2b64736f6c63430007060033' diff --git a/packages/cli/src/test-utils/multisigUtils.ts b/packages/cli/src/test-utils/multisigUtils.ts index 1295b0f6c..95f676080 100644 --- a/packages/cli/src/test-utils/multisigUtils.ts +++ b/packages/cli/src/test-utils/multisigUtils.ts @@ -1,7 +1,22 @@ import { multiSigABI, proxyABI } from '@celo/abis' import { StrongAddress } from '@celo/base' import { ContractKit } from '@celo/contractkit' -import { multiSigBytecode, proxyBytecode } from './constants' +import { setCode } from '@celo/dev-utils/lib/anvil-test' +import Web3 from 'web3' +import { + multiSigBytecode, + proxyBytecode, + SAFE_FALLBACK_HANDLER_ADDRESS, + SAFE_FALLBACK_HANDLER_CODE, + SAFE_MULTISEND_ADDRESS, + SAFE_MULTISEND_CALL_ONLY_ADDRESS, + SAFE_MULTISEND_CALL_ONLY_CODE, + SAFE_MULTISEND_CODE, + SAFE_PROXY_ADDRESS, + SAFE_PROXY_CODE, + SAFE_PROXY_FACTORY_ADDRESS, + SAFE_PROXY_FACTORY_CODE, +} from './constants' export async function createMultisig( kit: ContractKit, @@ -54,3 +69,12 @@ export async function createMultisig( return proxyAddress as StrongAddress } + +export const setupSafeContracts = async (web3: Web3) => { + // Set up safe 1.3.0 in devchain + await setCode(web3, SAFE_MULTISEND_ADDRESS, SAFE_MULTISEND_CODE) + await setCode(web3, SAFE_MULTISEND_CALL_ONLY_ADDRESS, SAFE_MULTISEND_CALL_ONLY_CODE) + await setCode(web3, SAFE_PROXY_FACTORY_ADDRESS, SAFE_PROXY_FACTORY_CODE) + await setCode(web3, SAFE_PROXY_ADDRESS, SAFE_PROXY_CODE) + await setCode(web3, SAFE_FALLBACK_HANDLER_ADDRESS, SAFE_FALLBACK_HANDLER_CODE) +} diff --git a/packages/cli/src/utils/cli.ts b/packages/cli/src/utils/cli.ts index 74e712f93..4d0d565ec 100644 --- a/packages/cli/src/utils/cli.ts +++ b/packages/cli/src/utils/cli.ts @@ -3,10 +3,11 @@ import { CeloTx, Connection, EventLog, - TransactionResult, parseDecodedParams, + TransactionResult, } from '@celo/connect' import { Errors, ux } from '@oclif/core' +import { TransactionResult as SafeTransactionResult } from '@safe-global/types-kit' import BigNumber from 'bignumber.js' import chalk from 'chalk' import { ethers } from 'ethers' @@ -21,6 +22,39 @@ export async function displayWeb3Tx(name: string, txObj: any, tx?: Omit { + if (!(web3.currentProvider instanceof CeloProvider)) { + throw new Error('Unexpected web3 provider') + } + + return await Safe.init({ + provider: web3.currentProvider.toEip1193Provider(), + signer, + safeAddress, + }) +} + +export const safeTransactionMetadataFromCeloTransactionObject = async ( + tx: CeloTransactionObject, + toAddress: StrongAddress +): Promise => { + return { + to: toAddress, + data: tx.txo.encodeABI(), + value: '0', + } +} + +export const performSafeTransaction = async ( + web3: Web3, + safeAddress: StrongAddress, + safeSigner: StrongAddress, + txData: MetaTransactionData +) => { + const safe = await createSafeFromWeb3(web3, safeSigner, safeAddress) + const approveTxPromise = await createApproveSafeTransactionIfNotApproved(safe, txData, safeSigner) + + if (approveTxPromise) { + await displaySafeTx('approveTx', approveTxPromise) + } + + const executeTxPromise = await createExecuteSafeTransactionIfThresholdMet(safe, txData) + + if (executeTxPromise) { + await displaySafeTx('executeTx', executeTxPromise) + } +} + +const createApproveSafeTransactionIfNotApproved = async ( + safe: Safe, + txData: MetaTransactionData, + ownerAddress: StrongAddress +): Promise => { + const txHash = await safe.getTransactionHash( + await safe.createTransaction({ + transactions: [txData], + }) + ) + + if (!(await safe.getOwnersWhoApprovedTx(txHash)).includes(ownerAddress)) { + return await safe.approveTransactionHash(txHash) + } + + return null +} + +const createExecuteSafeTransactionIfThresholdMet = async ( + safe: Safe, + txData: MetaTransactionData +): Promise => { + const tx = await safe.createTransaction({ + transactions: [txData], + }) + const txHash = await safe.getTransactionHash(tx) + + if ((await safe.getOwnersWhoApprovedTx(txHash)).length >= (await safe.getThreshold())) { + return await safe.executeTransaction(tx) + } + + return null +} diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 66147c769..3e5da1670 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -1,5 +1,14 @@ # @celo/dev-utils +## 0.0.7-beta.1 + +### Patch Changes + +- [#420](https://github.com/celo-org/developer-tooling/pull/420) [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444) Thanks [@shazarre](https://github.com/shazarre)! - Adds actual Celo chain id when running anvil + +- Updated dependencies [[`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/connect@6.1.0-beta.1 + ## 0.0.6-beta.1 ### Patch Changes @@ -13,6 +22,12 @@ - Updated dependencies []: - @celo/connect@6.0.3-beta.0 +## 0.0.6 + +### Patch Changes + +- [#409](https://github.com/celo-org/developer-tooling/pull/409) [`e709b88`](https://github.com/celo-org/developer-tooling/commit/e709b8821315e354e418649320b5f93a7a464c16) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Upgrades to latest devchain + ## 0.0.5 ### Patch Changes diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index d22f57ef6..326418ffd 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@celo/dev-utils", - "version": "0.0.6-beta.1", + "version": "0.0.7-beta.1", "description": "util package for celo packages that should only be a devDependency", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -21,7 +21,7 @@ }, "dependencies": { "@celo/abis": "^11.0.0", - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@viem/anvil": "^0.0.9", "bignumber.js": "^9.0.0", "fs-extra": "^8.1.0", diff --git a/packages/dev-utils/src/anvil-test.ts b/packages/dev-utils/src/anvil-test.ts index 56ed7c0ae..abd334d53 100644 --- a/packages/dev-utils/src/anvil-test.ts +++ b/packages/dev-utils/src/anvil-test.ts @@ -32,7 +32,7 @@ export enum LinkedLibraryAddress { Signatures = '0xe7f1725e7734ce288f8367e1bb143e90bb3f0512', } -function createInstance(stateFilePath: string): Anvil { +function createInstance(stateFilePath: string, chainId?: number): Anvil { const port = ANVIL_PORT + (process.pid - process.ppid) const options: CreateAnvilOptions = { port, @@ -43,6 +43,7 @@ function createInstance(stateFilePath: string): Anvil { gasLimit: TEST_GAS_LIMIT, blockBaseFeePerGas: 0, stopTimeout: 1000, + chainId, } instance = createAnvil(options) @@ -50,16 +51,33 @@ function createInstance(stateFilePath: string): Anvil { return instance } -export function testWithAnvilL1(name: string, fn: (web3: Web3) => void) { - return testWithAnvil(require.resolve('@celo/devchain-anvil/devchain.json'), name, fn) +type TestWithAnvilOptions = { + chainId?: number } -export function testWithAnvilL2(name: string, fn: (web3: Web3) => void) { - return testWithAnvil(require.resolve('@celo/devchain-anvil/l2-devchain.json'), name, fn) +export function testWithAnvilL1( + name: string, + fn: (web3: Web3) => void, + options?: TestWithAnvilOptions +) { + return testWithAnvil(require.resolve('@celo/devchain-anvil/devchain.json'), name, fn, options) } -function testWithAnvil(stateFilePath: string, name: string, fn: (web3: Web3) => void) { - const anvil = createInstance(stateFilePath) +export function testWithAnvilL2( + name: string, + fn: (web3: Web3) => void, + options?: TestWithAnvilOptions +) { + return testWithAnvil(require.resolve('@celo/devchain-anvil/l2-devchain.json'), name, fn, options) +} + +function testWithAnvil( + stateFilePath: string, + name: string, + fn: (web3: Web3) => void, + options?: TestWithAnvilOptions +) { + const anvil = createInstance(stateFilePath, options?.chainId) // for each test suite, we start and stop a new anvil instance return testWithWeb3(name, `http://127.0.0.1:${anvil.port}`, fn, { diff --git a/packages/sdk/connect/CHANGELOG.md b/packages/sdk/connect/CHANGELOG.md index 895f94ea8..355b15017 100644 --- a/packages/sdk/connect/CHANGELOG.md +++ b/packages/sdk/connect/CHANGELOG.md @@ -1,5 +1,11 @@ # @celo/connect +## 6.1.0-beta.1 + +### Minor Changes + +- [#420](https://github.com/celo-org/developer-tooling/pull/420) [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444) Thanks [@shazarre](https://github.com/shazarre)! - Now CeloProvider can be wrapped in EIP-1193 partially compatible object (request + args) + ## 6.0.3-beta.0 ### Patch Changes diff --git a/packages/sdk/connect/jest.config.js b/packages/sdk/connect/jest.config.js index c0198cdd3..d8d33f1d1 100644 --- a/packages/sdk/connect/jest.config.js +++ b/packages/sdk/connect/jest.config.js @@ -1,5 +1,5 @@ module.exports = { preset: 'ts-jest', - testMatch: ['/src/**/?(*.)+(spec|test).ts?(x)'], + testMatch: ['/src/**/?(*.)+(spec|test).ts'], verbose: true, } diff --git a/packages/sdk/connect/package.json b/packages/sdk/connect/package.json index 66e0145bf..b5749d73b 100644 --- a/packages/sdk/connect/package.json +++ b/packages/sdk/connect/package.json @@ -1,6 +1,6 @@ { "name": "@celo/connect", - "version": "6.0.3-beta.0", + "version": "6.1.0-beta.1", "description": "Light Toolkit for connecting with the Celo network", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/packages/sdk/connect/src/celo-provider.ts b/packages/sdk/connect/src/celo-provider.ts index fce5b071c..cde7d6301 100644 --- a/packages/sdk/connect/src/celo-provider.ts +++ b/packages/sdk/connect/src/celo-provider.ts @@ -4,6 +4,8 @@ import debugFactory from 'debug' import { Connection } from './connection' import { Callback, + Eip1193Provider, + Eip1193RequestArguments, EncodedTransaction, Error, JsonRpcPayload, @@ -168,6 +170,30 @@ export class CeloProvider implements Provider { } } + toEip1193Provider(): Eip1193Provider { + return { + request: async (args: Eip1193RequestArguments) => { + return new Promise((resolve, reject) => { + this.send( + { + id: 0, + jsonrpc: '2.0', + method: args.method, + params: args.params as any[], + }, + (error: Error | null, result: unknown) => { + if (error) { + reject(error) + } else { + resolve((result as any).result) + } + } + ) + }) + }, + } + } + private async handleAccounts(_payload: JsonRpcPayload): Promise { return this.connection.getAccounts() } diff --git a/packages/sdk/connect/src/types.ts b/packages/sdk/connect/src/types.ts index 60c65bcee..519349a7b 100644 --- a/packages/sdk/connect/src/types.ts +++ b/packages/sdk/connect/src/types.ts @@ -147,3 +147,13 @@ export interface RLPEncodedTx { rlpEncode: Hex type: TransactionTypes } + +// Based on https://eips.ethereum.org/EIPS/eip-1193 +export interface Eip1193RequestArguments { + readonly method: string + readonly params?: readonly unknown[] | object +} + +export interface Eip1193Provider { + request(args: Eip1193RequestArguments): Promise +} diff --git a/packages/sdk/contractkit/CHANGELOG.md b/packages/sdk/contractkit/CHANGELOG.md index f7a765ea5..c16a75e81 100644 --- a/packages/sdk/contractkit/CHANGELOG.md +++ b/packages/sdk/contractkit/CHANGELOG.md @@ -1,5 +1,13 @@ # @celo/contractkit +## 9.0.0-beta.2 + +### Patch Changes + +- Updated dependencies [[`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3), [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/wallet-local@6.0.3-beta.1 + - @celo/connect@6.1.0-beta.1 + ## 9.0.0-beta.1 ### Minor Changes @@ -64,6 +72,12 @@ - @celo/connect@6.0.3-beta.0 - @celo/wallet-local@6.0.2-beta.0 +## 8.3.1 + +### Patch Changes + +- [#409](https://github.com/celo-org/developer-tooling/pull/409) [`e709b88`](https://github.com/celo-org/developer-tooling/commit/e709b8821315e354e418649320b5f93a7a464c16) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Renames `getElected` and its usages to `getElectedAccounts` for `EpochManagerWrapper` + ## 8.3.0 ### Minor Changes diff --git a/packages/sdk/contractkit/package.json b/packages/sdk/contractkit/package.json index 7ae6d8783..2a8f0b214 100644 --- a/packages/sdk/contractkit/package.json +++ b/packages/sdk/contractkit/package.json @@ -1,6 +1,6 @@ { "name": "@celo/contractkit", - "version": "9.0.0-beta.1", + "version": "9.0.0-beta.2", "description": "Celo's ContractKit to interact with Celo network", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -29,9 +29,9 @@ "@celo/abis": "11.0.0", "@celo/abis-12": "npm:@celo/abis@12.0.0-canary.60", "@celo/base": "^7.0.0-beta.0", - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@celo/utils": "^8.0.0-beta.0", - "@celo/wallet-local": "^6.0.2-beta.1", + "@celo/wallet-local": "^6.0.4-beta.0", "@types/bn.js": "^5.1.0", "@types/debug": "^4.1.5", "bignumber.js": "^9.0.0", @@ -43,7 +43,7 @@ }, "devDependencies": { "@celo/celo-devchain": "^7.0.0", - "@celo/dev-utils": "0.0.6-beta.1", + "@celo/dev-utils": "0.0.7-beta.1", "@celo/odis-identifiers": "^1.0.1", "@celo/typescript": "workspace:^", "@truffle/contract": "4.6.31", diff --git a/packages/sdk/explorer/CHANGELOG.md b/packages/sdk/explorer/CHANGELOG.md index bd91b91bf..50642ef8b 100644 --- a/packages/sdk/explorer/CHANGELOG.md +++ b/packages/sdk/explorer/CHANGELOG.md @@ -1,5 +1,13 @@ # @celo/explorer +## 5.0.13-beta.1 + +### Patch Changes + +- Updated dependencies [[`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/connect@6.1.0-beta.1 + - @celo/contractkit@9.0.0-beta.2 + ## 5.0.13-beta.0 ### Patch Changes diff --git a/packages/sdk/explorer/package.json b/packages/sdk/explorer/package.json index bded469b0..f201d2716 100644 --- a/packages/sdk/explorer/package.json +++ b/packages/sdk/explorer/package.json @@ -1,6 +1,6 @@ { "name": "@celo/explorer", - "version": "5.0.13-beta.0", + "version": "5.0.13-beta.1", "description": "Celo's block explorer consumer", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -23,8 +23,8 @@ }, "dependencies": { "@celo/base": "^7.0.0-beta.0", - "@celo/connect": "^6.0.3-beta.0", - "@celo/contractkit": "^9.0.0-beta.1", + "@celo/connect": "^6.1.0-beta.1", + "@celo/contractkit": "^9.0.0-beta.2", "@celo/utils": "^8.0.0-beta.0", "@types/debug": "^4.1.5", "bignumber.js": "9.0.0", @@ -32,7 +32,7 @@ "debug": "^4.1.1" }, "devDependencies": { - "@celo/dev-utils": "0.0.6-beta.1", + "@celo/dev-utils": "0.0.7-beta.1", "@celo/typescript": "workspace:^", "@types/debug": "^4.1.12", "fetch-mock": "^10.0.7", diff --git a/packages/sdk/governance/CHANGELOG.md b/packages/sdk/governance/CHANGELOG.md index 88166fdc6..d53c89707 100644 --- a/packages/sdk/governance/CHANGELOG.md +++ b/packages/sdk/governance/CHANGELOG.md @@ -1,5 +1,18 @@ # @celo/governance +## 5.1.4-beta.1 + +### Patch Changes + +- [#421](https://github.com/celo-org/developer-tooling/pull/421) [`7d42a05`](https://github.com/celo-org/developer-tooling/commit/7d42a059f1effa8953ee1fe2e66f7e26bca73181) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - minor update to inquirer lib + +- [#421](https://github.com/celo-org/developer-tooling/pull/421) [`7d42a05`](https://github.com/celo-org/developer-tooling/commit/7d42a059f1effa8953ee1fe2e66f7e26bca73181) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Fix being unable to use 08 and mento contracts with proposal builder + +- Updated dependencies [[`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/connect@6.1.0-beta.1 + - @celo/contractkit@9.0.0-beta.2 + - @celo/explorer@5.0.13-beta.1 + ## 5.1.4-beta.0 ### Patch Changes diff --git a/packages/sdk/governance/jest.config.js b/packages/sdk/governance/jest.config.js new file mode 100644 index 000000000..07682369a --- /dev/null +++ b/packages/sdk/governance/jest.config.js @@ -0,0 +1,7 @@ +module.exports = { + preset: 'ts-jest', + testMatch: ['/src/**/?(*.)+(test).ts'], + setupFilesAfterEnv: ['@celo/dev-utils/lib/matchers', '/jest_setup.ts'], + globalSetup: '/src/test-utils/setup.global.ts', + verbose: true, +} diff --git a/packages/sdk/governance/jest_setup.ts b/packages/sdk/governance/jest_setup.ts new file mode 100644 index 000000000..69170cbb3 --- /dev/null +++ b/packages/sdk/governance/jest_setup.ts @@ -0,0 +1,12 @@ +import { URL } from 'node:url' +// @ts-ignore +global.URL = URL + +// @ts-ignore +const fetchMock = require('fetch-mock') + +const fetchMockSandbox = fetchMock.sandbox() +jest.mock('cross-fetch', () => fetchMockSandbox) + +// @ts-ignore +global.fetchMock = fetchMockSandbox diff --git a/packages/sdk/governance/package.json b/packages/sdk/governance/package.json index b363dca2f..75b11fabd 100644 --- a/packages/sdk/governance/package.json +++ b/packages/sdk/governance/package.json @@ -1,6 +1,6 @@ { "name": "@celo/governance", - "version": "5.1.4-beta.0", + "version": "5.1.4-beta.1", "description": "Celo's governance proposals", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -16,28 +16,30 @@ "build": "yarn run --top-level tsc -b .", "clean": "yarn run --top-level tsc -b . --clean", "docs": "yarn run --top-level typedoc", - "test": "yarn run --top-level jest --runInBand --passWithNoTests", + "test": "NODE_OPTIONS='--experimental-vm-modules' yarn run --top-level jest --runInBand s --workerIdleMemoryLimit=0.1", "lint": "yarn run --top-level eslint -c .eslintrc.js ", "prepublishOnly": "yarn build" }, "dependencies": { "@celo/abis": "11.0.0", + "@celo/abis-12": "npm:@celo/abis@12.0.0-canary.60", "@celo/base": "^7.0.0-beta.0", - "@celo/connect": "^6.0.3-beta.0", - "@celo/contractkit": "^9.0.0-beta.0", - "@celo/explorer": "^5.0.13-beta.0", + "@celo/connect": "^6.1.0-beta.1", + "@celo/contractkit": "^9.0.0-beta.2", + "@celo/explorer": "^5.0.13-beta.1", "@celo/utils": "^8.0.0-beta.0", "@ethereumjs/util": "8.0.5", "@types/debug": "^4.1.5", "@types/inquirer": "^6.5.0", "bignumber.js": "^9.0.0", "debug": "^4.1.1", - "inquirer": "^7.0.5" + "inquirer": "^7.3.3" }, "engines": { "node": ">=8.14.2" }, "devDependencies": { + "@celo/dev-utils": "0.0.7-beta.1", "@celo/typescript": "workspace:^", "@types/debug": "^4.1.12" } diff --git a/packages/sdk/governance/src/interactive-proposal-builder.test.ts b/packages/sdk/governance/src/interactive-proposal-builder.test.ts new file mode 100644 index 000000000..2707badfa --- /dev/null +++ b/packages/sdk/governance/src/interactive-proposal-builder.test.ts @@ -0,0 +1,109 @@ +import { newKitFromWeb3, RegisteredContracts } from '@celo/contractkit' +import inquirer from 'inquirer' +import { InteractiveProposalBuilder, requireABI } from './interactive-proposal-builder' +import { ProposalBuilder } from './proposal-builder' +jest.mock('inquirer') + +import { testWithAnvilL2 } from '@celo/dev-utils/lib/anvil-test' + +describe('all registered contracts can be required', () => { + RegisteredContracts.forEach((contract) => { + it(`required ${contract} contract`, async () => { + const contractABI = requireABI(contract) + expect(contractABI).toBeDefined() + expect(Array.isArray(contractABI)).toBeTruthy() + expect(contractABI.filter).toBeDefined() + }) + }) +}) + +testWithAnvilL2('InteractiveProposalBuilder', (web3) => { + let builder: ProposalBuilder + let interactiveBuilder: InteractiveProposalBuilder + let fromJsonTxSpy: jest.SpyInstance + + beforeEach(() => { + const kit = newKitFromWeb3(web3) + builder = new ProposalBuilder(kit) + fromJsonTxSpy = jest.spyOn(builder, 'fromJsonTx') + interactiveBuilder = new InteractiveProposalBuilder(builder) + }) + + describe('promptTransactions', () => { + it('should prompt for transactions and return them', async () => { + const mockPrompt = jest.spyOn(inquirer, 'prompt') + mockPrompt + .mockResolvedValueOnce({ 'Celo Contract': 'Governance' }) + .mockResolvedValueOnce({ 'Governance Function': 'setConstitution' }) + .mockResolvedValueOnce({ destination: '0x19F78d207493Bf6f7E8D54900d01bb387F211b28' }) + .mockResolvedValueOnce({ functionId: '0xa91ee0dc' }) + .mockResolvedValueOnce({ threshold: '900000000000000000000000' }) + .mockResolvedValueOnce({ 'Celo Contract': '✔ done' }) + + const transactions = await interactiveBuilder.promptTransactions() + + expect(transactions).toEqual([ + { + contract: 'Governance', + function: 'setConstitution', + args: [ + '0x19F78d207493Bf6f7E8D54900d01bb387F211b28', + '0xa91ee0dc', + '900000000000000000000000', + ], + value: '0', + }, + ]) + expect(fromJsonTxSpy.mock.calls).toMatchInlineSnapshot(` + [ + [ + { + "args": [ + "0x19F78d207493Bf6f7E8D54900d01bb387F211b28", + "0xa91ee0dc", + "900000000000000000000000", + ], + "contract": "Governance", + "function": "setConstitution", + "value": "0", + }, + ], + ] + `) + }) + + it('should handle invalid transactions and retry', async () => { + const mockPrompt = jest.spyOn(inquirer, 'prompt') + mockPrompt + .mockResolvedValueOnce({ 'Celo Contract': 'Governance' }) + .mockResolvedValueOnce({ 'Governance Function': 'setConstitution' }) + .mockResolvedValueOnce({ destination: 'invalid' }) + .mockResolvedValueOnce({ functionId: 'invalid' }) + .mockResolvedValueOnce({ threshold: '900000000000000000000000' }) + .mockResolvedValueOnce({ 'Celo Contract': '✔ done' }) + + const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation() + + const transactions = await interactiveBuilder.promptTransactions() + + expect(transactions).toEqual([]) // No valid transactions added + expect(fromJsonTxSpy.mock.calls).toMatchInlineSnapshot(` + [ + [ + { + "args": [ + "invalid", + "invalid", + "900000000000000000000000", + ], + "contract": "Governance", + "function": "setConstitution", + "value": "0", + }, + ], + ] + `) + consoleErrorSpy.mockRestore() + }) + }) +}) diff --git a/packages/sdk/governance/src/interactive-proposal-builder.ts b/packages/sdk/governance/src/interactive-proposal-builder.ts new file mode 100644 index 000000000..6fed2e976 --- /dev/null +++ b/packages/sdk/governance/src/interactive-proposal-builder.ts @@ -0,0 +1,139 @@ +import { isHexString } from '@celo/base/lib/address' +import { ABIDefinition } from '@celo/connect' +import { CeloContract, RegisteredContracts } from '@celo/contractkit' +import { isValidAddress } from '@celo/utils/lib/address' +import BigNumber from 'bignumber.js' +import inquirer from 'inquirer' +import { ProposalBuilder } from './proposal-builder' + +import type { ProposalTransactionJSON } from './' + +const DONE_CHOICE = '✔ done' + +export class InteractiveProposalBuilder { + constructor(private readonly builder: ProposalBuilder) {} + + async outputTransactions() { + const transactionList = this.builder.build() + console.log(JSON.stringify(transactionList, null, 2)) + } + + async promptTransactions() { + const transactions: ProposalTransactionJSON[] = [] + // eslint-disable-next-line no-constant-condition + while (true) { + console.log(`Transaction #${transactions.length + 1}:`) + + // prompt for contract + const contractPromptName = 'Celo Contract' + const contractAnswer = await inquirer.prompt({ + name: contractPromptName, + type: 'list', + choices: [DONE_CHOICE, ...RegisteredContracts], + }) + const choice = contractAnswer[contractPromptName] + if (choice === DONE_CHOICE) { + break + } + + const contractName = choice as CeloContract + + const contractABI = requireABI(contractName) + + const txMethods = contractABI.filter( + (def) => def.type === 'function' && def.stateMutability !== 'view' + ) + const txMethodNames = txMethods.map((def) => def.name!) + // prompt for function + const functionPromptName = contractName + ' Function' + const functionAnswer = await inquirer.prompt>({ + name: functionPromptName, + type: 'list', + choices: txMethodNames, + }) + const functionName = functionAnswer[functionPromptName] + const idx = txMethodNames.findIndex((m) => m === functionName) + const txDefinition = txMethods[idx] + // prompt individually for each argument + const args = [] + for (const functionInput of txDefinition.inputs!) { + const inputAnswer: Record = await inquirer.prompt({ + name: functionInput.name, + type: 'input', + validate: async (input: string) => { + switch (functionInput.type) { + case 'uint256': + try { + new BigNumber(input) + return true + } catch (e) { + return false + } + case 'boolean': + return input === 'true' || input === 'false' + case 'address': + return isValidAddress(input) + case 'bytes': + return isHexString(input) + default: + return true + } + }, + }) + + const answer: string = inputAnswer[functionInput.name] + // transformedValue may not be in scientific notation + const transformedValue = + functionInput.type === 'uint256' ? new BigNumber(answer).toString(10) : answer + args.push(transformedValue) + } + // prompt for value only when tx is payable + let value: string + if (txDefinition.payable) { + const valuePromptName = 'Value' + const valueAnswer = await inquirer.prompt({ + name: valuePromptName, + type: 'input', + }) + value = valueAnswer[valuePromptName] + } else { + value = '0' + } + const tx: ProposalTransactionJSON = { + contract: contractName, + function: functionName, + args, + value, + } + + try { + // use fromJsonTx as well-formed tx validation + await this.builder.fromJsonTx(tx) + transactions.push(tx) + } catch (error) { + console.error(error) + console.error('Please retry forming this transaction') + } + } + + return transactions + } +} +export function requireABI(contractName: CeloContract): ABIDefinition[] { + // search thru multiple paths to find the ABI + for (const path of ['', '0.8/', 'mento/']) { + const abi = safeRequire(contractName, path) + if (abi !== null) { + return abi + } + } + throw new Error(`Cannot require ABI for ${contractName}`) +} + +function safeRequire(contractName: CeloContract, subPath?: string) { + try { + return require(`@celo/abis-12/web3/${subPath ?? ''}${contractName}`).ABI as ABIDefinition[] + } catch { + return null + } +} diff --git a/packages/sdk/governance/src/proposal-builder.test.ts b/packages/sdk/governance/src/proposal-builder.test.ts new file mode 100644 index 000000000..1b6c64032 --- /dev/null +++ b/packages/sdk/governance/src/proposal-builder.test.ts @@ -0,0 +1,138 @@ +import { AbiItem } from '@celo/connect' +import { CeloContract, ContractKit, newKit } from '@celo/contractkit' +import BigNumber from 'bignumber.js' +import { ProposalBuilder } from './proposal-builder' +describe('ProposalBuilder', () => { + let kit: ContractKit + let proposalBuilder: ProposalBuilder + + beforeEach(() => { + kit = newKit('https://alfajores-forno.celo-testnet.org') + proposalBuilder = new ProposalBuilder(kit) + }) + + describe('build', () => { + it('when no tx are in memory builds an empty proposal', async () => { + const proposal = await proposalBuilder.build() + expect(proposal).toEqual([]) + }) + }) + + describe('addWeb3Tx', () => { + it('adds and builds a Web3 transaction', async () => { + const wrapper = await kit.contracts.getGovernance() + const tx = await wrapper.approve(new BigNumber('125')) + proposalBuilder.addWeb3Tx(tx.txo, { to: '0x5678', value: '1000' }) + const proposal = await proposalBuilder.build() + expect(proposal).toEqual([ + { + to: '0x5678', + value: '1000', + input: + '0x5d35a3d9000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000038', + }, + ]) + }) + }) + + describe('addProxyRepointingTx', () => { + it('adds and builds a proxy repointing transaction', async () => { + const contract = CeloContract.GoldToken + const newImplementationAddress = '0x471ece3750da237f93b8e339c536989b8978a438' + + proposalBuilder.addProxyRepointingTx(contract, newImplementationAddress) + const proposal = await proposalBuilder.build() + + expect(proposal.length).toBe(1) + expect(proposal[0].to).toBeDefined() + expect(proposal[0].value).toBe('0') + }) + }) + + describe('setRegistryAddition', () => { + it('sets and gets registry addition', () => { + const contract = CeloContract.GoldToken + const address = '0x471ece3750da237f93b8e339c536989b8978a438' + + proposalBuilder.setRegistryAddition(contract, address) + const result = proposalBuilder.getRegistryAddition(contract) + + expect(result).toBe(address) + }) + }) + + describe('isRegistryContract', () => { + it('identifies registry contracts', () => { + const contract = CeloContract.GoldToken + const address = '0x471ece3750da237f93b8e339c536989b8978a438' + + proposalBuilder.setRegistryAddition(contract, address) + const result = proposalBuilder.isRegistryContract(contract) + + expect(result).toBe(true) + }) + }) + + describe('buildCallToExternalContract', () => { + it('builds call to external contract', async () => { + const tx = { + function: 'testFunction', + args: [], + value: '0', + address: '0xa435d2BaBDF80A66eD06A8D981edFE6f5DdAeCfB', + } + + const abiItem: AbiItem = { + name: 'testFunction', + type: 'function', + inputs: [], + outputs: [], + } + + proposalBuilder.lookupExternalMethodABI = async () => abiItem + + const result = await proposalBuilder.buildCallToExternalContract(tx) + + expect(result).toEqual({ + to: '0xa435d2BaBDF80A66eD06A8D981edFE6f5DdAeCfB', + value: '0', + input: '0xe16b4a9b', + }) + }) + }) + + describe('buildCallToCoreContract', () => { + it('builds call to core contract', async () => { + const tx = { + contract: CeloContract.GoldToken, + function: 'transfer', + args: ['0xa435d2BaBDF80A66eD06A8D981edFE6f5DdAeCfB', '1000'], + value: '0', + } + const result = await proposalBuilder.buildCallToCoreContract(tx) + + expect(result.to).toBeDefined() + expect(result.value).toBe('0') + expect(result.input).toBeDefined() + }) + }) + + describe('addJsonTx', () => { + it('adds and builds a JSON transaction', async () => { + const tx = { + contract: CeloContract.GoldToken, + function: 'transfer', + args: ['0xa435d2BaBDF80A66eD06A8D981edFE6f5DdAeCfB', '1000'], + value: '0', + } + + proposalBuilder.addJsonTx(tx) + const proposal = await proposalBuilder.build() + + expect(proposal.length).toBe(1) + expect(proposal[0].to).toBeDefined() + expect(proposal[0].value).toBe('0') + expect(proposal[0].input).toBeDefined() + }) + }) +}) diff --git a/packages/sdk/governance/src/proposal-builder.ts b/packages/sdk/governance/src/proposal-builder.ts new file mode 100644 index 000000000..ef6fad48a --- /dev/null +++ b/packages/sdk/governance/src/proposal-builder.ts @@ -0,0 +1,261 @@ +import { + AbiItem, + CeloTransactionObject, + CeloTxObject, + Contract, + signatureToAbiDefinition, +} from '@celo/connect' +import { + CeloContract, + ContractKit, + RegisteredContracts, + SET_AND_INITIALIZE_IMPLEMENTATION_ABI, + getInitializeAbiOfImplementation, + setImplementationOnProxy, +} from '@celo/contractkit' +import { stripProxy } from '@celo/contractkit/lib/base' +import { valueToString } from '@celo/contractkit/lib/wrappers/BaseWrapper' +import { ProposalTransaction } from '@celo/contractkit/lib/wrappers/Governance' +import { fetchMetadata, tryGetProxyImplementation } from '@celo/explorer/lib/sourcify' +import { isValidAddress } from '@celo/utils/lib/address' +import { + ExternalProposalTransactionJSON, + ProposalTransactionJSON, + ProposalTxParams, + RegistryAdditions, + debug, + isProxySetAndInitFunction, + isProxySetFunction, + isRegistryRepoint, + registryRepointArgs, +} from './proposals' + +/** + * Builder class to construct proposals from JSON or transaction objects. + */ + +export class ProposalBuilder { + externalCallProxyRepoint: Map = new Map() + + constructor( + private readonly kit: ContractKit, + private readonly builders: (() => Promise)[] = [], + public readonly registryAdditions: RegistryAdditions = {} + ) {} + + /** + * Build calls all of the added build steps and returns the final proposal. + * @returns A constructed Proposal object (i.e. a list of ProposalTransaction) + */ + build = async () => { + const ret = [] + for (const builder of this.builders) { + ret.push(await builder()) + } + return ret + } + + /** + * Converts a Web3 transaction into a proposal transaction object. + * @param tx A Web3 transaction object to convert. + * @param params Parameters for how the transaction should be executed. + */ + fromWeb3tx = (tx: CeloTxObject, params: ProposalTxParams): ProposalTransaction => ({ + value: params.value, + to: params.to, + input: tx.encodeABI(), + }) + + /** + * Adds a transaction to set the implementation on a proxy to the given address. + * @param contract Celo contract name of the proxy which should have its implementation set. + * @param newImplementationAddress Address of the new contract implementation. + */ + addProxyRepointingTx = (contract: CeloContract, newImplementationAddress: string) => { + this.builders.push(async () => { + const proxy = await this.kit._web3Contracts.getContract(contract) + return this.fromWeb3tx( + setImplementationOnProxy(newImplementationAddress, this.kit.connection.web3), + { + to: proxy.options.address, + value: '0', + } + ) + }) + } + + /** + * Adds a Web3 transaction to the list for proposal construction. + * @param tx A Web3 transaction object to add to the proposal. + * @param params Parameters for how the transaction should be executed. + */ + addWeb3Tx = (tx: CeloTxObject, params: ProposalTxParams) => + this.builders.push(async () => this.fromWeb3tx(tx, params)) + + /** + * Adds a Celo transaction to the list for proposal construction. + * @param tx A Celo transaction object to add to the proposal. + * @param params Optional parameters for how the transaction should be executed. + */ + addTx(tx: CeloTransactionObject, params: Partial = {}) { + const to = params.to ?? tx.defaultParams?.to + const value = params.value ?? tx.defaultParams?.value + if (!to || !value) { + throw new Error("Transaction parameters 'to' and/or 'value' not provided") + } + this.addWeb3Tx(tx.txo, { to, value: valueToString(value.toString()) }) + } + + setRegistryAddition = (contract: CeloContract, address: string) => + (this.registryAdditions[stripProxy(contract)] = address) + + getRegistryAddition = (contract: CeloContract): string | undefined => + this.registryAdditions[stripProxy(contract)] + + isRegistryContract = (contract: CeloContract) => + RegisteredContracts.includes(stripProxy(contract)) || + this.getRegistryAddition(contract) !== undefined + + /* + * @deprecated - use isRegistryContract + */ + isRegistered = this.isRegistryContract + + lookupExternalMethodABI = async ( + address: string, + tx: ExternalProposalTransactionJSON + ): Promise => { + const abiCoder = this.kit.connection.getAbiCoder() + const metadata = await fetchMetadata( + this.kit.connection, + this.kit.web3.utils.toChecksumAddress(address) + ) + const potentialABIs = metadata?.abiForMethod(tx.function) ?? [] + return ( + potentialABIs.find((abi) => { + try { + abiCoder.encodeFunctionCall(abi, this.transformArgs(abi, tx.args)) + return true + } catch { + return false + } + }) || null + ) + } + + buildCallToExternalContract = async ( + tx: ExternalProposalTransactionJSON + ): Promise => { + if (!tx.address || !isValidAddress(tx.address)) { + throw new Error(`${tx.contract} is not a core celo contract so address must be specified`) + } + + if (tx.function === '') { + return { input: '', to: tx.address, value: tx.value } + } + + let methodABI: AbiItem | null = await this.lookupExternalMethodABI(tx.address, tx) + if (methodABI === null) { + const proxyImpl = this.externalCallProxyRepoint.has(tx.address) + ? this.externalCallProxyRepoint.get(tx.address) + : await tryGetProxyImplementation(this.kit.connection, tx.address) + + if (proxyImpl) { + methodABI = await this.lookupExternalMethodABI(proxyImpl, tx) + } + } + + if (methodABI === null) { + methodABI = signatureToAbiDefinition(tx.function) + } + + const input = this.kit.connection + .getAbiCoder() + .encodeFunctionCall(methodABI, this.transformArgs(methodABI, tx.args)) + return { input, to: tx.address, value: tx.value } + } + + /* + * @deprecated use buildCallToExternalContract + * + */ + buildFunctionCallToExternalContract = this.buildCallToExternalContract + + transformArgs = (abi: AbiItem, args: any[]) => { + if (abi.inputs?.length !== args.length) { + throw new Error( + `ABI inputs length ${abi.inputs?.length} does not match args length ${args.length}` + ) + } + const res = [] + for (let i = 0; i < args.length; i++) { + const input = abi.inputs![i] + if (input.type === 'tuple') { + // support of structs and tuples + res.push(JSON.parse(args[i])) + } else { + res.push(args[i]) + } + } + return res + } + + buildCallToCoreContract = async (tx: ProposalTransactionJSON): Promise => { + // Account for canonical registry addresses from current proposal + const address = + this.getRegistryAddition(tx.contract) ?? (await this.kit.registry.addressFor(tx.contract)) + + if (tx.address && address !== tx.address) { + throw new Error(`Address mismatch for ${tx.contract}: ${address} !== ${tx.address}`) + } + + if (tx.function === SET_AND_INITIALIZE_IMPLEMENTATION_ABI.name && Array.isArray(tx.args[1])) { + // Transform array of initialize arguments (if provided) into delegate call data + tx.args[1] = this.kit.connection + .getAbiCoder() + .encodeFunctionCall(getInitializeAbiOfImplementation(tx.contract as any), tx.args[1]) + } + + const contract = await this.kit._web3Contracts.getContract(tx.contract, address) + const methodName = tx.function + const method = (contract.methods as Contract['methods'])[methodName] + if (!method) { + throw new Error(`Method ${methodName} not found on ${tx.contract}`) + } + const txo = method(...tx.args) + if (!txo) { + throw new Error(`Arguments ${tx.args} did not match ${methodName} signature`) + } + + return this.fromWeb3tx(txo, { to: address, value: tx.value }) + } + + fromJsonTx = async ( + tx: ProposalTransactionJSON | ExternalProposalTransactionJSON + ): Promise => { + if (isRegistryRepoint(tx)) { + // Update canonical registry addresses + const args = registryRepointArgs(tx) + this.setRegistryAddition(args.name, args.address) + } + + if (isProxySetAndInitFunction(tx) || isProxySetFunction(tx)) { + console.log(tx.address + ' is a proxy, repointing to ' + tx.args[0]) + this.externalCallProxyRepoint.set(tx.address || (tx.contract as string), tx.args[0] as string) + } + + const strategies = [this.buildCallToCoreContract, this.buildCallToExternalContract] + + for (const strategy of strategies) { + try { + return await strategy(tx as ProposalTransactionJSON) + } catch (e) { + debug("Couldn't build transaction with strategy %s: %O", strategy.name, e) + } + } + + throw new Error(`Couldn't build call for transaction: ${JSON.stringify(tx)}`) + } + + addJsonTx = (tx: ProposalTransactionJSON) => this.builders.push(async () => this.fromJsonTx(tx)) +} diff --git a/packages/sdk/governance/src/proposals.ts b/packages/sdk/governance/src/proposals.ts index 77234b5fa..85add6f3c 100644 --- a/packages/sdk/governance/src/proposals.ts +++ b/packages/sdk/governance/src/proposals.ts @@ -1,50 +1,30 @@ /* eslint max-classes-per-file: off */ import { ABI as GovernanceABI } from '@celo/abis/web3/Governance' import { ABI as RegistryABI } from '@celo/abis/web3/Registry' -import { Address, isHexString, trimLeading0x } from '@celo/base/lib/address' -import { - AbiCoder, - ABIDefinition, - AbiItem, - CeloTransactionObject, - CeloTxObject, - CeloTxPending, - Contract, - getAbiByName, - parseDecodedParams, - signatureToAbiDefinition, -} from '@celo/connect' -import { - CeloContract, - ContractKit, - RegisteredContracts, - REGISTRY_CONTRACT_ADDRESS, -} from '@celo/contractkit' +import { Address, trimLeading0x } from '@celo/base/lib/address' +import { AbiCoder, CeloTxPending, getAbiByName, parseDecodedParams } from '@celo/connect' +import { CeloContract, ContractKit, REGISTRY_CONTRACT_ADDRESS } from '@celo/contractkit' import { stripProxy, suffixProxy } from '@celo/contractkit/lib/base' import { getInitializeAbiOfImplementation, SET_AND_INITIALIZE_IMPLEMENTATION_ABI, SET_IMPLEMENTATION_ABI, - setImplementationOnProxy, } from '@celo/contractkit/lib/proxy' -import { valueToString } from '@celo/contractkit/lib/wrappers/BaseWrapper' import { hotfixToParams, Proposal, ProposalTransaction, } from '@celo/contractkit/lib/wrappers/Governance' import { newBlockExplorer } from '@celo/explorer' -import { fetchMetadata, tryGetProxyImplementation } from '@celo/explorer/lib/sourcify' -import { isValidAddress } from '@celo/utils/lib/address' +import { fetchMetadata } from '@celo/explorer/lib/sourcify' import { fromFixed } from '@celo/utils/lib/fixidity' import { keccak_256 } from '@noble/hashes/sha3' import { utf8ToBytes } from '@noble/hashes/utils' import { BigNumber } from 'bignumber.js' import debugFactory from 'debug' -import * as inquirer from 'inquirer' -const debug = debugFactory('governance:proposals') +export const debug = debugFactory('governance:proposals') export const hotfixExecuteAbi = getAbiByName(GovernanceABI, 'executeHotfix') @@ -79,13 +59,21 @@ export interface ProposalTransactionJSON { value: string } -const isRegistryRepoint = (tx: ProposalTransactionJSON) => - tx.contract === 'Registry' && tx.function === 'setAddressFor' +export type ExternalProposalTransactionJSON = Omit & { + contract?: string +} + +export const isRegistryRepoint = ( + tx: Pick +) => tx.contract === 'Registry' && tx.function === 'setAddressFor' -const isGovernanceConstitutionSetter = (tx: ProposalTransactionJSON) => - tx.contract === 'Governance' && tx.function === 'setConstitution' +const isGovernanceConstitutionSetter = ( + tx: Pick +) => tx.contract === 'Governance' && tx.function === 'setConstitution' -const registryRepointArgs = (tx: ProposalTransactionJSON) => { +export const registryRepointArgs = ( + tx: Pick +) => { if (!isRegistryRepoint(tx)) { throw new Error(`Proposal transaction not a registry repoint:\n${JSON.stringify(tx, null, 2)}`) } @@ -112,10 +100,10 @@ const registryRepointRawArgs = (abiCoder: AbiCoder, tx: ProposalTransaction) => } } -const isProxySetAndInitFunction = (tx: ProposalTransactionJSON) => +export const isProxySetAndInitFunction = (tx: Pick) => tx.function === SET_AND_INITIALIZE_IMPLEMENTATION_ABI.name! -const isProxySetFunction = (tx: ProposalTransactionJSON) => +export const isProxySetFunction = (tx: Pick) => tx.function === SET_IMPLEMENTATION_ABI.name! /** @@ -227,352 +215,11 @@ export const proposalToJSON = async ( return proposalJson } -type ProposalTxParams = Pick -interface RegistryAdditions { +export type ProposalTxParams = Pick +export interface RegistryAdditions { [contractName: string]: Address } -/** - * Builder class to construct proposals from JSON or transaction objects. - */ -export class ProposalBuilder { - externalCallProxyRepoint: Map = new Map() - - constructor( - private readonly kit: ContractKit, - private readonly builders: (() => Promise)[] = [], - public readonly registryAdditions: RegistryAdditions = {} - ) {} - - /** - * Build calls all of the added build steps and returns the final proposal. - * @returns A constructed Proposal object (i.e. a list of ProposalTransaction) - */ - build = async () => { - const ret = [] - for (const builder of this.builders) { - ret.push(await builder()) - } - return ret - } - - /** - * Converts a Web3 transaction into a proposal transaction object. - * @param tx A Web3 transaction object to convert. - * @param params Parameters for how the transaction should be executed. - */ - fromWeb3tx = (tx: CeloTxObject, params: ProposalTxParams): ProposalTransaction => ({ - value: params.value, - to: params.to, - input: tx.encodeABI(), - }) - - /** - * Adds a transaction to set the implementation on a proxy to the given address. - * @param contract Celo contract name of the proxy which should have its implementation set. - * @param newImplementationAddress Address of the new contract implementation. - */ - addProxyRepointingTx = (contract: CeloContract, newImplementationAddress: string) => { - this.builders.push(async () => { - const proxy = await this.kit._web3Contracts.getContract(contract) - return this.fromWeb3tx( - setImplementationOnProxy(newImplementationAddress, this.kit.connection.web3), - { - to: proxy.options.address, - value: '0', - } - ) - }) - } - - /** - * Adds a Web3 transaction to the list for proposal construction. - * @param tx A Web3 transaction object to add to the proposal. - * @param params Parameters for how the transaction should be executed. - */ - addWeb3Tx = (tx: CeloTxObject, params: ProposalTxParams) => - this.builders.push(async () => this.fromWeb3tx(tx, params)) - - /** - * Adds a Celo transaction to the list for proposal construction. - * @param tx A Celo transaction object to add to the proposal. - * @param params Optional parameters for how the transaction should be executed. - */ - addTx(tx: CeloTransactionObject, params: Partial = {}) { - const to = params.to ?? tx.defaultParams?.to - const value = params.value ?? tx.defaultParams?.value - if (!to || !value) { - throw new Error("Transaction parameters 'to' and/or 'value' not provided") - } - // TODO fix type of value - this.addWeb3Tx(tx.txo, { to, value: valueToString(value.toString()) }) - } - - setRegistryAddition = (contract: CeloContract, address: string) => - (this.registryAdditions[stripProxy(contract)] = address) - - getRegistryAddition = (contract: CeloContract): string | undefined => - this.registryAdditions[stripProxy(contract)] - - isRegistryContract = (contract: CeloContract) => - RegisteredContracts.includes(stripProxy(contract)) || - this.getRegistryAddition(contract) !== undefined - - /* - * @deprecated - use isRegistryContract - */ - isRegistered = this.isRegistryContract - - lookupExternalMethodABI = async ( - address: string, - tx: ProposalTransactionJSON - ): Promise => { - const abiCoder = this.kit.connection.getAbiCoder() - const metadata = await fetchMetadata( - this.kit.connection, - this.kit.web3.utils.toChecksumAddress(address) - ) - const potentialABIs = metadata?.abiForMethod(tx.function) ?? [] - return ( - potentialABIs.find((abi) => { - try { - abiCoder.encodeFunctionCall(abi, this.transformArgs(abi, tx.args)) - return true - } catch { - return false - } - }) || null - ) - } - - buildCallToExternalContract = async ( - tx: ProposalTransactionJSON - ): Promise => { - if (!tx.address || !isValidAddress(tx.address)) { - throw new Error(`${tx.contract} is not a core celo contract so address must be specified`) - } - - if (tx.function === '') { - return { input: '', to: tx.address, value: tx.value } - } - - let methodABI: AbiItem | null = await this.lookupExternalMethodABI(tx.address, tx) - if (methodABI === null) { - const proxyImpl = this.externalCallProxyRepoint.has(tx.address) - ? this.externalCallProxyRepoint.get(tx.address) - : await tryGetProxyImplementation(this.kit.connection, tx.address) - - if (proxyImpl) { - methodABI = await this.lookupExternalMethodABI(proxyImpl, tx) - } - } - - if (methodABI === null) { - methodABI = signatureToAbiDefinition(tx.function) - } - - const input = this.kit.connection - .getAbiCoder() - .encodeFunctionCall(methodABI, this.transformArgs(methodABI, tx.args)) - return { input, to: tx.address, value: tx.value } - } - - /* - * @deprecated use buildCallToExternalContract - * - */ - buildFunctionCallToExternalContract = this.buildCallToExternalContract - - transformArgs = (abi: AbiItem, args: any[]) => { - if (abi.inputs?.length !== args.length) { - throw new Error( - `ABI inputs length ${abi.inputs?.length} does not match args length ${args.length}` - ) - } - const res = [] - for (let i = 0; i < args.length; i++) { - const input = abi.inputs![i] - if (input.type === 'tuple') { - // support of structs and tuples - res.push(JSON.parse(args[i])) - } else { - res.push(args[i]) - } - } - return res - } - - buildCallToCoreContract = async (tx: ProposalTransactionJSON): Promise => { - // Account for canonical registry addresses from current proposal - const address = - this.getRegistryAddition(tx.contract) ?? (await this.kit.registry.addressFor(tx.contract)) - - if (tx.address && address !== tx.address) { - throw new Error(`Address mismatch for ${tx.contract}: ${address} !== ${tx.address}`) - } - - if (tx.function === SET_AND_INITIALIZE_IMPLEMENTATION_ABI.name && Array.isArray(tx.args[1])) { - // Transform array of initialize arguments (if provided) into delegate call data - tx.args[1] = this.kit.connection - .getAbiCoder() - .encodeFunctionCall(getInitializeAbiOfImplementation(tx.contract as any), tx.args[1]) - } - - const contract = await this.kit._web3Contracts.getContract(tx.contract, address) - const methodName = tx.function - const method = (contract.methods as Contract['methods'])[methodName] - if (!method) { - throw new Error(`Method ${methodName} not found on ${tx.contract}`) - } - const txo = method(...tx.args) - if (!txo) { - throw new Error(`Arguments ${tx.args} did not match ${methodName} signature`) - } - - return this.fromWeb3tx(txo, { to: address, value: tx.value }) - } - - fromJsonTx = async (tx: ProposalTransactionJSON): Promise => { - if (isRegistryRepoint(tx)) { - // Update canonical registry addresses - const args = registryRepointArgs(tx) - this.setRegistryAddition(args.name, args.address) - } - - if (isProxySetAndInitFunction(tx) || isProxySetFunction(tx)) { - console.log(tx.address + ' is a proxy, repointing to ' + tx.args[0]) - this.externalCallProxyRepoint.set(tx.address || tx.contract, tx.args[0] as string) - } - - const strategies = [this.buildCallToCoreContract, this.buildCallToExternalContract] - - for (const strategy of strategies) { - try { - return await strategy(tx) - } catch (e) { - debug("Couldn't build transaction with strategy %s: %O", strategy.name, e) - } - } - - throw new Error(`Couldn't build call for transaction: ${JSON.stringify(tx)}`) - } - - addJsonTx = (tx: ProposalTransactionJSON) => this.builders.push(async () => this.fromJsonTx(tx)) -} - -const DONE_CHOICE = '✔ done' - -export class InteractiveProposalBuilder { - constructor(private readonly builder: ProposalBuilder) {} - - async outputTransactions() { - const transactionList = this.builder.build() - console.log(JSON.stringify(transactionList, null, 2)) - } - - async promptTransactions() { - const transactions: ProposalTransactionJSON[] = [] - // eslint-disable-next-line no-constant-condition - while (true) { - console.log(`Transaction #${transactions.length + 1}:`) - - // prompt for contract - const contractPromptName = 'Celo Contract' - const contractAnswer = await inquirer.prompt({ - name: contractPromptName, - type: 'list', - choices: [DONE_CHOICE, ...RegisteredContracts], - }) - - const choice = contractAnswer[contractPromptName] - if (choice === DONE_CHOICE) { - break - } - - const contractName = choice as CeloContract - const contractABI = require('@celo/abis/web3/' + contractName).ABI as ABIDefinition[] - - const txMethods = contractABI.filter( - (def) => def.type === 'function' && def.stateMutability !== 'view' - ) - const txMethodNames = txMethods.map((def) => def.name!) - - // prompt for function - const functionPromptName = contractName + ' Function' - const functionAnswer = await inquirer.prompt>({ - name: functionPromptName, - type: 'list', - choices: txMethodNames, - }) - const functionName = functionAnswer[functionPromptName] - const idx = txMethodNames.findIndex((m) => m === functionName) - const txDefinition = txMethods[idx] - - // prompt individually for each argument - const args = [] - for (const functionInput of txDefinition.inputs!) { - const inputAnswer = await inquirer.prompt({ - name: functionInput.name, - type: 'input', - validate: async (input: string) => { - switch (functionInput.type) { - case 'uint256': - try { - new BigNumber(input) - return true - } catch (e) { - return false - } - case 'boolean': - return input === 'true' || input === 'false' - case 'address': - return isValidAddress(input) - case 'bytes': - return isHexString(input) - default: - return true - } - }, - }) - - // @ts-ignore - const answer: string = inputAnswer[functionInput.name] - // transformedValue may not be in scientific notation - const transformedValue = - functionInput.type === 'uint256' ? new BigNumber(answer).toString(10) : answer - args.push(transformedValue) - } - - // prompt for value only when tx is payable - let value: string - if (txDefinition.payable) { - const valuePromptName = 'Value' - const valueAnswer = await inquirer.prompt({ - name: valuePromptName, - type: 'input', - }) - value = valueAnswer[valuePromptName] - } else { - value = '0' - } - - const tx: ProposalTransactionJSON = { - contract: contractName, - function: functionName, - args, - value, - } - - try { - // use fromJsonTx as well-formed tx validation - await this.builder.fromJsonTx(tx) - transactions.push(tx) - } catch (error) { - console.error(error) - console.error('Please retry forming this transaction') - } - } - - return transactions - } -} +// reexport for backwards compatibility +export { InteractiveProposalBuilder } from './interactive-proposal-builder' +export { ProposalBuilder } from './proposal-builder' diff --git a/packages/sdk/governance/src/test-utils/globals.d.ts b/packages/sdk/governance/src/test-utils/globals.d.ts new file mode 100644 index 000000000..b7f02cdc5 --- /dev/null +++ b/packages/sdk/governance/src/test-utils/globals.d.ts @@ -0,0 +1,6 @@ +/* eslint import/no-extraneous-dependencies:off */ +import { FetchMockSandbox } from 'fetch-mock' + +declare global { + const fetchMock: FetchMockSandbox +} diff --git a/packages/sdk/governance/src/test-utils/setup.global.ts b/packages/sdk/governance/src/test-utils/setup.global.ts new file mode 100644 index 000000000..2d2bf2e7c --- /dev/null +++ b/packages/sdk/governance/src/test-utils/setup.global.ts @@ -0,0 +1,6 @@ +// Has to import the matchers somewhere so that typescript knows the matchers have been made available +import _very_important from '@celo/dev-utils/lib/matchers' + +export default async function globalSetup() { + console.info('Global setup Complete') +} diff --git a/packages/sdk/keystores/package.json b/packages/sdk/keystores/package.json index 555eca21a..7278ab2d2 100644 --- a/packages/sdk/keystores/package.json +++ b/packages/sdk/keystores/package.json @@ -23,7 +23,7 @@ }, "dependencies": { "@celo/utils": "^8.0.0-beta.0", - "@celo/wallet-local": "^6.0.2-beta.0", + "@celo/wallet-local": "^6.0.4-beta.0", "ethereumjs-wallet": "^1.0.1" }, "devDependencies": { diff --git a/packages/sdk/metadata-claims/package.json b/packages/sdk/metadata-claims/package.json index 1a8a8e268..92ae28b87 100644 --- a/packages/sdk/metadata-claims/package.json +++ b/packages/sdk/metadata-claims/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@celo/celo-devchain": "^7.0.0", "@celo/contractkit": "workspace:^", - "@celo/dev-utils": "0.0.6-beta.1", + "@celo/dev-utils": "0.0.7-beta.1", "@celo/odis-identifiers": "^1.0.1", "@celo/typescript": "workspace:^", "@types/node": "18.7.6", diff --git a/packages/sdk/network-utils/package.json b/packages/sdk/network-utils/package.json index bd56070c8..ca7344e73 100644 --- a/packages/sdk/network-utils/package.json +++ b/packages/sdk/network-utils/package.json @@ -27,7 +27,7 @@ "debug": "^4.1.1" }, "devDependencies": { - "@celo/dev-utils": "0.0.6-beta.1", + "@celo/dev-utils": "0.0.7-beta.1", "@celo/typescript": "workspace:^", "@types/debug": "^4.1.12", "fetch-mock": "^10.0.7" diff --git a/packages/sdk/transactions-uri/CHANGELOG.md b/packages/sdk/transactions-uri/CHANGELOG.md index 4cbfc2d4b..8a3316780 100644 --- a/packages/sdk/transactions-uri/CHANGELOG.md +++ b/packages/sdk/transactions-uri/CHANGELOG.md @@ -1,5 +1,12 @@ # @celo/transactions-uri +## 5.0.12-beta.1 + +### Patch Changes + +- Updated dependencies [[`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/connect@6.1.0-beta.1 + ## 5.0.12-beta.0 ### Patch Changes diff --git a/packages/sdk/transactions-uri/package.json b/packages/sdk/transactions-uri/package.json index b97d01e0a..3ce83f87e 100644 --- a/packages/sdk/transactions-uri/package.json +++ b/packages/sdk/transactions-uri/package.json @@ -1,6 +1,6 @@ { "name": "@celo/transactions-uri", - "version": "5.0.12-beta.0", + "version": "5.0.12-beta.1", "description": "Celo's transactions uri generation", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -23,7 +23,7 @@ }, "dependencies": { "@celo/base": "^7.0.0-beta.0", - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@types/bn.js": "^5.1.0", "@types/debug": "^4.1.5", "@types/qrcode": "^1.3.4", @@ -32,8 +32,8 @@ "web3-eth-abi": "1.10.4" }, "devDependencies": { - "@celo/contractkit": "^9.0.0-beta.1", - "@celo/dev-utils": "0.0.6-beta.1", + "@celo/contractkit": "^9.0.0-beta.2", + "@celo/dev-utils": "0.0.7-beta.1", "@celo/typescript": "workspace:^", "cross-fetch": "3.1.5", "dotenv": "^8.2.0", diff --git a/packages/sdk/wallets/wallet-base/CHANGELOG.md b/packages/sdk/wallets/wallet-base/CHANGELOG.md index ef698b672..d7b7e450a 100644 --- a/packages/sdk/wallets/wallet-base/CHANGELOG.md +++ b/packages/sdk/wallets/wallet-base/CHANGELOG.md @@ -1,5 +1,14 @@ # @celo/wallet-base +## 6.0.3-beta.1 + +### Patch Changes + +- [#434](https://github.com/celo-org/developer-tooling/pull/434) [`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Force patch bump wallets to deal with version conflict + +- Updated dependencies [[`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/connect@6.1.0-beta.1 + ## 6.0.2-beta.2 ## 6.0.2-beta.1 @@ -17,6 +26,8 @@ - @celo/utils@8.0.0-beta.0 - @celo/connect@6.0.3-beta.0 +## 6.0.2 + ## 6.0.1 ### Patch Changes diff --git a/packages/sdk/wallets/wallet-base/package.json b/packages/sdk/wallets/wallet-base/package.json index 28944d082..e3a9778a0 100644 --- a/packages/sdk/wallets/wallet-base/package.json +++ b/packages/sdk/wallets/wallet-base/package.json @@ -1,6 +1,6 @@ { "name": "@celo/wallet-base", - "version": "6.0.2-beta.2", + "version": "6.0.4-beta.0", "description": "Wallet base implementation", "author": "Celo", "license": "Apache-2.0", @@ -28,7 +28,7 @@ }, "dependencies": { "@celo/base": "^7.0.0-beta.0", - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@celo/utils": "^8.0.0-beta.0", "@ethereumjs/rlp": "^5.0.2", "@ethereumjs/util": "8.0.5", diff --git a/packages/sdk/wallets/wallet-hsm-aws/CHANGELOG.md b/packages/sdk/wallets/wallet-hsm-aws/CHANGELOG.md index 517f0300d..d9890d8ed 100644 --- a/packages/sdk/wallets/wallet-hsm-aws/CHANGELOG.md +++ b/packages/sdk/wallets/wallet-hsm-aws/CHANGELOG.md @@ -1,7 +1,21 @@ # @celo/wallet-hsm-aws +## 6.0.3-beta.1 + +### Patch Changes + +- [#434](https://github.com/celo-org/developer-tooling/pull/434) [`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Force patch bump wallets to deal with version conflict + +- Updated dependencies [[`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3), [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/wallet-remote@6.0.3-beta.1 + - @celo/wallet-base@6.0.3-beta.1 + - @celo/wallet-hsm@6.0.3-beta.1 + - @celo/connect@6.1.0-beta.1 + ## 6.0.2-beta.2 +## 6.0.2 + ### Patch Changes - Updated dependencies []: @@ -28,6 +42,9 @@ - @celo/wallet-base@6.0.2-beta.0 - @celo/wallet-hsm@6.0.2-beta.0 - @celo/wallet-remote@6.0.2-beta.0 + - @celo/wallet-base@6.0.2 + - @celo/wallet-hsm@6.0.2 + - @celo/wallet-remote@6.0.2 ## 6.0.1 diff --git a/packages/sdk/wallets/wallet-hsm-aws/package.json b/packages/sdk/wallets/wallet-hsm-aws/package.json index 53bffbcb4..b3d3d31ba 100644 --- a/packages/sdk/wallets/wallet-hsm-aws/package.json +++ b/packages/sdk/wallets/wallet-hsm-aws/package.json @@ -1,6 +1,6 @@ { "name": "@celo/wallet-hsm-aws", - "version": "6.0.2-beta.2", + "version": "6.0.4-beta.0", "description": "AWS HSM wallet implementation", "author": "Celo", "license": "Apache-2.0", @@ -22,11 +22,11 @@ "prepublishOnly": "yarn build" }, "dependencies": { - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@celo/utils": "^8.0.0-beta.0", - "@celo/wallet-base": "^6.0.2-beta.2", - "@celo/wallet-hsm": "^6.0.2-beta.2", - "@celo/wallet-remote": "^6.0.2-beta.2", + "@celo/wallet-base": "^6.0.4-beta.0", + "@celo/wallet-hsm": "^6.0.4-beta.0", + "@celo/wallet-remote": "^6.0.4-beta.0", "@ethereumjs/util": "8.0.5", "@types/debug": "^4.1.5", "@types/secp256k1": "^4.0.0", diff --git a/packages/sdk/wallets/wallet-hsm-azure/CHANGELOG.md b/packages/sdk/wallets/wallet-hsm-azure/CHANGELOG.md index 54e58add8..188f6d218 100644 --- a/packages/sdk/wallets/wallet-hsm-azure/CHANGELOG.md +++ b/packages/sdk/wallets/wallet-hsm-azure/CHANGELOG.md @@ -1,7 +1,21 @@ # @celo/wallet-hsm-azure +## 6.0.3-beta.1 + +### Patch Changes + +- [#434](https://github.com/celo-org/developer-tooling/pull/434) [`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Force patch bump wallets to deal with version conflict + +- Updated dependencies [[`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3), [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/wallet-remote@6.0.3-beta.1 + - @celo/wallet-base@6.0.3-beta.1 + - @celo/wallet-hsm@6.0.3-beta.1 + - @celo/connect@6.1.0-beta.1 + ## 6.0.2-beta.2 +## 6.0.2 + ### Patch Changes - Updated dependencies []: @@ -29,6 +43,9 @@ - @celo/wallet-base@6.0.2-beta.0 - @celo/wallet-hsm@6.0.2-beta.0 - @celo/wallet-remote@6.0.2-beta.0 + - @celo/wallet-base@6.0.2 + - @celo/wallet-hsm@6.0.2 + - @celo/wallet-remote@6.0.2 ## 6.0.1 diff --git a/packages/sdk/wallets/wallet-hsm-azure/package.json b/packages/sdk/wallets/wallet-hsm-azure/package.json index b5775893e..1292b835b 100644 --- a/packages/sdk/wallets/wallet-hsm-azure/package.json +++ b/packages/sdk/wallets/wallet-hsm-azure/package.json @@ -1,6 +1,6 @@ { "name": "@celo/wallet-hsm-azure", - "version": "6.0.2-beta.2", + "version": "6.0.4-beta.0", "description": "Azure HSM wallet implementation", "author": "Celo", "license": "Apache-2.0", @@ -26,11 +26,11 @@ "@azure/keyvault-keys": "^4.7.2", "@azure/keyvault-secrets": "^4.7.0", "@celo/base": "^7.0.0-beta.0", - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@celo/utils": "^8.0.0-beta.0", - "@celo/wallet-base": "^6.0.2-beta.2", - "@celo/wallet-hsm": "^6.0.2-beta.2", - "@celo/wallet-remote": "^6.0.2-beta.2", + "@celo/wallet-base": "^6.0.4-beta.0", + "@celo/wallet-hsm": "^6.0.4-beta.0", + "@celo/wallet-remote": "^6.0.4-beta.0", "@ethereumjs/util": "8.0.5", "@types/secp256k1": "^4.0.0", "bignumber.js": "^9.0.0", diff --git a/packages/sdk/wallets/wallet-hsm-gcp/CHANGELOG.md b/packages/sdk/wallets/wallet-hsm-gcp/CHANGELOG.md index 062f6558b..3daae34d3 100644 --- a/packages/sdk/wallets/wallet-hsm-gcp/CHANGELOG.md +++ b/packages/sdk/wallets/wallet-hsm-gcp/CHANGELOG.md @@ -1,7 +1,21 @@ # @celo/wallet-hsm-gcp +## 6.0.3-beta.1 + +### Patch Changes + +- [#434](https://github.com/celo-org/developer-tooling/pull/434) [`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Force patch bump wallets to deal with version conflict + +- Updated dependencies [[`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3), [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/wallet-remote@6.0.3-beta.1 + - @celo/wallet-base@6.0.3-beta.1 + - @celo/wallet-hsm@6.0.3-beta.1 + - @celo/connect@6.1.0-beta.1 + ## 6.0.2-beta.2 +## 6.0.2 + ### Patch Changes - Updated dependencies []: @@ -28,6 +42,9 @@ - @celo/wallet-base@6.0.2-beta.0 - @celo/wallet-hsm@6.0.2-beta.0 - @celo/wallet-remote@6.0.2-beta.0 + - @celo/wallet-base@6.0.2 + - @celo/wallet-hsm@6.0.2 + - @celo/wallet-remote@6.0.2 ## 6.0.1 diff --git a/packages/sdk/wallets/wallet-hsm-gcp/package.json b/packages/sdk/wallets/wallet-hsm-gcp/package.json index f8607fa9a..ebb2dcac7 100644 --- a/packages/sdk/wallets/wallet-hsm-gcp/package.json +++ b/packages/sdk/wallets/wallet-hsm-gcp/package.json @@ -1,6 +1,6 @@ { "name": "@celo/wallet-hsm-gcp", - "version": "6.0.2-beta.2", + "version": "6.0.4-beta.0", "description": "GCP HSM wallet implementation", "author": "Celo", "license": "Apache-2.0", @@ -20,11 +20,11 @@ "prepublishOnly": "yarn build" }, "dependencies": { - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@celo/utils": "^8.0.0-beta.0", - "@celo/wallet-base": "^6.0.2-beta.2", - "@celo/wallet-hsm": "^6.0.2-beta.2", - "@celo/wallet-remote": "^6.0.2-beta.2", + "@celo/wallet-base": "^6.0.4-beta.0", + "@celo/wallet-hsm": "^6.0.4-beta.0", + "@celo/wallet-remote": "^6.0.4-beta.0", "@ethereumjs/util": "8.0.5", "@google-cloud/kms": "~2.9.0", "@noble/curves": "^1.3.0", diff --git a/packages/sdk/wallets/wallet-hsm/CHANGELOG.md b/packages/sdk/wallets/wallet-hsm/CHANGELOG.md index 7fe026a1b..2edc1d29f 100644 --- a/packages/sdk/wallets/wallet-hsm/CHANGELOG.md +++ b/packages/sdk/wallets/wallet-hsm/CHANGELOG.md @@ -1,5 +1,11 @@ # @celo/wallet-hsm +## 6.0.3-beta.1 + +### Patch Changes + +- [#434](https://github.com/celo-org/developer-tooling/pull/434) [`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Force patch bump wallets to deal with version conflict + ## 6.0.2-beta.2 ## 6.0.2-beta.1 @@ -11,6 +17,8 @@ - Updated dependencies [[`4ef76eb`](https://github.com/celo-org/developer-tooling/commit/4ef76eb174454f60304080d0ef63a859cd8d931b)]: - @celo/base@7.0.0-beta.0 +## 6.0.2 + ## 6.0.1 ## 6.0.1-beta.0 diff --git a/packages/sdk/wallets/wallet-hsm/package.json b/packages/sdk/wallets/wallet-hsm/package.json index 682faa3d6..68a887137 100644 --- a/packages/sdk/wallets/wallet-hsm/package.json +++ b/packages/sdk/wallets/wallet-hsm/package.json @@ -1,6 +1,6 @@ { "name": "@celo/wallet-hsm", - "version": "6.0.2-beta.2", + "version": "6.0.4-beta.0", "description": "HSM wallet implementation utils", "author": "Celo", "license": "Apache-2.0", diff --git a/packages/sdk/wallets/wallet-ledger/CHANGELOG.md b/packages/sdk/wallets/wallet-ledger/CHANGELOG.md index 4b71dbc25..c982f98d1 100644 --- a/packages/sdk/wallets/wallet-ledger/CHANGELOG.md +++ b/packages/sdk/wallets/wallet-ledger/CHANGELOG.md @@ -1,5 +1,16 @@ # @celo/wallet-ledger +## 6.0.3-beta.1 + +### Patch Changes + +- [#434](https://github.com/celo-org/developer-tooling/pull/434) [`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Force patch bump wallets to deal with version conflict + +- Updated dependencies [[`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3), [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/wallet-remote@6.0.3-beta.1 + - @celo/wallet-base@6.0.3-beta.1 + - @celo/connect@6.1.0-beta.1 + ## 6.0.2-beta.2 ### Patch Changes @@ -33,6 +44,16 @@ - @celo/wallet-base@6.0.2-beta.0 - @celo/wallet-remote@6.0.2-beta.0 +## 6.0.2 + +### Patch Changes + +- [#396](https://github.com/celo-org/developer-tooling/pull/396) [`d58929c`](https://github.com/celo-org/developer-tooling/commit/d58929c5160b334cb91b109645381aa49fa76011) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Fix issue where ledger running celo firmware app 1.1.10 could not send fee token transactions or perform and interactions with those contracts + +- Updated dependencies []: + - @celo/wallet-base@6.0.2 + - @celo/wallet-remote@6.0.2 + ## 6.0.1 ### Patch Changes diff --git a/packages/sdk/wallets/wallet-ledger/package.json b/packages/sdk/wallets/wallet-ledger/package.json index a5c058891..ca5218b55 100644 --- a/packages/sdk/wallets/wallet-ledger/package.json +++ b/packages/sdk/wallets/wallet-ledger/package.json @@ -1,6 +1,6 @@ { "name": "@celo/wallet-ledger", - "version": "6.0.2-beta.2", + "version": "6.0.4-beta.0", "description": "Ledger wallet implementation", "author": "Celo", "license": "Apache-2.0", @@ -25,12 +25,12 @@ }, "dependencies": { "@celo/base": "^7.0.0-beta.0", - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@celo/hw-app-eth": "^1.0.0", "@celo/ledger-token-signer": "^0.4.0", "@celo/utils": "^8.0.0-beta.0", - "@celo/wallet-base": "^6.0.2-beta.2", - "@celo/wallet-remote": "^6.0.2-beta.2", + "@celo/wallet-base": "^6.0.4-beta.0", + "@celo/wallet-remote": "^6.0.4-beta.0", "@ethereumjs/util": "8.0.5", "@ledgerhq/errors": "^6.16.4", "@ledgerhq/hw-transport": "^6.30.6", @@ -38,7 +38,7 @@ "semver": "^7.6.0" }, "devDependencies": { - "@celo/contractkit": "^9.0.0-beta.1", + "@celo/contractkit": "^9.0.0-beta.2", "@celo/typescript": "workspace:^", "@ledgerhq/hw-transport-node-hid": "^6.28.5", "@noble/curves": "^1.4.0", diff --git a/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts b/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts index 4d020b41d..c6b1ec7b1 100644 --- a/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts +++ b/packages/sdk/wallets/wallet-ledger/src/ledger-signer.ts @@ -1,10 +1,10 @@ import { ensureLeading0x, trimLeading0x } from '@celo/base/lib/address' import { RLPEncodedTx, Signer } from '@celo/connect' +import Ledger from '@celo/hw-app-eth' import { EIP712TypedData, structHash } from '@celo/utils/lib/sign-typed-data-utils' import { LegacyEncodedTx } from '@celo/wallet-base' import * as ethUtil from '@ethereumjs/util' import { TransportStatusError } from '@ledgerhq/errors' -import Ledger from '@celo/hw-app-eth' import debugFactory from 'debug' import { SemVer } from 'semver' import { meetsVersionRequirements, transportErrorFriendlyMessage } from './ledger-utils' diff --git a/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.test.ts b/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.test.ts index f3179a834..4e32ab951 100644 --- a/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.test.ts +++ b/packages/sdk/wallets/wallet-ledger/src/ledger-wallet.test.ts @@ -6,6 +6,7 @@ import { } from '@celo/base/lib/address' import { CeloTx, EncodedTransaction, Hex } from '@celo/connect' import { StableToken, newKit } from '@celo/contractkit' +import Ledger from '@celo/hw-app-eth' import { privateKeyToAddress, privateKeyToPublicKey } from '@celo/utils/lib/address' import { generateTypedDataHash } from '@celo/utils/lib/sign-typed-data-utils' import { verifySignature } from '@celo/utils/lib/signatureUtils' @@ -18,7 +19,6 @@ import { verifyEIP712TypedDataSigner, } from '@celo/wallet-base' import * as ethUtil from '@ethereumjs/util' -import Ledger from '@celo/hw-app-eth' import TransportNodeHid from '@ledgerhq/hw-transport-node-hid' import { VerifyPublicKeyInput, createVerify } from 'crypto' import { readFileSync } from 'fs' diff --git a/packages/sdk/wallets/wallet-local/CHANGELOG.md b/packages/sdk/wallets/wallet-local/CHANGELOG.md index bd1643605..03e3c1560 100644 --- a/packages/sdk/wallets/wallet-local/CHANGELOG.md +++ b/packages/sdk/wallets/wallet-local/CHANGELOG.md @@ -1,5 +1,15 @@ # @celo/wallet-local +## 6.0.3-beta.1 + +### Patch Changes + +- [#434](https://github.com/celo-org/developer-tooling/pull/434) [`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Force patch bump wallets to deal with version conflict + +- Updated dependencies [[`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3), [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/wallet-base@6.0.3-beta.1 + - @celo/connect@6.1.0-beta.1 + ## 6.0.2-beta.2 ### Patch Changes @@ -25,6 +35,7 @@ - @celo/utils@8.0.0-beta.0 - @celo/connect@6.0.3-beta.0 - @celo/wallet-base@6.0.2-beta.0 + - @celo/wallet-base@6.0.2 ## 6.0.1 diff --git a/packages/sdk/wallets/wallet-local/package.json b/packages/sdk/wallets/wallet-local/package.json index 607b702bf..2797cbd63 100644 --- a/packages/sdk/wallets/wallet-local/package.json +++ b/packages/sdk/wallets/wallet-local/package.json @@ -1,6 +1,6 @@ { "name": "@celo/wallet-local", - "version": "6.0.2-beta.2", + "version": "6.0.4-beta.0", "description": "Local wallet implementation", "author": "Celo", "license": "Apache-2.0", @@ -23,9 +23,9 @@ }, "dependencies": { "@celo/base": "^7.0.0-beta.0", - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@celo/utils": "^8.0.0-beta.0", - "@celo/wallet-base": "^6.0.2-beta.2", + "@celo/wallet-base": "^6.0.4-beta.0", "@ethereumjs/util": "8.0.5" }, "devDependencies": { diff --git a/packages/sdk/wallets/wallet-remote/CHANGELOG.md b/packages/sdk/wallets/wallet-remote/CHANGELOG.md index 39d285437..430ce4e5f 100644 --- a/packages/sdk/wallets/wallet-remote/CHANGELOG.md +++ b/packages/sdk/wallets/wallet-remote/CHANGELOG.md @@ -1,7 +1,19 @@ # @celo/wallet-remote +## 6.0.3-beta.1 + +### Patch Changes + +- [#434](https://github.com/celo-org/developer-tooling/pull/434) [`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3) Thanks [@aaronmgdr](https://github.com/aaronmgdr)! - Force patch bump wallets to deal with version conflict + +- Updated dependencies [[`c4b9c6d`](https://github.com/celo-org/developer-tooling/commit/c4b9c6d60bf938950007a67df4e7c8ec35066fb3), [`fb08485`](https://github.com/celo-org/developer-tooling/commit/fb08485ae337e796a442b781632ae2123c4f4444)]: + - @celo/wallet-base@6.0.3-beta.1 + - @celo/connect@6.1.0-beta.1 + ## 6.0.2-beta.2 +## 6.0.2 + ### Patch Changes - Updated dependencies []: @@ -22,6 +34,7 @@ - @celo/utils@8.0.0-beta.0 - @celo/connect@6.0.3-beta.0 - @celo/wallet-base@6.0.2-beta.0 + - @celo/wallet-base@6.0.2 ## 6.0.1 diff --git a/packages/sdk/wallets/wallet-remote/package.json b/packages/sdk/wallets/wallet-remote/package.json index c7a6c3a66..a53a15469 100644 --- a/packages/sdk/wallets/wallet-remote/package.json +++ b/packages/sdk/wallets/wallet-remote/package.json @@ -1,6 +1,6 @@ { "name": "@celo/wallet-remote", - "version": "6.0.2-beta.2", + "version": "6.0.4-beta.0", "description": "Remote wallet implementation", "author": "Celo", "license": "Apache-2.0", @@ -22,9 +22,9 @@ "prepublishOnly": "yarn build" }, "dependencies": { - "@celo/connect": "^6.0.3-beta.0", + "@celo/connect": "^6.1.0-beta.1", "@celo/utils": "^8.0.0-beta.0", - "@celo/wallet-base": "^6.0.2-beta.2", + "@celo/wallet-base": "^6.0.4-beta.0", "@ethereumjs/util": "8.0.5", "@types/debug": "^4.1.5" }, diff --git a/yarn.lock b/yarn.lock index 3f707c13f..a8b0b00e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19,6 +19,13 @@ __metadata: languageName: node linkType: hard +"@adraffy/ens-normalize@npm:1.11.0": + version: 1.11.0 + resolution: "@adraffy/ens-normalize@npm:1.11.0" + checksum: abef75f21470ea43dd6071168e092d2d13e38067e349e76186c78838ae174a46c3e18ca50921d05bea6ec3203074147c9e271f8cb6531d1c2c0e146f3199ddcb + languageName: node + linkType: hard + "@adraffy/ens-normalize@npm:1.9.0": version: 1.9.0 resolution: "@adraffy/ens-normalize@npm:1.9.0" @@ -1691,20 +1698,20 @@ __metadata: "@celo/base": "npm:^7.0.0-beta.0" "@celo/celo-devchain": "npm:^7.0.0" "@celo/compliance": "npm:~1.0.23" - "@celo/connect": "npm:^6.0.3-beta.0" - "@celo/contractkit": "npm:^9.0.0-beta.1" + "@celo/connect": "npm:^6.1.0-beta.1" + "@celo/contractkit": "npm:^9.0.0-beta.2" "@celo/cryptographic-utils": "npm:^5.1.1-beta.0" - "@celo/dev-utils": "npm:0.0.6-beta.1" - "@celo/explorer": "npm:^5.0.13-beta.0" - "@celo/governance": "npm:^5.1.4-beta.0" + "@celo/dev-utils": "npm:0.0.7-beta.1" + "@celo/explorer": "npm:^5.0.13-beta.1" + "@celo/governance": "npm:^5.1.4-beta.1" "@celo/identity": "npm:^5.1.2" "@celo/metadata-claims": "npm:^1.0.0-beta.0" "@celo/phone-utils": "npm:^6.0.4-beta.0" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" - "@celo/wallet-hsm-azure": "npm:^6.0.2-beta.2" - "@celo/wallet-ledger": "npm:^6.0.2-beta.2" - "@celo/wallet-local": "npm:^6.0.2-beta.2" + "@celo/wallet-hsm-azure": "npm:^6.0.4-beta.0" + "@celo/wallet-ledger": "npm:^6.0.4-beta.0" + "@celo/wallet-local": "npm:^6.0.4-beta.0" "@ethereumjs/util": "npm:8.0.5" "@ledgerhq/hw-transport-node-hid": "npm:^6.28.5" "@mento-protocol/mento-sdk": "npm:^1.0.1" @@ -1715,6 +1722,8 @@ __metadata: "@oclif/plugin-not-found": "npm:^3.2.15" "@oclif/plugin-plugins": "npm:^4.3.10" "@oclif/plugin-warn-if-update-available": "npm:^3.1.11" + "@safe-global/protocol-kit": "npm:^5.0.4" + "@safe-global/types-kit": "npm:^1.0.0" "@types/command-exists": "npm:^1.2.3" "@types/debug": "npm:^4.1.4" "@types/fs-extra": "npm:^8.0.0" @@ -1775,7 +1784,7 @@ __metadata: languageName: node linkType: hard -"@celo/connect@npm:^6.0.3-beta.0, @celo/connect@workspace:packages/sdk/connect": +"@celo/connect@npm:^6.1.0-beta.1, @celo/connect@workspace:packages/sdk/connect": version: 0.0.0-use.local resolution: "@celo/connect@workspace:packages/sdk/connect" dependencies: @@ -1821,7 +1830,7 @@ __metadata: languageName: node linkType: hard -"@celo/contractkit@npm:^9.0.0-beta.0, @celo/contractkit@npm:^9.0.0-beta.1, @celo/contractkit@workspace:^, @celo/contractkit@workspace:packages/sdk/contractkit": +"@celo/contractkit@npm:^9.0.0-beta.2, @celo/contractkit@workspace:^, @celo/contractkit@workspace:packages/sdk/contractkit": version: 0.0.0-use.local resolution: "@celo/contractkit@workspace:packages/sdk/contractkit" dependencies: @@ -1829,12 +1838,12 @@ __metadata: "@celo/abis-12": "npm:@celo/abis@12.0.0-canary.60" "@celo/base": "npm:^7.0.0-beta.0" "@celo/celo-devchain": "npm:^7.0.0" - "@celo/connect": "npm:^6.0.3-beta.0" - "@celo/dev-utils": "npm:0.0.6-beta.1" + "@celo/connect": "npm:^6.1.0-beta.1" + "@celo/dev-utils": "npm:0.0.7-beta.1" "@celo/odis-identifiers": "npm:^1.0.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" - "@celo/wallet-local": "npm:^6.0.2-beta.1" + "@celo/wallet-local": "npm:^6.0.4-beta.0" "@truffle/contract": "npm:4.6.31" "@types/bn.js": "npm:^5.1.0" "@types/debug": "npm:^4.1.5" @@ -1873,12 +1882,12 @@ __metadata: languageName: unknown linkType: soft -"@celo/dev-utils@npm:0.0.6-beta.1, @celo/dev-utils@workspace:packages/dev-utils": +"@celo/dev-utils@npm:0.0.7-beta.1, @celo/dev-utils@workspace:packages/dev-utils": version: 0.0.0-use.local resolution: "@celo/dev-utils@workspace:packages/dev-utils" dependencies: "@celo/abis": "npm:^11.0.0" - "@celo/connect": "npm:^6.0.3-beta.0" + "@celo/connect": "npm:^6.1.0-beta.1" "@celo/devchain-anvil": "npm:12.0.0-canary.33" "@celo/typescript": "workspace:^" "@tsconfig/recommended": "npm:^1.0.3" @@ -1902,14 +1911,14 @@ __metadata: languageName: node linkType: hard -"@celo/explorer@npm:^5.0.13-beta.0, @celo/explorer@workspace:packages/sdk/explorer": +"@celo/explorer@npm:^5.0.13-beta.1, @celo/explorer@workspace:packages/sdk/explorer": version: 0.0.0-use.local resolution: "@celo/explorer@workspace:packages/sdk/explorer" dependencies: "@celo/base": "npm:^7.0.0-beta.0" - "@celo/connect": "npm:^6.0.3-beta.0" - "@celo/contractkit": "npm:^9.0.0-beta.1" - "@celo/dev-utils": "npm:0.0.6-beta.1" + "@celo/connect": "npm:^6.1.0-beta.1" + "@celo/contractkit": "npm:^9.0.0-beta.2" + "@celo/dev-utils": "npm:0.0.7-beta.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" "@types/debug": "npm:^4.1.12" @@ -1921,15 +1930,17 @@ __metadata: languageName: unknown linkType: soft -"@celo/governance@npm:^5.1.4-beta.0, @celo/governance@workspace:packages/sdk/governance": +"@celo/governance@npm:^5.1.4-beta.1, @celo/governance@workspace:packages/sdk/governance": version: 0.0.0-use.local resolution: "@celo/governance@workspace:packages/sdk/governance" dependencies: "@celo/abis": "npm:11.0.0" + "@celo/abis-12": "npm:@celo/abis@12.0.0-canary.60" "@celo/base": "npm:^7.0.0-beta.0" - "@celo/connect": "npm:^6.0.3-beta.0" - "@celo/contractkit": "npm:^9.0.0-beta.0" - "@celo/explorer": "npm:^5.0.13-beta.0" + "@celo/connect": "npm:^6.1.0-beta.1" + "@celo/contractkit": "npm:^9.0.0-beta.2" + "@celo/dev-utils": "npm:0.0.7-beta.1" + "@celo/explorer": "npm:^5.0.13-beta.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" "@ethereumjs/util": "npm:8.0.5" @@ -1937,7 +1948,7 @@ __metadata: "@types/inquirer": "npm:^6.5.0" bignumber.js: "npm:^9.0.0" debug: "npm:^4.1.1" - inquirer: "npm:^7.0.5" + inquirer: "npm:^7.3.3" languageName: unknown linkType: soft @@ -1992,7 +2003,7 @@ __metadata: dependencies: "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" - "@celo/wallet-local": "npm:^6.0.2-beta.0" + "@celo/wallet-local": "npm:^6.0.4-beta.0" "@types/rimraf": "npm:3.0.2" ethereumjs-wallet: "npm:^1.0.1" rimraf: "npm:3.0.2" @@ -2013,7 +2024,7 @@ __metadata: "@celo/base": "npm:^7.0.0-beta.0" "@celo/celo-devchain": "npm:^7.0.0" "@celo/contractkit": "workspace:^" - "@celo/dev-utils": "npm:0.0.6-beta.1" + "@celo/dev-utils": "npm:0.0.7-beta.1" "@celo/odis-identifiers": "npm:^1.0.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" @@ -2032,7 +2043,7 @@ __metadata: version: 0.0.0-use.local resolution: "@celo/network-utils@workspace:packages/sdk/network-utils" dependencies: - "@celo/dev-utils": "npm:0.0.6-beta.1" + "@celo/dev-utils": "npm:0.0.7-beta.1" "@celo/typescript": "workspace:^" "@types/debug": "npm:^4.1.12" cross-fetch: "npm:3.1.5" @@ -2094,9 +2105,9 @@ __metadata: resolution: "@celo/transactions-uri@workspace:packages/sdk/transactions-uri" dependencies: "@celo/base": "npm:^7.0.0-beta.0" - "@celo/connect": "npm:^6.0.3-beta.0" - "@celo/contractkit": "npm:^9.0.0-beta.1" - "@celo/dev-utils": "npm:0.0.6-beta.1" + "@celo/connect": "npm:^6.1.0-beta.1" + "@celo/contractkit": "npm:^9.0.0-beta.2" + "@celo/dev-utils": "npm:0.0.7-beta.1" "@celo/typescript": "workspace:^" "@types/bn.js": "npm:^5.1.0" "@types/debug": "npm:^4.1.5" @@ -2202,12 +2213,12 @@ __metadata: languageName: node linkType: hard -"@celo/wallet-base@npm:^6.0.2-beta.2, @celo/wallet-base@workspace:^, @celo/wallet-base@workspace:packages/sdk/wallets/wallet-base": +"@celo/wallet-base@npm:^6.0.4-beta.0, @celo/wallet-base@workspace:^, @celo/wallet-base@workspace:packages/sdk/wallets/wallet-base": version: 0.0.0-use.local resolution: "@celo/wallet-base@workspace:packages/sdk/wallets/wallet-base" dependencies: "@celo/base": "npm:^7.0.0-beta.0" - "@celo/connect": "npm:^6.0.3-beta.0" + "@celo/connect": "npm:^6.1.0-beta.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" "@ethereumjs/rlp": "npm:^5.0.2" @@ -2227,12 +2238,12 @@ __metadata: version: 0.0.0-use.local resolution: "@celo/wallet-hsm-aws@workspace:packages/sdk/wallets/wallet-hsm-aws" dependencies: - "@celo/connect": "npm:^6.0.3-beta.0" + "@celo/connect": "npm:^6.1.0-beta.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" - "@celo/wallet-base": "npm:^6.0.2-beta.2" - "@celo/wallet-hsm": "npm:^6.0.2-beta.2" - "@celo/wallet-remote": "npm:^6.0.2-beta.2" + "@celo/wallet-base": "npm:^6.0.4-beta.0" + "@celo/wallet-hsm": "npm:^6.0.4-beta.0" + "@celo/wallet-remote": "npm:^6.0.4-beta.0" "@ethereumjs/util": "npm:8.0.5" "@noble/ciphers": "npm:0.4.1" "@noble/curves": "npm:1.3.0" @@ -2247,7 +2258,7 @@ __metadata: languageName: unknown linkType: soft -"@celo/wallet-hsm-azure@npm:^6.0.2-beta.2, @celo/wallet-hsm-azure@workspace:packages/sdk/wallets/wallet-hsm-azure": +"@celo/wallet-hsm-azure@npm:^6.0.4-beta.0, @celo/wallet-hsm-azure@workspace:packages/sdk/wallets/wallet-hsm-azure": version: 0.0.0-use.local resolution: "@celo/wallet-hsm-azure@workspace:packages/sdk/wallets/wallet-hsm-azure" dependencies: @@ -2255,12 +2266,12 @@ __metadata: "@azure/keyvault-keys": "npm:^4.7.2" "@azure/keyvault-secrets": "npm:^4.7.0" "@celo/base": "npm:^7.0.0-beta.0" - "@celo/connect": "npm:^6.0.3-beta.0" + "@celo/connect": "npm:^6.1.0-beta.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" - "@celo/wallet-base": "npm:^6.0.2-beta.2" - "@celo/wallet-hsm": "npm:^6.0.2-beta.2" - "@celo/wallet-remote": "npm:^6.0.2-beta.2" + "@celo/wallet-base": "npm:^6.0.4-beta.0" + "@celo/wallet-hsm": "npm:^6.0.4-beta.0" + "@celo/wallet-remote": "npm:^6.0.4-beta.0" "@ethereumjs/util": "npm:8.0.5" "@noble/ciphers": "npm:0.4.1" "@noble/curves": "npm:1.3.0" @@ -2278,12 +2289,12 @@ __metadata: version: 0.0.0-use.local resolution: "@celo/wallet-hsm-gcp@workspace:packages/sdk/wallets/wallet-hsm-gcp" dependencies: - "@celo/connect": "npm:^6.0.3-beta.0" + "@celo/connect": "npm:^6.1.0-beta.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" - "@celo/wallet-base": "npm:^6.0.2-beta.2" - "@celo/wallet-hsm": "npm:^6.0.2-beta.2" - "@celo/wallet-remote": "npm:^6.0.2-beta.2" + "@celo/wallet-base": "npm:^6.0.4-beta.0" + "@celo/wallet-hsm": "npm:^6.0.4-beta.0" + "@celo/wallet-remote": "npm:^6.0.4-beta.0" "@ethereumjs/util": "npm:8.0.5" "@google-cloud/kms": "npm:~2.9.0" "@noble/ciphers": "npm:0.4.1" @@ -2298,7 +2309,7 @@ __metadata: languageName: unknown linkType: soft -"@celo/wallet-hsm@npm:^6.0.2-beta.2, @celo/wallet-hsm@workspace:packages/sdk/wallets/wallet-hsm": +"@celo/wallet-hsm@npm:^6.0.4-beta.0, @celo/wallet-hsm@workspace:packages/sdk/wallets/wallet-hsm": version: 0.0.0-use.local resolution: "@celo/wallet-hsm@workspace:packages/sdk/wallets/wallet-hsm" dependencies: @@ -2317,19 +2328,19 @@ __metadata: languageName: unknown linkType: soft -"@celo/wallet-ledger@npm:^6.0.2-beta.2, @celo/wallet-ledger@workspace:packages/sdk/wallets/wallet-ledger": +"@celo/wallet-ledger@npm:^6.0.4-beta.0, @celo/wallet-ledger@workspace:packages/sdk/wallets/wallet-ledger": version: 0.0.0-use.local resolution: "@celo/wallet-ledger@workspace:packages/sdk/wallets/wallet-ledger" dependencies: "@celo/base": "npm:^7.0.0-beta.0" - "@celo/connect": "npm:^6.0.3-beta.0" - "@celo/contractkit": "npm:^9.0.0-beta.1" + "@celo/connect": "npm:^6.1.0-beta.1" + "@celo/contractkit": "npm:^9.0.0-beta.2" "@celo/hw-app-eth": "npm:^1.0.0" "@celo/ledger-token-signer": "npm:^0.4.0" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" - "@celo/wallet-base": "npm:^6.0.2-beta.2" - "@celo/wallet-remote": "npm:^6.0.2-beta.2" + "@celo/wallet-base": "npm:^6.0.4-beta.0" + "@celo/wallet-remote": "npm:^6.0.4-beta.0" "@ethereumjs/util": "npm:8.0.5" "@ledgerhq/errors": "npm:^6.16.4" "@ledgerhq/hw-transport": "npm:^6.30.6" @@ -2359,15 +2370,15 @@ __metadata: languageName: node linkType: hard -"@celo/wallet-local@npm:^6.0.2-beta.0, @celo/wallet-local@npm:^6.0.2-beta.1, @celo/wallet-local@npm:^6.0.2-beta.2, @celo/wallet-local@workspace:packages/sdk/wallets/wallet-local": +"@celo/wallet-local@npm:^6.0.4-beta.0, @celo/wallet-local@workspace:packages/sdk/wallets/wallet-local": version: 0.0.0-use.local resolution: "@celo/wallet-local@workspace:packages/sdk/wallets/wallet-local" dependencies: "@celo/base": "npm:^7.0.0-beta.0" - "@celo/connect": "npm:^6.0.3-beta.0" + "@celo/connect": "npm:^6.1.0-beta.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" - "@celo/wallet-base": "npm:^6.0.2-beta.2" + "@celo/wallet-base": "npm:^6.0.4-beta.0" "@ethereumjs/util": "npm:8.0.5" "@types/debug": "npm:^4.1.12" debug: "npm:^4.3.5" @@ -2376,14 +2387,14 @@ __metadata: languageName: unknown linkType: soft -"@celo/wallet-remote@npm:^6.0.2-beta.2, @celo/wallet-remote@workspace:^, @celo/wallet-remote@workspace:packages/sdk/wallets/wallet-remote": +"@celo/wallet-remote@npm:^6.0.4-beta.0, @celo/wallet-remote@workspace:^, @celo/wallet-remote@workspace:packages/sdk/wallets/wallet-remote": version: 0.0.0-use.local resolution: "@celo/wallet-remote@workspace:packages/sdk/wallets/wallet-remote" dependencies: - "@celo/connect": "npm:^6.0.3-beta.0" + "@celo/connect": "npm:^6.1.0-beta.1" "@celo/typescript": "workspace:^" "@celo/utils": "npm:^8.0.0-beta.0" - "@celo/wallet-base": "npm:^6.0.2-beta.2" + "@celo/wallet-base": "npm:^6.0.4-beta.0" "@ethereumjs/util": "npm:8.0.5" "@types/debug": "npm:^4.1.5" web3: "npm:1.10.4" @@ -4501,6 +4512,15 @@ __metadata: languageName: node linkType: hard +"@noble/curves@npm:1.6.0, @noble/curves@npm:~1.6.0": + version: 1.6.0 + resolution: "@noble/curves@npm:1.6.0" + dependencies: + "@noble/hashes": "npm:1.5.0" + checksum: 9090b5a020b7e38c7b6d21506afaacd0c7557129d716a174334c1efc36385bf3ca6de16a543c216db58055e019c6a6c3bea8d9c0b79386e6bacff5c4c6b438a9 + languageName: node + linkType: hard + "@noble/curves@npm:~1.4.0": version: 1.4.2 resolution: "@noble/curves@npm:1.4.2" @@ -4545,7 +4565,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:^1.4.0, @noble/hashes@npm:~1.5.0": +"@noble/hashes@npm:1.5.0, @noble/hashes@npm:^1.4.0, @noble/hashes@npm:~1.5.0": version: 1.5.0 resolution: "@noble/hashes@npm:1.5.0" checksum: da7fc7af52af7afcf59810a7eea6155075464ff462ffda2572dc6d57d53e2669b1ea2ec774e814f6273f1697e567f28d36823776c9bf7068cba2a2855140f26e @@ -5165,6 +5185,46 @@ __metadata: languageName: node linkType: hard +"@safe-global/protocol-kit@npm:^5.0.4": + version: 5.0.4 + resolution: "@safe-global/protocol-kit@npm:5.0.4" + dependencies: + "@noble/hashes": "npm:^1.3.3" + "@safe-global/safe-deployments": "npm:^1.37.14" + "@safe-global/safe-modules-deployments": "npm:^2.2.4" + "@safe-global/types-kit": "npm:^1.0.0" + abitype: "npm:^1.0.2" + semver: "npm:^7.6.3" + viem: "npm:^2.21.8" + checksum: a6f7c64ca55dc61be1161920dca2f8aa4755d5289f14e271fc1c78c96239b478011f45d0921678dead647eed26dd3f2e2665c20f804eb05b93507142a0ef8de0 + languageName: node + linkType: hard + +"@safe-global/safe-deployments@npm:^1.37.14": + version: 1.37.14 + resolution: "@safe-global/safe-deployments@npm:1.37.14" + dependencies: + semver: "npm:^7.6.2" + checksum: f2e032238ce0ec0c786871fefcb5d75fb46fc5a25e1b0b2c47065fcea3d35bbb13dff564d9c810a6e4a0925488dd452a4ec0d1c4046b3d13c28b21c40d759acb + languageName: node + linkType: hard + +"@safe-global/safe-modules-deployments@npm:^2.2.4": + version: 2.2.4 + resolution: "@safe-global/safe-modules-deployments@npm:2.2.4" + checksum: 594a86c3c8b9b4b39379dfcc360cf81fce5bda633738f0455ce208447e0bbd01133ddb5934486e714d8115da8b5f38a1b7d2fa0fef2a04d57eb81362ef02ce6d + languageName: node + linkType: hard + +"@safe-global/types-kit@npm:^1.0.0": + version: 1.0.0 + resolution: "@safe-global/types-kit@npm:1.0.0" + dependencies: + abitype: "npm:^1.0.2" + checksum: a17024b306a3b93e1647d7d9629723e02c25e066774d7aaceca298d5e5ef49a736693ae9ed31b1a4a6fa5d0fcb97f5a08aaf059451e7929348520ceb232e9085 + languageName: node + linkType: hard + "@scure/base@npm:~1.1.0, @scure/base@npm:~1.1.4": version: 1.1.5 resolution: "@scure/base@npm:1.1.5" @@ -5172,7 +5232,7 @@ __metadata: languageName: node linkType: hard -"@scure/base@npm:~1.1.6, @scure/base@npm:~1.1.8": +"@scure/base@npm:~1.1.6, @scure/base@npm:~1.1.7, @scure/base@npm:~1.1.8": version: 1.1.9 resolution: "@scure/base@npm:1.1.9" checksum: f0ab7f687bbcdee2a01377fe3cd808bf63977999672751295b6a92625d5322f4754a96d40f6bd579bc367aad48ecf8a4e6d0390e70296e6ded1076f52adb16bb @@ -5223,6 +5283,17 @@ __metadata: languageName: node linkType: hard +"@scure/bip32@npm:1.5.0": + version: 1.5.0 + resolution: "@scure/bip32@npm:1.5.0" + dependencies: + "@noble/curves": "npm:~1.6.0" + "@noble/hashes": "npm:~1.5.0" + "@scure/base": "npm:~1.1.7" + checksum: 17e296a782e09aec18ed27e2e8bb6a76072604c40997ec49a6840f223296421612dbe6b44275f04db9acd6da6cefb0322141110f5ac9dc686eb0c44d5bd868fa + languageName: node + linkType: hard + "@scure/bip32@npm:^1.3.3": version: 1.3.3 resolution: "@scure/bip32@npm:1.3.3" @@ -7192,6 +7263,21 @@ __metadata: languageName: node linkType: hard +"abitype@npm:1.0.6, abitype@npm:^1.0.2": + version: 1.0.6 + resolution: "abitype@npm:1.0.6" + peerDependencies: + typescript: ">=5.0.4" + zod: ^3 >=3.22.0 + peerDependenciesMeta: + typescript: + optional: true + zod: + optional: true + checksum: d04d58f90405c29a3c68353508502d7e870feb27418a6281ba9a13e6aaee42c26b2c5f08f648f058b8eaffac32927194b33f396d2451d18afeccfb654c7285c2 + languageName: node + linkType: hard + "abort-controller@npm:^3.0.0": version: 3.0.0 resolution: "abort-controller@npm:3.0.0" @@ -12555,7 +12641,7 @@ __metadata: languageName: node linkType: hard -"inquirer@npm:^7.0.5": +"inquirer@npm:^7.3.3": version: 7.3.3 resolution: "inquirer@npm:7.3.3" dependencies: @@ -13091,6 +13177,15 @@ __metadata: languageName: node linkType: hard +"isows@npm:1.0.6": + version: 1.0.6 + resolution: "isows@npm:1.0.6" + peerDependencies: + ws: "*" + checksum: ab9e85b50bcc3d70aa5ec875aa2746c5daf9321cb376ed4e5434d3c2643c5d62b1f466d93a05cd2ad0ead5297224922748c31707cb4fbd68f5d05d0479dce99c + languageName: node + linkType: hard + "isstream@npm:~0.1.2": version: 0.1.2 resolution: "isstream@npm:0.1.2" @@ -17890,7 +17985,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.6.3": +"semver@npm:^7.6.2, semver@npm:^7.6.3": version: 7.6.3 resolution: "semver@npm:7.6.3" bin: @@ -19966,6 +20061,28 @@ __metadata: languageName: node linkType: hard +"viem@npm:^2.21.8": + version: 2.21.41 + resolution: "viem@npm:2.21.41" + dependencies: + "@adraffy/ens-normalize": "npm:1.11.0" + "@noble/curves": "npm:1.6.0" + "@noble/hashes": "npm:1.5.0" + "@scure/bip32": "npm:1.5.0" + "@scure/bip39": "npm:1.4.0" + abitype: "npm:1.0.6" + isows: "npm:1.0.6" + webauthn-p256: "npm:0.0.10" + ws: "npm:8.18.0" + peerDependencies: + typescript: ">=5.0.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: bd3d1426584eb319c6ab69949c188d7142f6fa14b38df5ed54c967c5d5246e4eb98a9412ab7d053ff3d649df3d0174fc57f8a1e6f2803ce3aa97be2e010500b9 + languageName: node + linkType: hard + "viem@npm:~1.5.4": version: 1.5.4 resolution: "viem@npm:1.5.4" @@ -20631,6 +20748,16 @@ __metadata: languageName: node linkType: hard +"webauthn-p256@npm:0.0.10": + version: 0.0.10 + resolution: "webauthn-p256@npm:0.0.10" + dependencies: + "@noble/curves": "npm:^1.4.0" + "@noble/hashes": "npm:^1.4.0" + checksum: dde2b6313b6a0f20996f7ee90181258fc7685bfff401df7d904578da75b374f25d5b9c1189cd2fcec30625b1f276b393188d156d49783f0611623cd713bb5b09 + languageName: node + linkType: hard + "webauthn-p256@npm:0.0.5": version: 0.0.5 resolution: "webauthn-p256@npm:0.0.5" @@ -20941,6 +21068,21 @@ __metadata: languageName: node linkType: hard +"ws@npm:8.18.0": + version: 8.18.0 + resolution: "ws@npm:8.18.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 70dfe53f23ff4368d46e4c0b1d4ca734db2c4149c6f68bc62cb16fc21f753c47b35fcc6e582f3bdfba0eaeb1c488cddab3c2255755a5c3eecb251431e42b3ff6 + languageName: node + linkType: hard + "ws@npm:8.2.3": version: 8.2.3 resolution: "ws@npm:8.2.3"