diff --git a/.circleci/config.yml b/.circleci/config.yml index c6f8f98eb..baa7ae8df 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -116,13 +116,42 @@ jobs: - install-anvil - run-anvil: chain: base-goerli - - install-ipfs - - run-ipfs + #- install-ipfs + #- run-ipfs - yarn-install - wait-for-anvil - - wait-for-ipfs + #- wait-for-ipfs - - run: echo "OK" + - run: + name: "Generate upgrade transactions" + command: | + yarn cannon build \ + omnibus-base-goerli-andromeda.toml \ + --dry-run \ + --preset andromeda \ + --upgrade-from synthetix-omnibus:latest \ + --chain-id 84531 \ + --provider-url https://base-goerli.infura.io/v3/$INFURA_API_KEY \ + --write-script ./e2e/upgrade--base-goerli-andromeda.json \ + --write-script-format json + yarn prettier --write ./e2e/upgrade--base-goerli-andromeda.json + + - run: + name: "Generate deployments" + command: node e2e/fetch-local-deployment.js 84531 omnibus-base-goerli-andromeda.toml + + - store_artifacts: + path: "./e2e/upgrade--base-goerli-andromeda.json" + + - run: + name: "Upgrade on local fork" + command: node e2e/deploy.js ./e2e/upgrade--base-goerli-andromeda.json + + - run: + name: "Run tests" + environment: + - DEBUG: "tasks:*" + command: yarn mocha e2e/tests/base-goerli-andromeda/*.e2e.js workflows: version: 2.1 diff --git a/e2e/deploy.js b/e2e/deploy.js new file mode 100644 index 000000000..2bb0783e1 --- /dev/null +++ b/e2e/deploy.js @@ -0,0 +1,49 @@ +const util = require('util'); +const path = require('path'); +const { ethers } = require('ethers'); + +util.inspect.defaultOptions.depth = null; +util.inspect.defaultOptions.maxArrayLength = null; + +const fgReset = '\x1b[0m'; +const fgRed = '\x1b[31m'; +const fgGreen = '\x1b[32m'; +const fgYellow = '\x1b[33m'; +const fgCyan = '\x1b[36m'; + +ethers.BigNumber.prototype[util.inspect.custom] = function (depth, inspectOptions, inspect) { + return `${fgCyan}BigNumber( ${fgYellow}${fgGreen}${this.toHexString()} ${fgYellow}${this.toString()}${fgCyan} )${fgReset}`; +}; + +const [txnsFile] = process.argv.slice(2); +if (!txnsFile) { + console.error(`${fgRed}ERROR: Expected 1 argument${fgReset}`); + console.error(`Usage: ${fgCyan}node e2e/deploy.js "TXNS_FILE"${fgReset}`); + console.error( + `Example: ${fgGreen}node e2e/deploy.js "./upgrade--base-goerli-andromeda.json"${fgReset}` + ); + process.exit(1); +} +console.log(`Loading update transactions from ${fgGreen}"${txnsFile}"${fgReset}`); +const upgrade = require(path.resolve(txnsFile)); + +async function run() { + const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); + for (const { hash, from, to, data, value } of upgrade.txns) { + // console.log(`provider`, provider); + console.log(); + console.log(); + console.log(); + console.log('============================================================================'); + console.log({ hash, from, to, data, value }); + await provider.send('anvil_setBalance', [from, ethers.utils.parseEther('10').toHexString()]); + await provider.send('anvil_impersonateAccount', [from]); + const signer = provider.getSigner(from); + const tx = await signer.sendTransaction({ to, data, value }); + const result = await tx.wait(); + console.log(result); + await provider.send('anvil_stopImpersonatingAccount', [from]); + console.log('============================================================================'); + } +} +run(); diff --git a/e2e/fetch-local-deployment.js b/e2e/fetch-local-deployment.js new file mode 100755 index 000000000..ae5e19d85 --- /dev/null +++ b/e2e/fetch-local-deployment.js @@ -0,0 +1,95 @@ +#!/usr/bin/env node + +const os = require('os'); +const path = require('path'); +const fs = require('fs/promises'); +const toml = require('@iarna/toml'); +const { ethers } = require('ethers'); +const { LocalRegistry } = require('@usecannon/cli/dist/src/registry'); +const { CliLoader } = require('@usecannon/cli/dist/src/loader'); +const CANNON_DIRECTORY = path.join(os.homedir(), '.local', 'share', 'cannon'); + +const fgReset = '\x1b[0m'; +const fgRed = '\x1b[31m'; +const fgGreen = '\x1b[32m'; +const fgYellow = '\x1b[33m'; +const fgCyan = '\x1b[36m'; + +const [chainId, deploymentFile] = process.argv.slice(2); +if (!chainId || !deploymentFile) { + console.error(`${fgRed}ERROR: Expected 2 arguments${fgReset}`); + console.error( + `Usage: ${fgGreen}node e2e/fetch-local-deployment.js ${fgYellow}chainId ${fgCyan}deploymentFile${fgReset}` + ); + console.error( + `Example: ${fgGreen}node e2e/fetch-local-deployment.js ${fgYellow}84531 ${fgCyan}omnibus-base-goerli-andromeda.toml${fgReset}` + ); + process.exit(1); +} + +function readableAbi(abi) { + return new ethers.utils.Interface(abi).format(ethers.utils.FormatTypes.full); +} + +async function run() { + const config = await fs.readFile(deploymentFile, 'utf8'); + const { name, version, setting } = toml.parse(config); + const preset = setting?.target_preset?.defaultValue ?? 'main'; + + console.log('Resolving URL', { + packageRef: `${name}:${version}`, + variant: `${chainId}-${preset}`, + }); + const localRegistry = new LocalRegistry(CANNON_DIRECTORY); + const url = await await localRegistry.getUrl(`${name}:${version}`, `${chainId}-${preset}`); + console.log(`Resolved URL:`, { url }); + + console.log('Fetching deployment state', { url }); + const deployments = JSON.parse( + await fs.readFile(`${CANNON_DIRECTORY}/ipfs_cache/${CliLoader.getCacheHash(url)}.json`, 'utf8') + ); + + await fs.mkdir(`${__dirname}/deployments`, { recursive: true }); + + const snxAddress = setting?.snx_address?.defaultValue ?? ethers.constants.AddressZero; + await fs.writeFile( + `${__dirname}/deployments/snx.json`, + JSON.stringify({ address: snxAddress }, null, 2) + ); + + const system = deployments.state['provision.system'].artifacts.imports.system; + await fs.writeFile( + `${__dirname}/deployments/CoreProxy.json`, + JSON.stringify( + { + address: system.contracts.CoreProxy.address, + abi: readableAbi(system.contracts.CoreProxy.abi), + }, + null, + 2 + ) + ); + + async function mintableToken(provisionStep) { + const fakeCollateral = + deployments?.state?.[`provision.${provisionStep}`]?.artifacts?.imports?.[provisionStep]; + if (fakeCollateral) { + const [, ticker] = fakeCollateral.contracts.MintableToken.constructorArgs; + await fs.writeFile( + `${__dirname}/deployments/FakeCollateral${ticker}.json`, + JSON.stringify( + { + address: fakeCollateral.contracts.MintableToken.address, + abi: readableAbi(fakeCollateral.contracts.MintableToken.abi), + }, + null, + 2 + ) + ); + } + } + await mintableToken('usdc_mock_collateral'); + await mintableToken('mintableToken'); +} + +run(); diff --git a/e2e/tasks/approveCollateral.js b/e2e/tasks/approveCollateral.js index 5042609ad..a7340277d 100644 --- a/e2e/tasks/approveCollateral.js +++ b/e2e/tasks/approveCollateral.js @@ -1,11 +1,10 @@ const { ethers } = require('ethers'); -const { importCoreProxy } = require('./importCoreProxy'); const { getCollateralConfig } = require('./getCollateralConfig'); +const CoreProxy = require('../deployments/CoreProxy.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); async function approveCollateral({ privateKey, symbol }) { - const CoreProxy = await importCoreProxy(); const config = await getCollateralConfig(symbol); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const wallet = new ethers.Wallet(privateKey, provider); diff --git a/e2e/tasks/borrowUsd.js b/e2e/tasks/borrowUsd.js index 2645cb5dd..65f2d6354 100644 --- a/e2e/tasks/borrowUsd.js +++ b/e2e/tasks/borrowUsd.js @@ -1,11 +1,10 @@ const { ethers } = require('ethers'); -const { importCoreProxy } = require('./importCoreProxy'); const { getCollateralConfig } = require('./getCollateralConfig'); +const CoreProxy = require('../deployments/CoreProxy.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); async function borrowUsd({ privateKey, accountId, symbol, amount, poolId }) { - const CoreProxy = await importCoreProxy(); const config = await getCollateralConfig(symbol); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const wallet = new ethers.Wallet(privateKey, provider); diff --git a/e2e/tasks/createAccount.js b/e2e/tasks/createAccount.js index b2a38b7bf..673f9d277 100644 --- a/e2e/tasks/createAccount.js +++ b/e2e/tasks/createAccount.js @@ -1,12 +1,11 @@ const { ethers } = require('ethers'); -const crypto = require('crypto'); -const { importCoreProxy } = require('./importCoreProxy'); +// const crypto = require('crypto'); const { getAccountOwner } = require('./getAccountOwner'); +const CoreProxy = require('../deployments/CoreProxy.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); async function createAccount({ privateKey, accountId }) { - const CoreProxy = await importCoreProxy(); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const wallet = new ethers.Wallet(privateKey, provider); const coreProxy = new ethers.Contract(CoreProxy.address, CoreProxy.abi, wallet); diff --git a/e2e/tasks/delegateCollateral.js b/e2e/tasks/delegateCollateral.js index 2ff6d855e..33e6164ce 100644 --- a/e2e/tasks/delegateCollateral.js +++ b/e2e/tasks/delegateCollateral.js @@ -1,11 +1,10 @@ const { ethers } = require('ethers'); const { getCollateralConfig } = require('./getCollateralConfig'); -const { importCoreProxy } = require('./importCoreProxy'); +const CoreProxy = require('../deployments/CoreProxy.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); async function delegateCollateral({ privateKey, accountId, symbol, amount, poolId }) { - const CoreProxy = await importCoreProxy(); const config = await getCollateralConfig(symbol); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const wallet = new ethers.Wallet(privateKey, provider); diff --git a/e2e/tasks/depositCollateral.js b/e2e/tasks/depositCollateral.js index 415c7c699..dd867e564 100644 --- a/e2e/tasks/depositCollateral.js +++ b/e2e/tasks/depositCollateral.js @@ -1,11 +1,10 @@ const { ethers } = require('ethers'); const { getCollateralConfig } = require('./getCollateralConfig'); -const { importCoreProxy } = require('./importCoreProxy'); +const CoreProxy = require('../deployments/CoreProxy.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); async function depositCollateral({ privateKey, accountId, symbol, amount }) { - const CoreProxy = await importCoreProxy(); const config = await getCollateralConfig(symbol); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const wallet = new ethers.Wallet(privateKey, provider); diff --git a/e2e/tasks/getAccountCollateral.js b/e2e/tasks/getAccountCollateral.js index 09abe9257..75d99126a 100644 --- a/e2e/tasks/getAccountCollateral.js +++ b/e2e/tasks/getAccountCollateral.js @@ -1,9 +1,8 @@ const { ethers } = require('ethers'); const { getCollateralConfig } = require('./getCollateralConfig'); -const { importCoreProxy } = require('./importCoreProxy'); +const CoreProxy = require('../deployments/CoreProxy.json'); async function getAccountCollateral({ accountId, symbol }) { - const CoreProxy = await importCoreProxy(); const config = await getCollateralConfig(symbol); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const coreProxy = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider); diff --git a/e2e/tasks/getAccountOwner.js b/e2e/tasks/getAccountOwner.js index 972f6edaf..4acd24010 100644 --- a/e2e/tasks/getAccountOwner.js +++ b/e2e/tasks/getAccountOwner.js @@ -1,8 +1,7 @@ const { ethers } = require('ethers'); -const { importCoreProxy } = require('./importCoreProxy'); +const CoreProxy = require('../deployments/CoreProxy.json'); async function getAccountOwner({ accountId }) { - const CoreProxy = await importCoreProxy(); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const coreProxy = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider); diff --git a/e2e/tasks/getCollateralAllowance.js b/e2e/tasks/getCollateralAllowance.js index 1c384327c..1dac52927 100644 --- a/e2e/tasks/getCollateralAllowance.js +++ b/e2e/tasks/getCollateralAllowance.js @@ -1,9 +1,8 @@ const { ethers } = require('ethers'); const { getCollateralConfig } = require('./getCollateralConfig'); -const { importCoreProxy } = require('./importCoreProxy'); +const CoreProxy = require('../deployments/CoreProxy.json'); async function getCollateralAllowance({ address, symbol }) { - const CoreProxy = await importCoreProxy(); const config = await getCollateralConfig(symbol); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const Token = new ethers.Contract( diff --git a/e2e/tasks/getCollateralConfig.js b/e2e/tasks/getCollateralConfig.js index 07452e22b..d1b4d8800 100644 --- a/e2e/tasks/getCollateralConfig.js +++ b/e2e/tasks/getCollateralConfig.js @@ -1,8 +1,7 @@ const { ethers } = require('ethers'); -const { importCoreProxy } = require('./importCoreProxy'); +const CoreProxy = require('../deployments/CoreProxy.json'); async function getCollateralConfig(symbol) { - const CoreProxy = await importCoreProxy(); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const coreProxy = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider); diff --git a/e2e/tasks/getConfigUint.js b/e2e/tasks/getConfigUint.js index 33b76cc8a..563d2381b 100644 --- a/e2e/tasks/getConfigUint.js +++ b/e2e/tasks/getConfigUint.js @@ -1,8 +1,7 @@ const { ethers } = require('ethers'); -const { importCoreProxy } = require('./importCoreProxy'); +const CoreProxy = require('../deployments/CoreProxy.json'); async function getConfigUint(key) { - const CoreProxy = await importCoreProxy(); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const coreProxy = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider); const value = await coreProxy.getConfigUint(ethers.utils.formatBytes32String(key)); diff --git a/e2e/tasks/getFakeCollateralTKNBalance.js b/e2e/tasks/getFakeCollateralTKNBalance.js index 289c46018..b34c3155d 100644 --- a/e2e/tasks/getFakeCollateralTKNBalance.js +++ b/e2e/tasks/getFakeCollateralTKNBalance.js @@ -1,13 +1,11 @@ const { ethers } = require('ethers'); -const { importFakeCollateralTKN } = require('./importFakeCollateralTKN'); +const FakeCollateralTKN = require('../deployments/FakeCollateralTKN.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); async function getFakeCollateralTKNBalance({ address }) { const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); - const FakeCollateralTKN = await importFakeCollateralTKN(); const erc20 = new ethers.Contract(FakeCollateralTKN.address, FakeCollateralTKN.abi, provider); - const balance = parseFloat(ethers.utils.formatUnits(await erc20.balanceOf(address))); return balance; } diff --git a/e2e/tasks/getPreset.js b/e2e/tasks/getPreset.js deleted file mode 100644 index a455195da..000000000 --- a/e2e/tasks/getPreset.js +++ /dev/null @@ -1,17 +0,0 @@ -const path = require('path'); -const fs = require('fs/promises'); -const toml = require('@iarna/toml'); - -const ROOT = path.resolve(`${__dirname}/../..`); -async function getPreset() { - if (!process.env.TEST_TOML) { - return 'main'; - } - const config = await fs.readFile(`${ROOT}/${process.env.TEST_TOML}`, 'utf8'); - const { setting } = toml.parse(config); - return setting?.target_preset?.defaultValue ?? 'main'; -} - -module.exports = { - getPreset, -}; diff --git a/e2e/tasks/importCoreProxy.js b/e2e/tasks/importCoreProxy.js deleted file mode 100644 index f8f9140cc..000000000 --- a/e2e/tasks/importCoreProxy.js +++ /dev/null @@ -1,13 +0,0 @@ -const { ethers } = require('ethers'); -const { getPreset } = require('./getPreset'); - -async function importCoreProxy() { - const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); - const network = await provider.getNetwork(); - const preset = await getPreset(); - return require(`../deployments/${network.chainId}-${preset}/CoreProxy.json`); -} - -module.exports = { - importCoreProxy, -}; diff --git a/e2e/tasks/importFakeCollateralTKN.js b/e2e/tasks/importFakeCollateralTKN.js deleted file mode 100644 index b301d51f7..000000000 --- a/e2e/tasks/importFakeCollateralTKN.js +++ /dev/null @@ -1,13 +0,0 @@ -const { ethers } = require('ethers'); -const { getPreset } = require('./getPreset'); - -async function importFakeCollateralTKN() { - const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); - const network = await provider.getNetwork(); - const preset = await getPreset(); - return require(`../deployments/${network.chainId}-${preset}/FakeCollateralTKN.json`); -} - -module.exports = { - importFakeCollateralTKN, -}; diff --git a/e2e/tasks/importSnx.js b/e2e/tasks/importSnx.js deleted file mode 100644 index 7be36b4d7..000000000 --- a/e2e/tasks/importSnx.js +++ /dev/null @@ -1,13 +0,0 @@ -const ethers = require('ethers'); -const { getPreset } = require('./getPreset'); - -async function importSnx() { - const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); - const network = await provider.getNetwork(); - const preset = await getPreset(); - return require(`../deployments/${network.chainId}-${preset}/snx.json`); -} - -module.exports = { - importSnx, -}; diff --git a/e2e/tasks/index.js b/e2e/tasks/index.js deleted file mode 100644 index 5f5ba7455..000000000 --- a/e2e/tasks/index.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = { - ...require('./approveCollateral'), - ...require('./borrowUsd'), - ...require('./createAccount'), - ...require('./delegateCollateral'), - ...require('./depositCollateral'), - ...require('./getAccountCollateral'), - ...require('./getAccountOwner'), - ...require('./getCollateralAllowance'), - ...require('./getCollateralBalance'), - ...require('./getCollateralConfig'), - ...require('./getConfigUint'), - ...require('./getEthBalance'), - ...require('./getFakeCollateralTKNBalance'), - ...require('./getPreset'), - ...require('./importCoreProxy'), - ...require('./importFakeCollateralTKN'), - ...require('./importSnx'), - ...require('./index'), - ...require('./setConfigUint'), - ...require('./setEthBalance'), - ...require('./setFakeCollateralTKNBalance'), - ...require('./setSnxBalance'), - ...require('./withdrawCollateral'), - ...require('./wrapEth'), -}; diff --git a/e2e/tasks/setConfigUint.js b/e2e/tasks/setConfigUint.js index cc938bf68..2b34664c6 100644 --- a/e2e/tasks/setConfigUint.js +++ b/e2e/tasks/setConfigUint.js @@ -1,13 +1,12 @@ const { ethers } = require('ethers'); -const { importCoreProxy } = require('./importCoreProxy'); const { setEthBalance } = require('./setEthBalance'); const { getConfigUint } = require('./getConfigUint'); const { hexlify, hexZeroPad } = require('@ethersproject/bytes'); +const CoreProxy = require('../deployments/CoreProxy.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); async function setConfigUint({ key, value }) { - const CoreProxy = await importCoreProxy(); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const coreProxy = new ethers.Contract(CoreProxy.address, CoreProxy.abi, provider); const owner = await coreProxy.owner(); diff --git a/e2e/tasks/setFakeCollateralTKNBalance.js b/e2e/tasks/setFakeCollateralTKNBalance.js index ab48261a1..414d500ff 100644 --- a/e2e/tasks/setFakeCollateralTKNBalance.js +++ b/e2e/tasks/setFakeCollateralTKNBalance.js @@ -1,7 +1,5 @@ const { ethers } = require('ethers'); -const { getCollateralConfig } = require('./getCollateralConfig'); -const { setEthBalance } = require('./setEthBalance'); -const { importFakeCollateralTKN } = require('./importFakeCollateralTKN'); +const FakeCollateralTKN = require('../deployments/FakeCollateralTKN.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); @@ -9,7 +7,6 @@ async function setFakeCollateralTKNBalance({ privateKey, balance }) { const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const wallet = new ethers.Wallet(privateKey, provider); - const FakeCollateralTKN = await importFakeCollateralTKN(); const erc20 = new ethers.Contract(FakeCollateralTKN.address, FakeCollateralTKN.abi, wallet); const oldBalance = parseFloat(ethers.utils.formatUnits(await erc20.balanceOf(wallet.address))); diff --git a/e2e/tasks/withdrawCollateral.js b/e2e/tasks/withdrawCollateral.js index b4ed360b5..cdfb42a2a 100644 --- a/e2e/tasks/withdrawCollateral.js +++ b/e2e/tasks/withdrawCollateral.js @@ -1,11 +1,10 @@ const { ethers } = require('ethers'); const { getCollateralConfig } = require('./getCollateralConfig'); -const { importCoreProxy } = require('./importCoreProxy'); +const CoreProxy = require('../deployments/CoreProxy.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); async function withdrawCollateral({ privateKey, accountId, symbol, amount }) { - const CoreProxy = await importCoreProxy(); const config = await getCollateralConfig(symbol); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const wallet = new ethers.Wallet(privateKey, provider); diff --git a/e2e/tasks/wrapEth.js b/e2e/tasks/wrapEth.js index b7806b4f8..e3510a5b4 100644 --- a/e2e/tasks/wrapEth.js +++ b/e2e/tasks/wrapEth.js @@ -1,5 +1,5 @@ const { ethers } = require('ethers'); -const { importCoreProxy } = require('./importCoreProxy'); +const CoreProxy = require('../deployments/CoreProxy.json'); const log = require('debug')(`tasks:${require('path').basename(__filename, '.js')}`); @@ -10,7 +10,6 @@ const erc20Abi = [ ]; async function wrapEth({ privateKey, amount }) { - const CoreProxy = await importCoreProxy(); const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545'); const wallet = new ethers.Wallet(privateKey, provider); diff --git a/e2e/tests/Staking.js b/e2e/tests/Staking.js index 4db179962..e606f6211 100644 --- a/e2e/tests/Staking.js +++ b/e2e/tests/Staking.js @@ -1,22 +1,20 @@ const assert = require('assert'); const { ethers } = require('ethers'); const crypto = require('crypto'); -const { - approveCollateral, - createAccount, - delegateCollateral, - depositCollateral, - getAccountCollateral, - getAccountOwner, - getCollateralAllowance, - getCollateralBalance, - getConfigUint, - getEthBalance, - setConfigUint, - setEthBalance, - setSnxBalance, - withdrawCollateral, -} = require('../tasks'); +const { approveCollateral } = require('../tasks/approveCollateral'); +const { createAccount } = require('../tasks/createAccount'); +const { delegateCollateral } = require('../tasks/delegateCollateral'); +const { depositCollateral } = require('../tasks/depositCollateral'); +const { getAccountCollateral } = require('../tasks/getAccountCollateral'); +const { getAccountOwner } = require('../tasks/getAccountOwner'); +const { getCollateralAllowance } = require('../tasks/getCollateralAllowance'); +const { getCollateralBalance } = require('../tasks/getCollateralBalance'); +const { getConfigUint } = require('../tasks/getConfigUint'); +const { getEthBalance } = require('../tasks/getEthBalance'); +const { setConfigUint } = require('../tasks/setConfigUint'); +const { setEthBalance } = require('../tasks/setEthBalance'); +const { setSnxBalance } = require('../tasks/setSnxBalance'); +const { withdrawCollateral } = require('../tasks/withdrawCollateral'); exports.run = function () { let address; diff --git a/e2e/tests/omnibus-base-goerli-andromeda.toml/Collateral Limits.e2e.js b/e2e/tests/base-goerli-andromeda/Collateral Limits.e2e.js similarity index 74% rename from e2e/tests/omnibus-base-goerli-andromeda.toml/Collateral Limits.e2e.js rename to e2e/tests/base-goerli-andromeda/Collateral Limits.e2e.js index af9476814..d019dc2fe 100644 --- a/e2e/tests/omnibus-base-goerli-andromeda.toml/Collateral Limits.e2e.js +++ b/e2e/tests/base-goerli-andromeda/Collateral Limits.e2e.js @@ -1,11 +1,9 @@ const assert = require('assert'); const { ethers } = require('ethers'); -const { - getFakeCollateralTKNBalance, - getEthBalance, - setEthBalance, - setFakeCollateralTKNBalance, -} = require('../../tasks'); +const { getFakeCollateralTKNBalance } = require('../../tasks/getFakeCollateralTKNBalance'); +const { getEthBalance } = require('../../tasks/getEthBalance'); +const { setEthBalance } = require('../../tasks/setEthBalance'); +const { setFakeCollateralTKNBalance } = require('../../tasks/setFakeCollateralTKNBalance'); describe('base-goerli-andromeda: Collateral Limits', function () { let address; diff --git a/omnibus-base-goerli-andromeda.toml b/omnibus-base-goerli-andromeda.toml index dc3457965..96a8ae338 100644 --- a/omnibus-base-goerli-andromeda.toml +++ b/omnibus-base-goerli-andromeda.toml @@ -65,7 +65,7 @@ defaultValue = "0x9172995177A9A10FE1b7Df76E2A3266c0cFc71c7" defaultValue = "0x9172995177A9A10FE1b7Df76E2A3266c0cFc71c7" [setting.minimum_liquidity_ratio] -defaultValue = "1250000000000000000" # 125% min market collateralization +defaultValue = "<%= parseEther('1.251111111') %>" # 125% min market collateralization [setting.account_timeout_withdraw] defaultValue = "86400" # 1 day