Skip to content

Commit

Permalink
Finalize anvil migration (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
shazarre authored Aug 29, 2024
1 parent 29ea8c3 commit 2c00a44
Show file tree
Hide file tree
Showing 23 changed files with 591 additions and 385 deletions.
24 changes: 22 additions & 2 deletions packages/cli/src/commands/identity/get-attestations.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
import { testWithGanache } from '@celo/dev-utils/lib/ganache-test'
import { newAttestations } from '@celo/abis/web3/Attestations'
import { StrongAddress } from '@celo/base'
import { newKitFromWeb3 } from '@celo/contractkit'
import { WrapperCache } from '@celo/contractkit/lib/contract-cache'
import { AttestationsWrapper } from '@celo/contractkit/lib/wrappers/Attestations'
import { testWithAnvilL1 } from '@celo/dev-utils/lib/anvil-test'
import { deployAttestationsContract } from '@celo/dev-utils/lib/contracts'
import Web3 from 'web3'
import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils'
import GetAttestations from './get-attestations'

process.env.NO_SYNCCHECK = 'true'

testWithGanache('identity:get-attetstations', (web3: Web3) => {
testWithAnvilL1('identity:get-attetstations', (web3: Web3) => {
beforeEach(async () => {
const kit = newKitFromWeb3(web3)
const accounts = (await web3.eth.getAccounts()) as StrongAddress[]
const attestationsContractAddress = await deployAttestationsContract(web3, accounts[0])

jest.spyOn(WrapperCache.prototype, 'getAttestations').mockImplementation(async () => {
return new AttestationsWrapper(
kit.connection,
newAttestations(web3, attestationsContractAddress),
newKitFromWeb3(web3).contracts
)
})
})

describe('input validation correctly outputs errors', () => {
const consoleOutput: string[] = []
const mockedError = (output: string) => consoleOutput.push(output)
Expand Down
150 changes: 78 additions & 72 deletions packages/cli/src/commands/network/__snapshots__/contracts.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,165 +6,171 @@ exports[`network:contracts runs 1`] = `
"[
{
"contract": "Accounts",
"proxy": "0xa9a65D631f8c8577f543B64B35909030C84676A2",
"implementation": "0x038C860fd0d598B3DF5577B466c8b0a074867f56",
"version": "1.1.4.1"
"proxy": "0x570cc7D1f4404689F309bC091751C8115AbBB1Ae",
"implementation": "0xA5BcC0165A7D6f6c238f4BC78F1BACCa89f63EDf",
"version": "1.1.5.0"
},
{
"contract": "Attestations",
"proxy": "0x54a582397Ace3F9a6F5A28cE6Dc50473E4A9d375",
"implementation": "0xc650825Ca03EeB83d0d075c2737022cBb01F5799",
"version": "1.2.0.0"
"contract": "BlockchainParameters",
"proxy": "0x38f95b6c6C45b68e03954f6BbE9d8fAcb96ac080",
"implementation": "0x97877ee036DAEEbb03b147b649547BecbAA5a9fc",
"version": "1.3.1.0"
},
{
"contract": "BlockchainParameters",
"proxy": "0xd418d14C9b8aA740E8D18C6dfda3af6f023A27A5",
"implementation": "0x4CF20BEf2FBe159601939bE49B760457B11C1d52",
"version": "1.3.0.0"
"contract": "CeloDistributionSchedule",
"proxy": "0xA16cF67AFa80BB9Ce7a325597F80057c6B290fD4",
"implementation": "0xd527Ff1eF7f68753C3eFB03830b3d507a0bB92f2",
"version": "1.1.0.0"
},
{
"contract": "DoubleSigningSlasher",
"proxy": "0x175Ac784563DE645647C6350F0CFc577Dcc7eE5b",
"implementation": "0xA47aA5fCecBfb374E79144F05fDf91D0F50fA351",
"version": "1.1.1.0"
"proxy": "0x515e7966df0A7BBE4cfd6Ead22EfBE9d3506F0a0",
"implementation": "0xC71980008Bb4F07195ce7B7bb4b04fb811f8dCBa",
"version": "1.1.2.0"
},
{
"contract": "DowntimeSlasher",
"proxy": "0x0C5173a51e26b29d6126C686756FB9FBEf71f762",
"implementation": "0x33a89cA59bc3A9221456ffE461de17C8deF24684",
"version": "2.0.0.0"
"proxy": "0x1bcD39557a6420F37cDBD9eBc3085D03d9d73668",
"implementation": "0x54F7Cea8B2361114B80B7aCD1a4Ed608AEB6b1a9",
"version": "2.0.1.0"
},
{
"contract": "Election",
"proxy": "0xcBAe15A320F56Fc9ad6c8319D55Be1FeF0750070",
"implementation": "0x51815ebd3C922B215b0d0B9b41a4Daa0dB70b841",
"version": "1.1.3.0"
"proxy": "0x778F5D194040A36c90865F02BEa4060297310609",
"implementation": "0x667ef60a07cf50eeC675125Fca2C95c6fB116d5e",
"version": "1.1.4.0"
},
{
"contract": "EpochRewards",
"proxy": "0x537732b0bAC4F2A1a97b1a60cEa0df5C3f0DEF16",
"implementation": "0x1E28a5fB7B112291F088bBB8ab693D2214DB7895",
"version": "1.1.1.0"
"proxy": "0x6dA691c7b03273310B7De55187cC911D91f2b437",
"implementation": "0x082C34Dc84a0Ae0214bB754BA63afA680a2A2a2a",
"version": "1.1.2.0"
},
{
"contract": "Escrow",
"proxy": "0xE8593eFb73423D86e5F337A46B3450eEec1027c6",
"implementation": "0xc51B43db0Cea40E36207993F0aB1883E7A865417",
"proxy": "0x221BbCfE8e148c83f28aBef4cd44804A48A0979D",
"implementation": "0x6C9f18245726D34d95905B0e78e295Ab66668dCE",
"version": "1.2.0.0"
},
{
"contract": "FederatedAttestations",
"proxy": "0x8C3d218745c360A399285c0176714530Ce0af3B1",
"implementation": "0x9d0e84A58Bb5B9b94F5c34fD4f310ed3F41A2D69",
"proxy": "0x838657d02B4A110A5eec7Ea1eE370b81ceC13b2d",
"implementation": "0xDD5d5C001A41Cca679346Ac949d22958a6402a4b",
"version": "1.1.0.0"
},
{
"contract": "FeeCurrencyDirectory",
"proxy": "0x32d3Fa78c85842C7F55550dfc13d7440E650978e",
"implementation": "0xAB0f45164119Da3523e94aeAfa97f8Af402f3931",
"version": "1.1.0.0"
},
{
"contract": "FeeCurrencyWhitelist",
"proxy": "0xE86bB98fcF9BFf3512C74589B78Fb168200CC546",
"implementation": "0xDc688D29394a3f1E6f1E5100862776691afAf3d2",
"proxy": "0xE6D8431e15C0E2Ebc2c4cC32C6aA283D2A9f7637",
"implementation": "0x444e17f7D12a55682588C5aC8FD75E6415858Fa8",
"version": "NONE"
},
{
"contract": "FeeHandler",
"proxy": "0x176097114008844bCb75Ea58998B7f8303b4C2d4",
"implementation": "0x123d0530A2a37FA4d4efA3999e79203BAf5bE517",
"version": "1.1.0.0"
"proxy": "0x17c32B4036C68950F1b3fe4068f4F10AADa0d6a3",
"implementation": "0x00B00F97C60B7d87cda0470DFf25eF479A53C40d",
"version": "1.1.0.1"
},
{
"contract": "Freezer",
"proxy": "0xcFC18CEc799fBD1793B5C43E773C98D4d61Cc2dB",
"implementation": "0xF22469F31527adc53284441bae1665A7b9214DBA",
"proxy": "0xAF64491fc6f744833F57caAD9a3e7041A64d322E",
"implementation": "0x2cE041EFA055795ed86d3749375626A960A31b36",
"version": "NONE"
},
{
"contract": "GasPriceMinimum",
"proxy": "0x038F9B392Fb9A9676DbAddF78EA5fdbf6C7d9710",
"implementation": "0x371b13d97f4bF77d724E78c16B7dC74099f40e84",
"version": "1.2.0.1"
"proxy": "0xaB21B082c398fAC79358163aEcAEEc577105DA97",
"implementation": "0x6886C0Be3AAD36bAaE412c451AcB7A2da6980e8A",
"version": "1.2.1.0"
},
{
"contract": "GoldToken",
"proxy": "0x04B5dAdd2c0D6a261bfafBc964E0cAc48585dEF3",
"implementation": "0x8726C7414ac023D23348326B47AF3205185Fd035",
"version": "1.1.2.0"
"proxy": "0x2365F470a061B8333BAdE225eb7B34E2f9A3B4B2",
"implementation": "0x2f16Ca901004271605b5Fe247E1953F17A8BbF80",
"version": "1.1.3.0"
},
{
"contract": "Governance",
"proxy": "0x82E9A894F6b752E5c1058ea69898Ff5D3EBA3939",
"implementation": "0xc98E260cBF7041cc2C42D7e055fb4350DF22dd68",
"version": "1.4.1.0"
"proxy": "0x8345D9Fe2954ECa19cf6437EbA884609fb95B8a4",
"implementation": "0xE6D9BDcFcA7c240ac42963cf216648e3d670955b",
"version": "1.5.0.0"
},
{
"contract": "LockedGold",
"proxy": "0x4A86aD5f263260f24483Df2B1B3a23ea4788B6AB",
"implementation": "0x0221652D4306F6b3CB7B23E43C3e25D8F9a142Ca",
"version": "1.1.4.0"
"proxy": "0x8CcF2E718ff8A3a3356045B9e28F2717d734E190",
"implementation": "0x76ae174e3E18a1E83B234063D010AA255e24F87e",
"version": "1.1.5.0"
},
{
"contract": "MentoFeeHandlerSeller",
"proxy": "0x98942DE2B8eaC1c264e41cA981b82032762d72a4",
"implementation": "0x8501835ac2B234147F766bB6e6423D6Ef50A9247",
"version": "1.1.0.0"
"proxy": "0xBc5AFaB0842bA88283f0379F5ad39FBA61ddc4c3",
"implementation": "0x8dF962Afff35F23D9953b198Db3451B1664876f0",
"version": "1.1.0.1"
},
{
"contract": "OdisPayments",
"proxy": "0x347BfD5F56F04210603c9cC7c6c1f88E9E5c9676",
"implementation": "0x05E0c172eB6244A564B0D9e59Ce63074584a1e7A",
"proxy": "0x4b37Fe822B332616D5355c2E34495f61259aF2F8",
"implementation": "0x013b9d221dB9946f520862B5a538d31C1658F020",
"version": "1.1.0.0"
},
{
"contract": "Random",
"proxy": "0xd2dBF3250a764eaaa94fa0C84ED87C0Edc8eD04E",
"implementation": "0x39c3Fc9F4D8430af2713306CE80C584752d9e1C7",
"version": "1.1.1.0"
"proxy": "0xba7574365c34e24119C5751B77722268B1B31117",
"implementation": "0x5971E1E2A749974B7E1f31499C0364aE31E47D2F",
"version": "1.1.2.0"
},
{
"contract": "Registry",
"proxy": "0x000000000000000000000000000000000000ce10",
"implementation": "0x07f96Aa816C1F244CbC6ef114bB2b023Ba54a2EB",
"implementation": "0x600ed1f58Dfe89b1baBB04611b3B69be409C49E1",
"version": "NONE"
},
{
"contract": "Reserve",
"proxy": "0xCA9717a4A6e8009B3518648C9f3E7676255471A1",
"implementation": "0x4586649629F699f9A4B61D0e962DC3c9025Fe488",
"proxy": "0x903f4b9523c23Db2a631CB111EFc55776D811ae2",
"implementation": "0x843Ea04327C2D6E48FfDa66977Be24591B718FBD",
"version": "1.1.2.2"
},
{
"contract": "SortedOracles",
"proxy": "0x4D3d5c850Dd5bD9D6F4AdDA3DD039a3C8054CA29",
"implementation": "0xA31E64EA55B9B6Bbb9d6A676738e9A5b23149f84",
"version": "1.1.3.0"
"proxy": "0xF0358Ffb1DC83CbFAD879735918f3E3570c9ae05",
"implementation": "0xd275F2F2605f8bAddfDc8e56FEf092DdE3C74D7E",
"version": "1.1.4.0"
},
{
"contract": "StableToken",
"proxy": "0x5315e44798395d4a952530d131249fE00f554565",
"implementation": "0xDFF540fE764855D3175DcfAe9d91AE8aEE5C6D6F",
"proxy": "0x82398F079D742F9D0Ae71ef8C99E5c68b2eD6705",
"implementation": "0xf50DF42DA1685033D684dbA711042B87eB00282b",
"version": "NONE"
},
{
"contract": "StableTokenBRL",
"proxy": "0x965D352283a3C8A016b9BBbC9bf6306665d495E7",
"implementation": "0x9a1df498af690a7EB43E10A28AB51345a3A33F75",
"proxy": "0x603931FF5E63d2fd3EEF1513a55fB773d8082195",
"implementation": "0x1dbdc8B4616004724436348ae22b20C6265F7444",
"version": "NONE"
},
{
"contract": "StableTokenEUR",
"proxy": "0xdD66C23e07b4D6925b6089b5Fe6fc9E62941aFE8",
"implementation": "0x4609e0ED27A8BAAc57b753D36a5D2971915588f9",
"proxy": "0x0c6a0fde0A72bA3990870f0F99ED79a821703474",
"implementation": "0x58e9F2416b1FCBa8A61AC46d480d2d92e471b22E",
"version": "NONE"
},
{
"contract": "UniswapFeeHandlerSeller",
"proxy": "0x9EF3dACB3367d7741099b5607A7a93E99a119F7b",
"implementation": "0x0F3723fB2a7C147357868702164f9beEf54E1E85",
"version": "1.1.0.0"
"proxy": "0x3d3D4D5101504944f7AF4A7b4485c598cfE58B7a",
"implementation": "0x87e2B146C6226250fCDc5600070cb0B37Fe1F383",
"version": "1.1.0.1"
},
{
"contract": "Validators",
"proxy": "0x6AC7189BD267c81c55d7d7d0321f9B23639cB9db",
"implementation": "0x3E809c563c15a295E832e37053798DdC8d6C8dab",
"version": "1.2.0.5"
"proxy": "0xDC9289b80E1ea63640C809664b891b1df517D567",
"implementation": "0xA45f627ebF37cf2A72BF6Af91F0c17D470E354fF",
"version": "1.3.0.0"
}
]
",
Expand Down
9 changes: 5 additions & 4 deletions packages/cli/src/commands/network/contracts.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { testWithGanache } from '@celo/dev-utils/lib/ganache-test'
import { testWithAnvilL1 } from '@celo/dev-utils/lib/anvil-test'
import write from '@oclif/core/lib/cli-ux/write'
import { testLocally } from '../../test-utils/cliUtils'
import Web3 from 'web3'
import { testLocallyWithWeb3Node } from '../../test-utils/cliUtils'
import Contracts from './contracts'
process.env.NO_SYNCCHECK = 'true'

testWithGanache('network:contracts', () => {
testWithAnvilL1('network:contracts', (web3: Web3) => {
test('runs', async () => {
const spy = jest.spyOn(write, 'stdout')
await testLocally(Contracts, ['--output', 'json'])
await testLocallyWithWeb3Node(Contracts, ['--output', 'json'], web3)
expect(spy.mock.calls).toMatchSnapshot()
})
})
Loading

0 comments on commit 2c00a44

Please sign in to comment.