Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Author

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

// 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,

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.minBorrow,
params.minDebt
params.defaultInterestFee,
params.defaultOriginationFee
Comment on lines +97 to +98
Copy link
Contributor

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

);
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
Copy link
Author

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

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)));

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

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";
Comment on lines +6 to +7
Copy link
Contributor

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.

Fixes issues: #400, #597

import { Pool } from "src/Pool.sol";

contract InitializePool is BaseScript {
address pool;

address owner;
address asset;
bytes32 rateModelKey;
Copy link
Author

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.

Fixes issues: #400, #597

uint128 interestFee;
uint128 originationFee;
uint128 poolCap;
uint256 borrowCap;
uint256 depositCap;
Comment on lines +15 to +16

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 initialDepositAmt;
Copy link
Contributor

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.

Fixes issues: #400, #597


function run() public {
getParams();

vm.broadcast(vm.envUint("PRIVATE_KEY"));
uint256 poolId = Pool(pool).initializePool(owner, asset, poolCap, rateModelKey);
IERC20(asset).approve(pool, initialDepositAmt);
Copy link
Author

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.

Fixes issues: #400, #597

uint256 poolId = Pool(pool).initializePool(owner, asset, rateModelKey, depositCap, borrowCap, initialDepositAmt);

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

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
Copy link
Contributor

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

initialDepositAmt = (vm.parseJsonUint(config, "$.InitializePool.initialDepositAmt"));
Copy link
Author

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.

Fixes issues: #400, #597

}
}
Loading