-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix Review #4
base: main
Are you sure you want to change the base?
Fix Review #4
Conversation
@@ -84,32 +84,31 @@ contract Deploy is BaseScript { | |||
// risk | |||
riskEngine = new RiskEngine(address(registry), params.minLtv, params.maxLtv); | |||
riskEngine.transferOwnership(params.owner); | |||
riskModule = new RiskModule(address(registry), params.liquidationDiscount); | |||
riskModule = new RiskModule(address(registry), params.liquidationDiscount, params.liquidationFee); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#339.
address(registry), | ||
params.feeRecipient, | ||
params.minDebt, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
params.defaultInterestFee, | ||
params.defaultOriginationFee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
bytes memory posmgrInitData = | ||
abi.encodeWithSelector(PositionManager.initialize.selector, params.owner, address(registry)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#339.
positionManager = PositionManager( | ||
address(new TransparentUpgradeableProxy(positionManagerImpl, params.proxyAdmin, posmgrInitData)) | ||
); | ||
// position | ||
address positionImpl = address(new Position(address(pool), address(positionManager))); | ||
address positionImpl = address(new Position(address(pool), address(positionManager), address(riskEngine))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#337.
Fixes issues: #382
|
||
import { IERC20 } from "forge-std/interfaces/IERC20.sol"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#335.
import { Pool } from "src/Pool.sol"; | ||
|
||
contract InitializePool is BaseScript { | ||
address pool; | ||
|
||
address owner; | ||
address asset; | ||
bytes32 rateModelKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#335.
uint256 borrowCap; | ||
uint256 depositCap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
uint128 poolCap; | ||
uint256 borrowCap; | ||
uint256 depositCap; | ||
uint256 initialDepositAmt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#335.
vm.broadcast(vm.envUint("PRIVATE_KEY")); | ||
uint256 poolId = Pool(pool).initializePool(owner, asset, poolCap, rateModelKey); | ||
IERC20(asset).approve(pool, initialDepositAmt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#335.
vm.broadcast(vm.envUint("PRIVATE_KEY")); | ||
uint256 poolId = Pool(pool).initializePool(owner, asset, poolCap, rateModelKey); | ||
IERC20(asset).approve(pool, initialDepositAmt); | ||
uint256 poolId = Pool(pool).initializePool(owner, asset, rateModelKey, depositCap, borrowCap, initialDepositAmt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
borrowCap = vm.parseJsonUint(config, "$.InitializePool.borrowCap"); | ||
depositCap = vm.parseJsonUint(config, "$.InitializePool.depositCap"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
poolCap = uint128(vm.parseJsonUint(config, "$.InitializePool.poolCap")); | ||
borrowCap = vm.parseJsonUint(config, "$.InitializePool.borrowCap"); | ||
depositCap = vm.parseJsonUint(config, "$.InitializePool.depositCap"); | ||
initialDepositAmt = (vm.parseJsonUint(config, "$.InitializePool.initialDepositAmt")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#335.
@@ -19,13 +15,21 @@ import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; | |||
// contracts | |||
import { ERC6909 } from "./lib/ERC6909.sol"; | |||
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | |||
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#327.
|
||
/// @title Pool | ||
/// @notice Singleton pool for all pools that superpools lend to and positions borrow from | ||
contract Pool is OwnableUpgradeable, ERC6909 { | ||
contract Pool is OwnableUpgradeable, PausableUpgradeable, ERC6909 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#327.
using Math for uint256; | ||
using SafeERC20 for IERC20; | ||
|
||
address private constant DEAD_ADDRESS = 0x000000000000000000000000000000000000dEaD; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#335.
/// @notice Maximum amount of borrow shares per base pool | ||
uint256 public constant MAX_BORROW_SHARES = type(uint112).max; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
/// @notice Minimum amount of initial shares to be burned | ||
uint256 public constant MIN_BURNED_SHARES = 1_000_000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#335.
@@ -40,9 +44,9 @@ contract Pool is OwnableUpgradeable, ERC6909 { | |||
0x5b6696788621a5d6b5e3b02a69896b9dd824ebf1631584f038a393c29b6d7555; | |||
|
|||
/// @notice Initial interest fee for pools | |||
uint128 public defaultInterestFee; | |||
uint256 public defaultInterestFee; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
/// @notice Initial origination fee for pools | ||
uint128 public defaultOriginationFee; | ||
uint256 public defaultOriginationFee; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
uint256 borrowCap; | ||
uint256 depositCap; | ||
uint256 lastUpdated; | ||
uint256 interestFee; | ||
uint256 originationFee; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
/// @notice Pool fee recipient set | ||
event FeeRecipientSet(address feeRecipient); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#322.
Fixes issues: #571
event PoolCapSet(uint256 indexed poolId, uint256 poolCap); | ||
/// @notice Borrow debt ceiling for a pool was set | ||
event BorrowCapSet(uint256 indexed poolId, uint256 borrowCap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
/// @notice Owner for a pool was set | ||
event PoolOwnerSet(uint256 indexed poolId, address owner); | ||
/// @notice Rate model for a pool was updated | ||
event RateModelUpdated(uint256 indexed poolId, address rateModel); | ||
/// @notice Interest fee for a pool was updated | ||
event InterestFeeSet(uint256 indexed poolId, uint128 interestFee); | ||
event InterestFeeSet(uint256 indexed poolId, uint256 interestFee); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
/// @notice Origination fee for a pool was updated | ||
event OriginationFeeSet(uint256 indexed poolId, uint128 originationFee); | ||
event OriginationFeeSet(uint256 indexed poolId, uint256 originationFee); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
/// @notice Total borrow shares exceed MAX_BORROW_SHARES | ||
error Pool_MaxBorrowShares(uint256 poolId); | ||
/// @notice Pool borrow cap exceeded | ||
error Pool_BorrowCapExceeded(uint256 poolId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
@@ -171,6 +190,12 @@ contract Pool is OwnableUpgradeable, ERC6909 { | |||
error Pool_DebtTooLow(uint256 poolId, address asset, uint256 amt); | |||
/// @notice No oracle found for pool asset | |||
error Pool_OracleNotFound(address asset); | |||
/// @notice Fee recipient must be non-zero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#322.
Fixes issues: #571
/// @notice Pool has zero assets and non-zero shares | ||
error Pool_ZeroAssetsNonZeroShares(uint256 poolId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#332.
/// @notice Less than MIN_BURNED_SHARES burned during pool initialization | ||
error Pool_MinBurnedShares(uint256 shares); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#335.
address registry_, | ||
address feeRecipient_, | ||
uint256 minDebt_, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to sentimentxyz/protocol-v2#336.
Fixes issues: #585
efc5d4f
to
7ecf9ef
Compare
7ecf9ef
to
611dad4
Compare
Fix Review of
Repo:
sentimentxyz/protocol-v2
Commit Hash:
46519d5dfd66f827413ea06867aa5279f877f1d1