Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/integration/behaviors/stake.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 0 additions & 22 deletions test/integration/l1/Liquidations.l1.integrations.js
Original file line number Diff line number Diff line change
@@ -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 });
});
22 changes: 0 additions & 22 deletions test/integration/l2/Liquidations.l2.integration.js
Original file line number Diff line number Diff line change
@@ -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 });
});
19 changes: 13 additions & 6 deletions test/integration/utils/rates.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down