Skip to content

Commit

Permalink
Fix Review
Browse files Browse the repository at this point in the history
  • Loading branch information
sherlock-admin committed Nov 15, 2024
1 parent 0b472f4 commit 611dad4
Show file tree
Hide file tree
Showing 32 changed files with 1,095 additions and 691 deletions.
2 changes: 1 addition & 1 deletion protocol-v2/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ bracket_spacing = true
override_spacing = false
contract_new_lines = false
number_underscore = "thousands"
multiline_func_header = "params_first"
multiline_func_header = "all"
single_line_statement_blocks = "single"
15 changes: 7 additions & 8 deletions protocol-v2/script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
params.minBorrow,
params.minDebt
params.defaultInterestFee,
params.defaultOriginationFee
);
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));
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)));
positionBeacon = address(new UpgradeableBeacon(positionImpl));
// lens
superPoolLens = new SuperPoolLens(address(pool), address(riskEngine));
Expand Down
20 changes: 10 additions & 10 deletions protocol-v2/script/pool/InitializePool.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
import { Pool } from "src/Pool.sol";

contract InitializePool is BaseScript {
address pool;

address owner;
address asset;
bytes32 rateModelKey;
uint128 interestFee;
uint128 originationFee;
uint128 poolCap;
uint256 borrowCap;
uint256 depositCap;
uint256 initialDepositAmt;

function run() public {
getParams();

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);
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");
initialDepositAmt = (vm.parseJsonUint(config, "$.InitializePool.initialDepositAmt"));
}
}
Loading

0 comments on commit 611dad4

Please sign in to comment.