Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow settleTrade when paused or frozen #876

Merged
merged 1 commit into from
Jul 28, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions contracts/p1/BackingManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,7 @@ contract BackingManagerP1 is TradingP1, IBackingManager {
/// @param sell The sell token in the trade
/// @return trade The ITrade contract settled
/// @custom:interaction
function settleTrade(IERC20 sell)
public
override(ITrading, TradingP1)
notTradingPausedOrFrozen
returns (ITrade trade)
{
function settleTrade(IERC20 sell) public override(ITrading, TradingP1) returns (ITrade trade) {
trade = super.settleTrade(sell); // nonReentrant

// if the settler is the trade contract itself, try chaining with another rebalance()
Expand Down
7 changes: 1 addition & 6 deletions contracts/p1/RevenueTrader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ contract RevenueTraderP1 is TradingP1, IRevenueTrader {
/// @param sell The sell token in the trade
/// @return trade The ITrade contract settled
/// @custom:interaction
function settleTrade(IERC20 sell)
public
override(ITrading, TradingP1)
notTradingPausedOrFrozen
returns (ITrade trade)
{
function settleTrade(IERC20 sell) public override(ITrading, TradingP1) returns (ITrade trade) {
trade = super.settleTrade(sell); // nonReentrant
_distributeTokenToBuy();
// unlike BackingManager, do _not_ chain trades; b2b trades of the same token are unlikely
Expand Down
14 changes: 0 additions & 14 deletions test/Recollateralization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1009,20 +1009,6 @@ describe(`Recollateralization - P${IMPLEMENTATION}`, () => {
})
})

it('Should not settle trades if trading paused', async () => {
await main.connect(owner).pauseTrading()
await expect(backingManager.settleTrade(token0.address)).to.be.revertedWith(
'frozen or trading paused'
)
})

it('Should not settle trades if frozen', async () => {
await main.connect(owner).freezeShort()
await expect(backingManager.settleTrade(token0.address)).to.be.revertedWith(
'frozen or trading paused'
)
})

it('Should not recollateralize when switching basket if all assets are UNPRICED', async () => {
// Set price to use lot price
await setOraclePrice(collateral0.address, MAX_UINT256.div(2))
Expand Down
14 changes: 0 additions & 14 deletions test/Revenues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,20 +428,6 @@ describe(`Revenues - P${IMPLEMENTATION}`, () => {
expect(balAfter).to.equal(rewardAmt)
})

it('Should not settle trade if paused', async () => {
await main.connect(owner).pauseTrading()
await expect(rTokenTrader.settleTrade(ZERO_ADDRESS)).to.be.revertedWith(
'frozen or trading paused'
)
})

it('Should not settle trade if frozen', async () => {
await main.connect(owner).freezeShort()
await expect(rTokenTrader.settleTrade(ZERO_ADDRESS)).to.be.revertedWith(
'frozen or trading paused'
)
})

it('Should still launch revenue auction if IFFY', async () => {
// Depeg one of the underlying tokens - Reducing price 30%
await setOraclePrice(collateral0.address, bn('7e7'))
Expand Down