-
Notifications
You must be signed in to change notification settings - Fork 8
Fix Review #4
base: main
Are you sure you want to change the base?
Fix Review #4
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
// pool | ||
poolImpl = address(new Pool()); | ||
bytes memory poolInitData = abi.encodeWithSelector( | ||
Pool.initialize.selector, | ||
params.owner, | ||
params.defaultInterestFee, | ||
params.defaultOriginationFee, | ||
address(registry), | ||
params.feeRecipient, | ||
params.minDebt, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#336. Fixes issues: #585 |
||
params.minBorrow, | ||
params.minDebt | ||
params.defaultInterestFee, | ||
params.defaultOriginationFee | ||
Comment on lines
+97
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#336. Fixes issues: #585 |
||
); | ||
pool = Pool(address(new TransparentUpgradeableProxy(poolImpl, params.proxyAdmin, poolInitData))); | ||
// super pool factory | ||
superPoolFactory = new SuperPoolFactory(address(pool)); | ||
// position manager | ||
positionManagerImpl = address(new PositionManager()); | ||
bytes memory posmgrInitData = abi.encodeWithSelector( | ||
PositionManager.initialize.selector, params.owner, address(registry), params.liquidationFee | ||
); | ||
bytes memory posmgrInitData = | ||
abi.encodeWithSelector(PositionManager.initialize.selector, params.owner, address(registry)); | ||
Comment on lines
+105
to
+106
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#337. Fixes issues: #382 |
||
positionBeacon = address(new UpgradeableBeacon(positionImpl)); | ||
// lens | ||
superPoolLens = new SuperPoolLens(address(pool), address(riskEngine)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,35 +3,35 @@ pragma solidity ^0.8.24; | |
|
||
import { BaseScript } from "../BaseScript.s.sol"; | ||
import { console2 } from "forge-std/console2.sol"; | ||
|
||
import { IERC20 } from "forge-std/interfaces/IERC20.sol"; | ||
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#335. |
||
uint128 interestFee; | ||
uint128 originationFee; | ||
uint128 poolCap; | ||
uint256 borrowCap; | ||
uint256 depositCap; | ||
Comment on lines
+15
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#336. Fixes issues: #585 |
||
uint256 initialDepositAmt; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#335. |
||
|
||
function run() public { | ||
getParams(); | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#335. |
||
uint256 poolId = Pool(pool).initializePool(owner, asset, rateModelKey, depositCap, borrowCap, initialDepositAmt); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#336. Fixes issues: #585 |
||
console2.log("poolId: ", poolId); | ||
} | ||
|
||
function getParams() internal { | ||
string memory config = getConfig(); | ||
|
||
pool = vm.parseJsonAddress(config, "$.InitializePool.pool"); | ||
owner = vm.parseJsonAddress(config, "$.InitializePool.owner"); | ||
asset = vm.parseJsonAddress(config, "$.InitializePool.asset"); | ||
rateModelKey = vm.parseJsonBytes32(config, "$.InitializePool.rateModelKey"); | ||
interestFee = uint128(vm.parseJsonUint(config, "$.InitializePool.interestFee")); | ||
originationFee = uint128(vm.parseJsonUint(config, "$.InitializePool.originationFee")); | ||
poolCap = uint128(vm.parseJsonUint(config, "$.InitializePool.poolCap")); | ||
borrowCap = vm.parseJsonUint(config, "$.InitializePool.borrowCap"); | ||
depositCap = vm.parseJsonUint(config, "$.InitializePool.depositCap"); | ||
Comment on lines
+33
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#336. Fixes issues: #585 |
||
initialDepositAmt = (vm.parseJsonUint(config, "$.InitializePool.initialDepositAmt")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change related to sentimentxyz/protocol-v2#335. |
||
} | ||
} |
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.
Fixes issues: #91, #309