diff --git a/test/integration/behaviors/stake.behavior.js b/test/integration/behaviors/stake.behavior.js index 4f0b608fe7..c76d319125 100644 --- a/test/integration/behaviors/stake.behavior.js +++ b/test/integration/behaviors/stake.behavior.js @@ -7,7 +7,7 @@ const { skipFeePeriod, skipMinimumStakeTime } = require('../utils/skip'); function itCanStake({ ctx }) { describe('staking and claiming', () => { - const SNXAmount = ethers.utils.parseEther('100'); + const SNXAmount = ethers.utils.parseEther('1000'); const amountToIssueAndBurnsUSD = ethers.utils.parseEther('1'); let user; diff --git a/test/integration/l1/Liquidations.l1.integrations.js b/test/integration/l1/Liquidations.l1.integrations.js index 1027828391..e382b86573 100644 --- a/test/integration/l1/Liquidations.l1.integrations.js +++ b/test/integration/l1/Liquidations.l1.integrations.js @@ -1,31 +1,9 @@ const { bootstrapL1 } = require('../utils/bootstrap'); const { itCanLiquidate } = require('../behaviors/liquidations.behavior'); -const { ethers } = require('hardhat'); - -// Load Compiled -const path = require('path'); -const { - constants: { BUILD_FOLDER }, -} = require('../../..'); -const buildPath = path.join(__dirname, '..', '..', '..', `${BUILD_FOLDER}`); -const { loadCompiledFiles } = require('../../../publish/src/solidity'); -const { compiled } = loadCompiledFiles({ buildPath }); describe('Liquidations (L1)', () => { const ctx = this; bootstrapL1({ ctx }); - before(async () => { - const { - abi, - evm: { - bytecode: { object: bytecode }, - }, - } = compiled.MockAggregatorV2V3; - const MockAggregatorFactory = new ethers.ContractFactory(abi, bytecode, ctx.users.owner); - const MockAggregator = await MockAggregatorFactory.deploy(); - ctx.contracts.MockAggregator = MockAggregator; - }); - itCanLiquidate({ ctx }); }); diff --git a/test/integration/l2/Liquidations.l2.integration.js b/test/integration/l2/Liquidations.l2.integration.js index 34bb13634f..6a0c7a15ad 100644 --- a/test/integration/l2/Liquidations.l2.integration.js +++ b/test/integration/l2/Liquidations.l2.integration.js @@ -1,31 +1,9 @@ const { bootstrapL2 } = require('../utils/bootstrap'); const { itCanLiquidate } = require('../behaviors/liquidations.behavior'); -const { ethers } = require('hardhat'); - -// Load Compiled -const path = require('path'); -const { - constants: { BUILD_FOLDER }, -} = require('../../..'); -const buildPath = path.join(__dirname, '..', '..', '..', `${BUILD_FOLDER}`); -const { loadCompiledFiles } = require('../../../publish/src/solidity'); -const { compiled } = loadCompiledFiles({ buildPath }); describe('Liquidations (L2)', () => { const ctx = this; bootstrapL2({ ctx }); - before(async () => { - const { - abi, - evm: { - bytecode: { object: bytecode }, - }, - } = compiled.MockAggregatorV2V3; - const MockAggregatorFactory = new ethers.ContractFactory(abi, bytecode, ctx.users.owner); - const MockAggregator = await MockAggregatorFactory.deploy(); - ctx.contracts.MockAggregator = MockAggregator; - }); - itCanLiquidate({ ctx }); }); diff --git a/test/integration/utils/rates.js b/test/integration/utils/rates.js index 7692b017d1..030689192d 100644 --- a/test/integration/utils/rates.js +++ b/test/integration/utils/rates.js @@ -131,14 +131,21 @@ async function getRate({ ctx, symbol }) { async function setRate({ ctx, symbol, rate }) { const ExchangeRates = ctx.contracts.ExchangeRates.connect(ctx.users.owner); - const MockAggregator = ctx.contracts.MockAggregator.connect(ctx.users.owner); - const { timestamp } = await ctx.provider.getBlock(); + // factory for price aggregators contracts + const MockAggregatorFactory = await createMockAggregatorFactory(ctx.users.owner); - await (await MockAggregator.setDecimals(18)).wait(); - await (await MockAggregator.setLatestAnswer(ethers.utils.parseEther(rate), timestamp)).wait(); - await (await ExchangeRates.addAggregator(toBytes32(symbol), MockAggregator.address)).wait(); - await MockAggregator.setLatestAnswer(rate, timestamp); + // deploy an aggregator + let aggregator = await MockAggregatorFactory.deploy(); + aggregator = aggregator.connect(ctx.users.owner); + + const { timestamp } = await ctx.provider.getBlock(); + // set decimals + await (await aggregator.setDecimals(18)).wait(); + // push the new price + await (await aggregator.setLatestAnswer(ethers.utils.parseEther(rate), timestamp)).wait(); + // set the aggregator in ExchangeRates + await (await ExchangeRates.addAggregator(toBytes32(symbol), aggregator.address)).wait(); } module.exports = {