diff --git a/script/01_DeployVault.s.sol b/script/01_DeployVault.s.sol
index da78632..f4b95c9 100644
--- a/script/01_DeployVault.s.sol
+++ b/script/01_DeployVault.s.sol
@@ -8,6 +8,7 @@ import {Create3Factory} from "pancake-create3-factory/src/Create3Factory.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/**
+ *
* Step 1: Deploy
* forge script script/01_DeployVault.s.sol:DeployVaultScript -vvv \
* --rpc-url $RPC_URL \
@@ -17,22 +18,24 @@ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
* Step 2: Verify there is no need for --constructor-args as there are no constructor arguments for Vault
* forge verify-contract
Vault --watch --chain
*
- * Step 3: Proceed to deploy contract and call vault.acceptOwnership
+ * Step 3: Proceed to poolOwner contract and call vault.acceptOwnership
*/
contract DeployVaultScript is BaseScript {
function getDeploymentSalt() public pure override returns (bytes32) {
- return keccak256("INFINITY-CORE/VAULT/0.90");
+ return keccak256("INFINITY-CORE/VAULT/0.97");
}
function run() public {
Create3Factory factory = Create3Factory(getAddressFromConfig("create3Factory"));
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
+ address deployer = vm.addr(deployerPrivateKey);
+
vm.startBroadcast(deployerPrivateKey);
- /// @dev prepare the payload to transfer ownership from deployer to real owner
+ /// @dev prepare the payload to transfer ownership from deployment contract to real deployer address
bytes memory afterDeploymentExecutionPayload =
- abi.encodeWithSelector(Ownable.transferOwnership.selector, getAddressFromConfig("poolOwner"));
+ abi.encodeWithSelector(Ownable.transferOwnership.selector, deployer);
address vault = factory.deploy(
getDeploymentSalt(),
@@ -43,6 +46,15 @@ contract DeployVaultScript is BaseScript {
0
);
+ /// @notice accept ownership so that in the following steps,
+ /// the deployer address has right to register apps onto the vault
+ Vault(vault).acceptOwnership();
+
+ /// @notice transfer ownership to the pool owner,
+ /// in 2-step process this won't take effect until new owner accepts the ownership
+ /// Hence, this won't block the deployment process
+ Ownable(vault).transferOwnership(getAddressFromConfig("poolOwner"));
+
console.log("Vault contract deployed at ", vault);
vm.stopBroadcast();
diff --git a/script/02_DeployCLPoolManager.s.sol b/script/02_DeployCLPoolManager.s.sol
index 8212a6e..9b7e03c 100644
--- a/script/02_DeployCLPoolManager.s.sol
+++ b/script/02_DeployCLPoolManager.s.sol
@@ -9,28 +9,28 @@ import {Create3Factory} from "pancake-create3-factory/src/Create3Factory.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/**
+ *
* Step 1: Deploy
* forge script script/02_DeployCLPoolManager.s.sol:DeployCLPoolManagerScript -vvv \
* --rpc-url $RPC_URL \
* --broadcast \
* --slow
*
- * Step 2: Get the ABI-encoded form of the constructor arguments
- * cast abi-encode "Constructor(address)"
- *
- * Step 3: Verify
+ * Step 2: Verify
* forge verify-contract CLPoolManager --watch --chain \
- * --constructor-args
+ * --constructor-args `cast abi-encode "Constructor(address)" `
+ *
*/
contract DeployCLPoolManagerScript is BaseScript {
function getDeploymentSalt() public pure override returns (bytes32) {
- return keccak256("INFINITY-CORE/CLPoolManager/0.90");
+ return keccak256("INFINITY-CORE/CLPoolManager/0.97");
}
function run() public {
Create3Factory factory = Create3Factory(getAddressFromConfig("create3Factory"));
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
+ address deployer = vm.addr(deployerPrivateKey);
vm.startBroadcast(deployerPrivateKey);
address vault = getAddressFromConfig("vault");
@@ -39,9 +39,9 @@ contract DeployCLPoolManagerScript is BaseScript {
/// @dev append the vault address to the creationCode
bytes memory creationCode = abi.encodePacked(type(CLPoolManager).creationCode, abi.encode(vault));
- /// @dev prepare the payload to transfer ownership from deployer to real owner
+ /// @dev prepare the payload to transfer ownership from deployment contract to real deployer address
bytes memory afterDeploymentExecutionPayload =
- abi.encodeWithSelector(Ownable.transferOwnership.selector, getAddressFromConfig("poolOwner"));
+ abi.encodeWithSelector(Ownable.transferOwnership.selector, deployer);
address clPoolManager = factory.deploy(
getDeploymentSalt(), creationCode, keccak256(creationCode), 0, afterDeploymentExecutionPayload, 0
diff --git a/script/03_DeployBinPoolManager.s.sol b/script/03_DeployBinPoolManager.s.sol
index 64d6c3d..ce59978 100644
--- a/script/03_DeployBinPoolManager.s.sol
+++ b/script/03_DeployBinPoolManager.s.sol
@@ -9,28 +9,28 @@ import {Create3Factory} from "pancake-create3-factory/src/Create3Factory.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/**
+ *
* Step 1: Deploy
* forge script script/03_DeployBinPoolManager.s.sol:DeployBinPoolManagerScript -vvv \
* --rpc-url $RPC_URL \
* --broadcast \
* --slow
*
- * Step 2: Get the ABI-encoded form of the constructor arguments
- * cast abi-encode "Constructor(address)"
- *
- * Step 3: Verify
+ * Step 2: Verify
* forge verify-contract BinPoolManager --watch --chain \
- * --constructor-args
+ * --constructor-args `cast abi-encode "Constructor(address)" `
+ *
*/
contract DeployBinPoolManagerScript is BaseScript {
function getDeploymentSalt() public pure override returns (bytes32) {
- return keccak256("INFINITY-CORE/BinPoolManager/0.90");
+ return keccak256("INFINITY-CORE/BinPoolManager/0.97");
}
function run() public {
Create3Factory factory = Create3Factory(getAddressFromConfig("create3Factory"));
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
+ address deployer = vm.addr(deployerPrivateKey);
vm.startBroadcast(deployerPrivateKey);
address vault = getAddressFromConfig("vault");
@@ -41,7 +41,7 @@ contract DeployBinPoolManagerScript is BaseScript {
/// @dev prepare the payload to transfer ownership from deployer to real owner
bytes memory afterDeploymentExecutionPayload =
- abi.encodeWithSelector(Ownable.transferOwnership.selector, getAddressFromConfig("poolOwner"));
+ abi.encodeWithSelector(Ownable.transferOwnership.selector, deployer);
address binPoolManager = factory.deploy(
getDeploymentSalt(), creationCode, keccak256(creationCode), 0, afterDeploymentExecutionPayload, 0
diff --git a/script/04a_DeployCLProtocolFeeController.s.sol b/script/04_DeployCLProtocolFeeController.s.sol
similarity index 76%
rename from script/04a_DeployCLProtocolFeeController.s.sol
rename to script/04_DeployCLProtocolFeeController.s.sol
index 39a320c..647f2d9 100644
--- a/script/04a_DeployCLProtocolFeeController.s.sol
+++ b/script/04_DeployCLProtocolFeeController.s.sol
@@ -6,26 +6,24 @@ import {BaseScript} from "./BaseScript.sol";
import {ProtocolFeeController} from "../src/ProtocolFeeController.sol";
import {Create3Factory} from "pancake-create3-factory/src/Create3Factory.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
+import {IProtocolFees} from "../src/interfaces/IProtocolFees.sol";
/**
* Step 1: Deploy
- * forge script script/04a_DeployCLProtocolFeeController.s.sol:DeployCLProtocolFeeControllerScript -vvv \
+ * forge script script/04_DeployCLProtocolFeeController.s.sol:DeployCLProtocolFeeControllerScript -vvv \
* --rpc-url $RPC_URL \
* --broadcast \
* --slow
*
- * Step 2: Get the ABI-encoded form of the constructor arguments
- * cast abi-encode "Constructor(address)"
- *
- * Step 3: Verify
+ * Step 2: Verify
* forge verify-contract ProtocolFeeController --watch --chain \
- * --constructor-args
+ * --constructor-args `cast abi-encode "Constructor(address)" `
*
- * Step 4: Proceed to deploy contract and call protocolFeeController.acceptOwnership
+ * Step 3: Proceed to poolOwner contract and call protocolFeeController.acceptOwnership
*/
contract DeployCLProtocolFeeControllerScript is BaseScript {
function getDeploymentSalt() public pure override returns (bytes32) {
- return keccak256("INFINITY-CORE/CLProtocolFeeController/0.91");
+ return keccak256("INFINITY-CORE/CLProtocolFeeController/0.97");
}
function run() public {
@@ -52,6 +50,11 @@ contract DeployCLProtocolFeeControllerScript is BaseScript {
console.log("CLProtocolFeeController contract deployed at ", clProtocolFeeController);
+ /// @notice set the protocol fee controller for the clPoolManager
+ IProtocolFees(clPoolManager).setProtocolFeeController(
+ ProtocolFeeController(getAddressFromConfig("clProtocolFeeController"))
+ );
+
vm.stopBroadcast();
}
}
diff --git a/script/04b_SetProtocolFeeControllerForCLPool.s.sol b/script/04b_SetProtocolFeeControllerForCLPool.s.sol
deleted file mode 100644
index f43db4b..0000000
--- a/script/04b_SetProtocolFeeControllerForCLPool.s.sol
+++ /dev/null
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: UNLICENSED
-pragma solidity ^0.8.24;
-
-import "forge-std/Script.sol";
-import {BaseScript} from "./BaseScript.sol";
-import {ProtocolFeeController} from "../src/ProtocolFeeController.sol";
-import {IProtocolFees} from "../src/interfaces/IProtocolFees.sol";
-
-/**
- * Step 1: Set ProtocolFeeController for CLPool
- * forge script script/04b_SetProtocolFeeControllerForCLPool.s.sol:SetProtocolFeeControllerForCLPoolScript -vvv \
- * --rpc-url $RPC_URL \
- * --broadcast \
- * --slow
- */
-contract SetProtocolFeeControllerForCLPoolScript is BaseScript {
- function run() public {
- // @dev this should be the private key of the poolManager owner instead of the deployer
- uint256 ownerPrivateKey = vm.envUint("POOL_OWNER_PRIVATE_KEY");
- vm.startBroadcast(ownerPrivateKey);
-
- IProtocolFees clPoolManager = IProtocolFees(getAddressFromConfig("clPoolManager"));
- console.log("clPoolManager address: ", address(clPoolManager));
-
- ProtocolFeeController clProtocolFeeController =
- ProtocolFeeController(getAddressFromConfig("clProtocolFeeController"));
- console.log("clProtocolFeeController address: ", address(clProtocolFeeController));
-
- if (clProtocolFeeController.poolManager() != address(clPoolManager)) {
- revert("PoolManager mismatch");
- }
-
- IProtocolFees(clPoolManager).setProtocolFeeController(
- ProtocolFeeController(getAddressFromConfig("clProtocolFeeController"))
- );
-
- vm.stopBroadcast();
- }
-}
diff --git a/script/05a_DeployBinProtocolFeeController.s.sol b/script/05_DeployBinProtocolFeeController.s.sol
similarity index 75%
rename from script/05a_DeployBinProtocolFeeController.s.sol
rename to script/05_DeployBinProtocolFeeController.s.sol
index b4959ee..08921d6 100644
--- a/script/05a_DeployBinProtocolFeeController.s.sol
+++ b/script/05_DeployBinProtocolFeeController.s.sol
@@ -6,26 +6,24 @@ import {BaseScript} from "./BaseScript.sol";
import {ProtocolFeeController} from "../src/ProtocolFeeController.sol";
import {Create3Factory} from "pancake-create3-factory/src/Create3Factory.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
+import {IProtocolFees} from "../src/interfaces/IProtocolFees.sol";
/**
* Step 1: Deploy
- * forge script script/05a_DeployBinProtocolFeeController.s.sol:DeployBinProtocolFeeControllerScript -vvv \
+ * forge script script/05_DeployBinProtocolFeeController.s.sol:DeployBinProtocolFeeControllerScript -vvv \
* --rpc-url $RPC_URL \
* --broadcast \
* --slow
*
- * Step 2: Get the ABI-encoded form of the constructor arguments
- * cast abi-encode "Constructor(address)"
- *
- * Step 3: Verify
+ * Step 2: Verify
* forge verify-contract ProtocolFeeController --watch --chain \
- * --constructor-args
+ * --constructor-args `cast abi-encode "Constructor(address)" `
*
- * Step 4: Proceed to deploy contract and call protocolFeeController.acceptOwnership
+ * Step 3: Proceed to poolOwner contract and call protocolFeeController.acceptOwnership
*/
contract DeployBinProtocolFeeControllerScript is BaseScript {
function getDeploymentSalt() public pure override returns (bytes32) {
- return keccak256("INFINITY-CORE-CORE/BinProtocolFeeController/0.91");
+ return keccak256("INFINITY-CORE-CORE/BinProtocolFeeController/0.97");
}
function run() public {
@@ -52,6 +50,11 @@ contract DeployBinProtocolFeeControllerScript is BaseScript {
console.log("BinProtocolFeeController contract deployed at ", binProtocolFeeController);
+ /// @notice set the protocol fee controller for the clPoolManager
+ IProtocolFees(binPoolManager).setProtocolFeeController(
+ ProtocolFeeController(getAddressFromConfig("binProtocolFeeController"))
+ );
+
vm.stopBroadcast();
}
}
diff --git a/script/05b_SetProtocolFeeControllerForBinPool.s.sol b/script/05b_SetProtocolFeeControllerForBinPool.s.sol
deleted file mode 100644
index dcdc879..0000000
--- a/script/05b_SetProtocolFeeControllerForBinPool.s.sol
+++ /dev/null
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: UNLICENSED
-pragma solidity ^0.8.24;
-
-import "forge-std/Script.sol";
-import {BaseScript} from "./BaseScript.sol";
-import {ProtocolFeeController} from "../src/ProtocolFeeController.sol";
-import {IProtocolFees} from "../src/interfaces/IProtocolFees.sol";
-
-/**
- * Step 1: Set ProtocolFeeController for BinPool
- * forge script script/05b_SetProtocolFeeControllerForBinPool.s.sol:SetProtocolFeeControllerForBinPoolScript -vvv \
- * --rpc-url $RPC_URL \
- * --broadcast \
- * --slow
- */
-contract SetProtocolFeeControllerForBinPoolScript is BaseScript {
- function run() public {
- // @dev this should be the private key of the poolManager owner instead of the deployer
- uint256 ownerPrivateKey = vm.envUint("POOL_OWNER_PRIVATE_KEY");
- vm.startBroadcast(ownerPrivateKey);
-
- IProtocolFees binPoolManager = IProtocolFees(getAddressFromConfig("binPoolManager"));
- console.log("binPoolManager address: ", address(binPoolManager));
-
- ProtocolFeeController binProtocolFeeController =
- ProtocolFeeController(getAddressFromConfig("binProtocolFeeController"));
- console.log("binProtocolFeeController address: ", address(binProtocolFeeController));
-
- if (binProtocolFeeController.poolManager() != address(binPoolManager)) {
- revert("PoolManager mismatch");
- }
-
- IProtocolFees(binPoolManager).setProtocolFeeController(
- ProtocolFeeController(getAddressFromConfig("binProtocolFeeController"))
- );
-
- vm.stopBroadcast();
- }
-}
diff --git a/script/06_TransferPoolManagerOwner.s.sol b/script/06_TransferPoolManagerOwner.s.sol
new file mode 100644
index 0000000..ab240cb
--- /dev/null
+++ b/script/06_TransferPoolManagerOwner.s.sol
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: UNLICENSED
+pragma solidity ^0.8.24;
+
+import "forge-std/Script.sol";
+import {BaseScript} from "./BaseScript.sol";
+import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
+
+/**
+ *
+ * forge script script/06_TransferPoolManagerOwner.s.sol:TransferPoolManagerOwner -vvv \
+ * --rpc-url $RPC_URL \
+ * --broadcast \
+ * --slow
+ *
+ */
+contract TransferPoolManagerOwner is BaseScript {
+ function run() public {
+ uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
+ vm.startBroadcast(deployerPrivateKey);
+
+ address clPoolManager = getAddressFromConfig("clPoolManager");
+ address binPoolManager = getAddressFromConfig("binPoolManager");
+ address poolOwner = getAddressFromConfig("poolOwner");
+
+ Ownable(clPoolManager).transferOwnership(poolOwner);
+ console.log("clPoolManager Ownership transferred to ", address(poolOwner));
+
+ Ownable(binPoolManager).transferOwnership(poolOwner);
+ console.log("binPoolManager Ownership transferred to ", address(poolOwner));
+
+ vm.stopBroadcast();
+ }
+}
diff --git a/script/config/bsc-testnet.json b/script/config/bsc-testnet.json
index e7ef8a8..452aa86 100644
--- a/script/config/bsc-testnet.json
+++ b/script/config/bsc-testnet.json
@@ -1,10 +1,10 @@
{
"create3Factory": "0x38Ab3f2CE00973A51d3A2A04d634C9bcbf20e4e1",
"poolOwner": "0x42571B8414c68B63A2729146CE93F23639d25399",
- "vault": "0xd557753bde3f0EaF32626F8681Ac6d8c1EBA2BBa",
- "clPoolManager": "0x70890E308DCE727180ac1B9550928fED342dea52",
- "binPoolManager": "0x68554d088F3640Bd2A7B38b43AE70FDcc16ef197",
+ "vault": "0x2CdB3EC82EE13d341Dc6E73637BE0Eab79cb79dD",
+ "clPoolManager": "0x36A12c70c9Cf64f24E89ee132BF93Df2DCD199d4",
+ "binPoolManager": "0xe71d2e0230cE0765be53A8A1ee05bdACF30F296B",
"protocolFeeControllerOwner": "0x42571B8414c68B63A2729146CE93F23639d25399",
- "clProtocolFeeController": "0xa3b9Af6E83B5161AC008cafb76712857bE54536D",
- "binProtocolFeeController": "0x4eE90A76f4C0b32bce3C941b6Fa409E6c4DCE98A"
+ "clProtocolFeeController": "0x5ab6c844F3c0e818b92932e55b9942B2c8a2D205",
+ "binProtocolFeeController": "0xB91451e44f5D1D8048F8b5c093b705D61C7893F8"
}