Skip to content

Commit

Permalink
Merge master to develop (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
espendk authored Dec 11, 2023
2 parents b4019ef + 138a677 commit 2c17eb6
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 45 deletions.
2 changes: 1 addition & 1 deletion script/core/deployers/MangroveDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract MangroveDeployer is Deployer {
broadcast();
if (forMultisig) {
mgv = IMangrove(
payable(address(new Mangrove{salt:salt}({governance: broadcaster(), gasprice: gasprice, gasmax: gasmax})))
payable(address(new Mangrove{salt: salt}({governance: broadcaster(), gasprice: gasprice, gasmax: gasmax})))
);
} else {
mgv = IMangrove(payable(address(new Mangrove({governance: broadcaster(), gasprice: gasprice, gasmax: gasmax}))));
Expand Down
2 changes: 1 addition & 1 deletion script/periphery/deployers/MgvReaderDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract MgvReaderDeployer is Deployer {
MgvReader reader;
broadcast();
if (forMultisig) {
reader = new MgvReader{salt:salt}({mgv: address(mgv)});
reader = new MgvReader{salt: salt}({mgv: address(mgv)});
} else {
reader = new MgvReader({mgv: address(mgv)});
}
Expand Down
8 changes: 2 additions & 6 deletions script/toy/deployers/ERC20Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ contract ERC20Deployer is Deployer {
uint dec = vm.envUint("DECIMALS");
require(uint8(dec) == dec, "Decimals overflow");
broadcast();
TestToken token = new TestToken({
admin: broadcaster(),
name: vm.envString("NAME"),
symbol: symbol,
_decimals: uint8(dec)
});
TestToken token =
new TestToken({admin: broadcaster(), name: vm.envString("NAME"), symbol: symbol, _decimals: uint8(dec)});
fork.set(symbol, address(token));
broadcast();
token.setMintLimit(vm.envUint("MINT_LIMIT"));
Expand Down
4 changes: 2 additions & 2 deletions test/core/Gatekeeping.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -924,13 +924,13 @@ contract GatekeepingTest is MangroveTest {
}

function test_admin_can_withdrawERC20(uint amount) public {
TestToken token = new TestToken(address(this),"Withdrawable","WDBL",18);
TestToken token = new TestToken(address(this), "Withdrawable", "WDBL", 18);
deal(address(token), address(mgv), amount);
mgv.withdrawERC20(address(token), amount);
}

function test_withdraw_failure_message(uint amount) public {
TestToken token = new TestToken(address(this),"Withdrawable","WDBL",18);
TestToken token = new TestToken(address(this), "Withdrawable", "WDBL", 18);
vm.assume(amount > 0);
deal(address(token), address(mgv), amount - 1);
vm.expectRevert("mgv/withdrawERC20Fail");
Expand Down
14 changes: 3 additions & 11 deletions test/core/TakerOperations.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ contract TakerOperationsTest is MangroveTest {
// - Mangrove still has enough gas to revert
// Here we test the OOG case with a special token "OutOfGasToken"
function test_unsafe_gas_left_fails_to_pay_taker() public {
OutOfGasToken oogtt = new OutOfGasToken(address(this),"OutOfGasToken","OOGTT",18);
OutOfGasToken oogtt = new OutOfGasToken(address(this), "OutOfGasToken", "OOGTT", 18);
oogtt.setTaker(address(this));
deal($(oogtt), address(mkr), 100 ether);
mkr.approveMgv(oogtt, type(uint).max);
Expand Down Expand Up @@ -823,19 +823,11 @@ contract TakerOperationsTest is MangroveTest {
* reaching the `revert("mgv/swapError")` statement. To trigger that error, I
* make a BadMangrove contract with a misbehaving `flashloan` function. */
function test_unreachable_swapError() public {
IMangrove badMgv = IMangrove(
payable(
new BadMangrove({
governance: $(this),
gasprice: 40,
gasmax: 2_000_000
})
)
);
IMangrove badMgv = IMangrove(payable(new BadMangrove({governance: $(this), gasprice: 40, gasmax: 2_000_000})));
vm.label($(badMgv), "Bad Mangrove");
badMgv.activate(olKey, 0, 0, 0);

TestMaker mkr2 = new TestMaker(IMangrove($(badMgv)),olKey);
TestMaker mkr2 = new TestMaker(IMangrove($(badMgv)), olKey);
badMgv.fund{value: 10 ether}($(mkr2));
mkr2.newOfferByVolume(1 ether, 1 ether, 1, 0);
vm.expectRevert("mgv/swapError");
Expand Down
18 changes: 2 additions & 16 deletions test/lib/MangroveTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,11 @@ contract MangroveTest is Test2, HasMgvEvents {
function setupMangrove() public returns (IMangrove _mgv) {
if (options.measureGasusedMangrove) {
_mgv = IMangrove(
$(
new MangroveMeasureGasused({
governance: $(this),
gasprice: options.gasprice,
gasmax: options.gasmax
})
)
$(new MangroveMeasureGasused({governance: $(this), gasprice: options.gasprice, gasmax: options.gasmax}))
);
} else {
_mgv = IMangrove(
payable(
address(
new Mangrove({
governance: $(this),
gasprice: options.gasprice,
gasmax: options.gasmax
})
)
)
payable(address(new Mangrove({governance: $(this), gasprice: options.gasprice, gasmax: options.gasmax})))
);
}
vm.label($(_mgv), "Mangrove");
Expand Down
6 changes: 3 additions & 3 deletions test/lib/gas/OfferPosthookFailGasDelta.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ contract OfferPosthookFailGasDeltaTest is MangroveTest, IMaker {
payable(
address(
new BeforePosthookGasMeasuringMangrove({
governance: $(this),
gasprice: options.gasprice,
gasmax: options.gasmax
governance: $(this),
gasprice: options.gasprice,
gasmax: options.gasmax
})
)
)
Expand Down
8 changes: 4 additions & 4 deletions test/periphery/MgvOracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ contract MgvOracleTest is Test2 {
event SetDensity96X32(uint density96X32);

function test_authOnly() public {
MgvOracleForInternal mgvOracle = new MgvOracleForInternal( address(0), address(0), 0);
MgvOracleForInternal mgvOracle = new MgvOracleForInternal(address(0), address(0), 0);

//does not revert
mgvOracle._authOnly();

address governance = freshAddress("governance");
mgvOracle = new MgvOracleForInternal( governance, address(0), 0);
mgvOracle = new MgvOracleForInternal(governance, address(0), 0);

vm.expectRevert("MgvOracle/unauthorized");
mgvOracle._authOnly();
Expand All @@ -67,7 +67,7 @@ contract MgvOracleTest is Test2 {
}

function test_setGovernance() public {
MgvOracleForInternal mgvOracle = new MgvOracleForInternal( address(0), address(0), 0);
MgvOracleForInternal mgvOracle = new MgvOracleForInternal(address(0), address(0), 0);

assertEq(mgvOracle.getGovernance(), address(0), "governance should not be set yet");

Expand All @@ -78,7 +78,7 @@ contract MgvOracleTest is Test2 {
}

function test_setMutator() public {
MgvOracleForInternal mgvOracle = new MgvOracleForInternal( address(0), address(0), 0);
MgvOracleForInternal mgvOracle = new MgvOracleForInternal(address(0), address(0), 0);

assertEq(mgvOracle.getMutator(), address(0), "mutator should not be set yet");

Expand Down
2 changes: 1 addition & 1 deletion test/script/periphery/CopyOpenSemibooks.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract CopyOpenSemibooksTest is MangroveTest {
mgv.setGovernance(chief);

chief2 = freshAddress("chief2");
mgv2 = IMangrove(payable(new Mangrove(chief2,mgv.global().gasprice(),mgv.global().gasmax())));
mgv2 = IMangrove(payable(new Mangrove(chief2, mgv.global().gasprice(), mgv.global().gasmax())));
reader2 = new MgvReader(address(mgv2));

copier = new CopyOpenSemibooks();
Expand Down

0 comments on commit 2c17eb6

Please sign in to comment.