diff --git a/core/.gas-snapshot b/core/.gas-snapshot index 2f081dbe..04bb3a5d 100644 --- a/core/.gas-snapshot +++ b/core/.gas-snapshot @@ -1,26 +1,26 @@ BorrowerGasTest:test_addMargin() (gas: 16203) -BorrowerGasTest:test_borrow() (gas: 110492) +BorrowerGasTest:test_borrow() (gas: 110489) BorrowerGasTest:test_getUniswapPositions() (gas: 5219) -BorrowerGasTest:test_modify() (gas: 82111) -BorrowerGasTest:test_modifyWithAnte() (gas: 88566) -BorrowerGasTest:test_repay() (gas: 111851) -BorrowerGasTest:test_uniswapDepositInBorrower() (gas: 257726) +BorrowerGasTest:test_modify() (gas: 82108) +BorrowerGasTest:test_modifyWithAnte() (gas: 88563) +BorrowerGasTest:test_repay() (gas: 111848) +BorrowerGasTest:test_uniswapDepositInBorrower() (gas: 257723) BorrowerGasTest:test_uniswapDepositStandard() (gas: 167558) -BorrowerGasTest:test_uniswapWithdraw() (gas: 147623) -BorrowerGasTest:test_withdraw() (gas: 105631) -FactoryGasTest:test_createBorrower() (gas: 156437) -FactoryGasTest:test_createMarket() (gas: 3900597) +BorrowerGasTest:test_uniswapWithdraw() (gas: 147620) +BorrowerGasTest:test_withdraw() (gas: 105628) +FactoryGasTest:test_createBorrower() (gas: 156431) +FactoryGasTest:test_createMarket() (gas: 3900591) LenderGasTest:test_accrueInterest() (gas: 46287) LenderGasTest:test_borrow() (gas: 40812) LenderGasTest:test_deposit() (gas: 53639) LenderGasTest:test_depositWithCourier() (gas: 53785) LenderGasTest:test_redeem() (gas: 53334) -LenderGasTest:test_redeemWithCourier() (gas: 83730) +LenderGasTest:test_redeemWithCourier() (gas: 83726) LenderGasTest:test_repay() (gas: 44752) -LiquidatorGasTest:test_noCallbackOneAsset() (gas: 51020) -LiquidatorGasTest:test_noCallbackTwoAssets() (gas: 59179) -LiquidatorGasTest:test_noCallbackTwoAssetsAndUniswapPosition() (gas: 95598) -LiquidatorGasTest:test_warn() (gas: 35026) -LiquidatorGasTest:test_withCallbackAndSwap() (gas: 130185) +LiquidatorGasTest:test_noCallbackOneAsset() (gas: 51017) +LiquidatorGasTest:test_noCallbackTwoAssets() (gas: 59176) +LiquidatorGasTest:test_noCallbackTwoAssetsAndUniswapPosition() (gas: 95596) +LiquidatorGasTest:test_warn() (gas: 35023) +LiquidatorGasTest:test_withCallbackAndSwap() (gas: 130182) VolatilityGasTest:test_consult() (gas: 43075) VolatilityGasTest:test_updateNoBinarySearch() (gas: 145910) \ No newline at end of file diff --git a/core/.storage-layout.md b/core/.storage-layout.md index 0ebcc522..e4bcd4b0 100644 --- a/core/.storage-layout.md +++ b/core/.storage-layout.md @@ -24,10 +24,11 @@ forge inspect --pretty src/Borrower.sol:Borrower storage-layout forge inspect --pretty src/Factory.sol:Factory storage-layout | Name | Type | Slot | Offset | Bytes | Contract | |---------------|---------------------------------------------------------------|------|--------|-------|-------------------------| -| getMarket | mapping(contract IUniswapV3Pool => struct Factory.Market) | 0 | 0 | 32 | src/Factory.sol:Factory | -| getParameters | mapping(contract IUniswapV3Pool => struct Factory.Parameters) | 1 | 0 | 32 | src/Factory.sol:Factory | -| isLender | mapping(address => bool) | 2 | 0 | 32 | src/Factory.sol:Factory | -| isBorrower | mapping(address => bool) | 3 | 0 | 32 | src/Factory.sol:Factory | -| couriers | mapping(uint32 => struct Factory.Courier) | 4 | 0 | 32 | src/Factory.sol:Factory | -| isCourier | mapping(address => bool) | 5 | 0 | 32 | src/Factory.sol:Factory | +| rewardsToken | contract ERC20 | 0 | 0 | 20 | src/Factory.sol:Factory | +| getMarket | mapping(contract IUniswapV3Pool => struct Factory.Market) | 1 | 0 | 32 | src/Factory.sol:Factory | +| getParameters | mapping(contract IUniswapV3Pool => struct Factory.Parameters) | 2 | 0 | 32 | src/Factory.sol:Factory | +| isLender | mapping(address => bool) | 3 | 0 | 32 | src/Factory.sol:Factory | +| isBorrower | mapping(address => bool) | 4 | 0 | 32 | src/Factory.sol:Factory | +| couriers | mapping(uint32 => struct Factory.Courier) | 5 | 0 | 32 | src/Factory.sol:Factory | +| isCourier | mapping(address => bool) | 6 | 0 | 32 | src/Factory.sol:Factory | diff --git a/core/src/Factory.sol b/core/src/Factory.sol index ac00a399..14669fe8 100644 --- a/core/src/Factory.sol +++ b/core/src/Factory.sol @@ -47,10 +47,10 @@ contract Factory { IRateModel public immutable RATE_MODEL; - ERC20 public immutable REWARDS_TOKEN; - address public immutable LENDER_IMPLEMENTATION; + ERC20 public rewardsToken; + /*////////////////////////////////////////////////////////////// WORLD STORAGE //////////////////////////////////////////////////////////////*/ @@ -80,12 +80,12 @@ contract Factory { CONSTRUCTOR //////////////////////////////////////////////////////////////*/ - constructor(VolatilityOracle oracle, IRateModel rateModel, ERC20 rewardsToken) { + constructor(VolatilityOracle oracle, IRateModel rateModel, ERC20 rewardsToken_) { ORACLE = oracle; RATE_MODEL = rateModel; - REWARDS_TOKEN = rewardsToken; - LENDER_IMPLEMENTATION = address(new Lender(address(this))); + + rewardsToken = rewardsToken_; } function pause(IUniswapV3Pool pool) external { @@ -178,6 +178,6 @@ contract Factory { } } - REWARDS_TOKEN.safeTransfer(beneficiary, earned); + rewardsToken.safeTransfer(beneficiary, earned); } } diff --git a/core/src/Ledger.sol b/core/src/Ledger.sol index da702a31..be6cd333 100644 --- a/core/src/Ledger.sol +++ b/core/src/Ledger.sol @@ -300,7 +300,7 @@ contract Ledger { * @return The maximum amount of `asset()` that can be withdrawn */ function maxWithdraw(address owner) external view returns (uint256) { - return convertToAssets(this.maxRedeem(owner)); + return convertToAssets(maxRedeem(owner)); } /*////////////////////////////////////////////////////////////// diff --git a/core/src/libraries/constants/Constants.sol b/core/src/libraries/constants/Constants.sol index dfc47d29..dde3864e 100644 --- a/core/src/libraries/constants/Constants.sol +++ b/core/src/libraries/constants/Constants.sol @@ -29,7 +29,7 @@ uint256 constant MAX_RATE = 706354; /// @dev The default amount of Ether required to take on debt in a `Borrower`. The `Factory` can override this value /// on a per-market basis. -uint216 constant DEFAULT_ANTE = 0.1 ether; +uint216 constant DEFAULT_ANTE = 0.01 ether; /// @dev The default number of standard deviations of price movement used to determine probe prices for `Borrower` /// solvency. The `Factory` can override this value on a per-market basis.