From e29f94f29cdfb17ecf3a68bb5fffa9a44df793e7 Mon Sep 17 00:00:00 2001 From: Taylor Brent Date: Tue, 10 Sep 2024 15:15:35 -0400 Subject: [PATCH] add test for non-governance forceSettleTrade --- test/Broker.test.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/Broker.test.ts b/test/Broker.test.ts index 0f1ee660d..6eafdd5cd 100644 --- a/test/Broker.test.ts +++ b/test/Broker.test.ts @@ -551,6 +551,31 @@ describe(`BrokerP${IMPLEMENTATION} contract #fast`, () => { expect(await tradeWithReentrantGnosis.canSettle()).to.equal(false) }) + it('Should not allow to force settle a trade unless governance', async () => { + // Initialize trade - simulate from backingManager + const tradeRequest: ITradeRequest = { + sell: collateral0.address, + buy: collateral1.address, + sellAmount: amount, + minBuyAmount: bn('0'), + } + + // Fund trade and initialize + await token0.connect(owner).mint(trade.address, amount) + await expect( + trade.init( + broker.address, + backingManager.address, + config.batchAuctionLength, + tradeRequest + ) + ).to.not.be.reverted + + await expect( + backingManager.connect(addr1).forceSettleTrade(trade.address) + ).to.be.revertedWith('governance only') + }) + it('Should not allow deployment with zero address gnosis', async () => { const GnosisTradeFactory: ContractFactory = await ethers.getContractFactory('GnosisTrade') await expect(GnosisTradeFactory.deploy(ZERO_ADDRESS)).to.be.revertedWith(