Skip to content

Commit 6606c92

Browse files
committed
rename
1 parent 2ab31b7 commit 6606c92

12 files changed

+209
-209
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Chain Predeposit Module
1+
# Cross-Chain Deposit Module
22

3-
The Chain Predeposit Module (CPM) is a sophisticated system designed to facilitate predeposit campaigns for chains that want to have pre-committed liquidity into their protocols on day one. It consists of two main components: the ```PredepositLocker``` on the source chain and the ```PredepositExecutor``` on the destination chain.
3+
The Cross-Chain Deposit Module (CDM) is a sophisticated system designed to facilitate cross-chain deposit campaigns for chains that want users to commit liquidity from the source chain into their protocols on the destination chain. It consists of two main components: the ```DepositLocker``` on the source chain and the ```DepositExecutor``` on the destination chain.
44

55
## Overview
66

@@ -14,18 +14,18 @@ This module allows users to deposit funds on one chain and have those funds brid
1414
- Allows APs to execute withdraw recipes to reclaim their funds as per the market's parameters
1515

1616
1. **[WeirollWallet](https://github.com/roycoprotocol/royco/blob/main/src/WeirollWallet.sol)**: Smart contract wallets used to execute recipes
17-
- Used on the source chain to deposit funds to bridge and withdraw funds (rage quit) to/from the PredepositLocker
17+
- Used on the source chain to deposit funds to bridge and withdraw funds (rage quit) to/from the DepositLocker
1818
- Used on the destination chain to hold a depositor's position, execute deposits upon bridging, and withdrawals after an absolute locktime
1919

20-
2. **[PredepositLocker](https://github.com/roycoprotocol/chain-predeposit-module/blob/main/src/PredepositLocker.sol)**: Deployed on the source chain
20+
2. **[DepositLocker](https://github.com/roycoprotocol/chain-Deposit-module/blob/main/src/DepositLocker.sol)**: Deployed on the source chain
2121
- Integrates with Royco's RecipeMarketHub to facilitate deposits and withdrawals
22-
- Accepts deposits from users' Weiroll Wallets upon an AP filling an offer in any predeposit market
22+
- Accepts deposits from users' Weiroll Wallets upon an AP filling an offer in any Deposit market
2323
- Allows for withdrawals until deposits are bridged
2424
- Handles bridging funds to the destination chain in addition to composing destination execution logic via LayerZero
2525

26-
3. **[PredepositExecutor](https://github.com/roycoprotocol/chain-predeposit-module/blob/main/src/PredepositExecutor.sol)**: Deployed on the destination chain
26+
3. **[DepositExecutor](https://github.com/roycoprotocol/chain-Deposit-module/blob/main/src/DepositExecutor.sol)**: Deployed on the destination chain
2727
- Receives the bridged funds and composed payload via LayerZero and atomically creates Weiroll Wallets for all bridged depositors
28-
- Executes deposit scripts ONCE after bridge (either by the depositor or the owner of the predeposit campaign)
28+
- Executes deposit scripts ONCE after bridge (either by the depositor or the owner of the Deposit campaign)
2929
- Allows the depositor to execute the withdrawal recipe after the absolute locktime has passed
3030

3131
## Key Features
@@ -35,10 +35,10 @@ This module allows users to deposit funds on one chain and have those funds brid
3535
- Weiroll Wallets created for each depositor on the destination chain with the ability to deposit and withdraw assets as specified by the campaign's recipes
3636

3737
## CPM Flow
38-
1. AP (depositor) fills an offer for a predeposit market in the RecipeMarketHub
39-
2. The RecipeMarketHub automatically creates a Weiroll Wallet for the user and deposits them into the PredepositLocker
38+
1. AP (depositor) fills an offer for a Deposit market in the RecipeMarketHub
39+
2. The RecipeMarketHub automatically creates a Weiroll Wallet for the user and deposits them into the DepositLocker
4040
3. Depositors can withdraw deposits anytime through the RecipeMarketHub before their deposits are bridged
41-
4. Once green light is given, anyone can bridge funds to the destination chain from the PredepositLocker
42-
5. PredepositExecutor receives bridged funds and creates Weiroll Wallets for each depositor based on data in composed payload
41+
4. Once green light is given, anyone can bridge funds to the destination chain from the DepositLocker
42+
5. DepositExecutor receives bridged funds and creates Weiroll Wallets for each depositor based on data in composed payload
4343
6. Deposit recipes are executed on the destination chain
4444
7. Users can withdraw funds after the absolute unlock timestamp

script/DeployPredepositExecutor.s.sol renamed to script/DeployDepositExecutor.s.sol

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ pragma solidity ^0.8.0;
33

44
import "forge-std/Script.sol";
55

6-
// Import the PredepositExecutor contract and its dependencies
7-
import "src/PredepositExecutor.sol";
6+
// Import the DepositExecutor contract and its dependencies
7+
import "src/DepositExecutor.sol";
88

9-
contract PredepositExecutorDeployScript is Script {
9+
contract DepositExecutorDeployScript is Script {
1010
// State variables for external contract addresses and arrays
1111
address public owner;
1212
address public weirollWalletImplementation;
1313
address public lzEndpoint;
14-
ERC20[] public predepositTokens;
14+
ERC20[] public depositTokens;
1515
address[] public lzOApps;
1616

1717
function setUp() public {
@@ -28,7 +28,7 @@ contract PredepositExecutorDeployScript is Script {
2828

2929
// Initialize the arrays directly in the script
3030
// Example addresses for ERC20 tokens
31-
predepositTokens.push(ERC20(address(0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773))); // USDC on ARB Sepolia
31+
depositTokens.push(ERC20(address(0x3253a335E7bFfB4790Aa4C25C4250d206E9b9773))); // USDC on ARB Sepolia
3232

3333
// Corresponding Stargate instances for each token
3434
lzOApps.push(address(0x543BdA7c6cA4384FE90B1F5929bb851F52888983)); // StargatePoolUSDC on ARB Sepolia
@@ -48,13 +48,13 @@ contract PredepositExecutorDeployScript is Script {
4848
}
4949

5050
// Ensure arrays have the same length
51-
require(predepositTokens.length == lzOApps.length, "Array lengths of predeposit tokens and lzOApps must match");
51+
require(depositTokens.length == lzOApps.length, "Array lengths of deposit tokens and lzOApps must match");
5252

53-
// Deploy the PredepositExecutor contract
54-
PredepositExecutor executor = new PredepositExecutor(owner, weirollWalletImplementation, lzEndpoint, predepositTokens, lzOApps);
53+
// Deploy the DepositExecutor contract
54+
DepositExecutor executor = new DepositExecutor(owner, weirollWalletImplementation, lzEndpoint, depositTokens, lzOApps);
5555

56-
// Output the address of the deployed PredepositExecutor contract
57-
console.log("PredepositExecutor deployed at:", address(executor));
56+
// Output the address of the deployed DepositExecutor contract
57+
console.log("DepositExecutor deployed at:", address(executor));
5858

5959
// Stop broadcasting transactions
6060
vm.stopBroadcast();

script/DeployPredepositLocker.s.sol renamed to script/DepositLocker.s.sol

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ pragma solidity ^0.8.0;
33

44
import "forge-std/Script.sol";
55

6-
// Import the PredepositLocker contract and its dependencies
7-
import "src/PredepositLocker.sol";
6+
// Import the DepositLocker contract and its dependencies
7+
import "src/DepositLocker.sol";
88

9-
contract PredepositLockerDeployScript is Script {
9+
contract DepositLockerDeployScript is Script {
1010
// State variables for external contract addresses and arrays
1111
address public owner;
1212
uint32 public chainDstEid;
13-
address public predepositExecutor;
14-
ERC20[] public predepositTokens;
13+
address public depositExecutor;
14+
ERC20[] public depositTokens;
1515
IOFT[] public lzOApps;
1616
RecipeMarketHubBase public recipeMarketHub;
1717

@@ -24,12 +24,12 @@ contract PredepositLockerDeployScript is Script {
2424
// Set the destination endpoint ID for the destination chain
2525
chainDstEid = uint32(40_231); // LZv2 destination endpoint for ARB Sepolia
2626

27-
// Set the address of the PredepositExecutor on ARB Sepolia
28-
predepositExecutor = address(0xD6414b9Edb3d2C8345dDd37aB244eC4557a90394);
27+
// Set the address of the DepositExecutor on ARB Sepolia
28+
depositExecutor = address(0xD6414b9Edb3d2C8345dDd37aB244eC4557a90394);
2929

3030
// Initialize the arrays directly in the script
3131
// Example addresses for ERC20 tokens
32-
predepositTokens.push(ERC20(address(0x488327236B65C61A6c083e8d811a4E0D3d1D4268))); // USDC on OP Sepolia
32+
depositTokens.push(ERC20(address(0x488327236B65C61A6c083e8d811a4E0D3d1D4268))); // USDC on OP Sepolia
3333

3434
// Corresponding Stargate instances for each token
3535
lzOApps.push(IOFT(address(0x314B753272a3C79646b92A87dbFDEE643237033a))); // StargatePoolUSDC on OP Sepolia
@@ -52,13 +52,13 @@ contract PredepositLockerDeployScript is Script {
5252
}
5353

5454
// Ensure arrays have the same length
55-
require(predepositTokens.length == lzOApps.length, "Array lengths of predeposit tokens and lzOApps must match");
55+
require(depositTokens.length == lzOApps.length, "Array lengths of deposit tokens and lzOApps must match");
5656

57-
// Deploy the PredepositLocker contract
58-
PredepositLocker locker = new PredepositLocker(owner, chainDstEid, predepositExecutor, recipeMarketHub, predepositTokens, lzOApps);
57+
// Deploy the DepositLocker contract
58+
DepositLocker locker = new DepositLocker(owner, chainDstEid, depositExecutor, recipeMarketHub, depositTokens, lzOApps);
5959

60-
// Output the address of the deployed PredepositLocker contract
61-
console.log("PredepositLocker deployed at:", address(locker));
60+
// Output the address of the deployed DepositLocker contract
61+
console.log("DepositLocker deployed at:", address(locker));
6262

6363
// Stop broadcasting transactions
6464
vm.stopBroadcast();

script/SourceBridgeScript.s.sol

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ pragma solidity ^0.8.0;
33

44
import "forge-std/Script.sol";
55

6-
// Import the PredepositExecutor contract and its dependencies
6+
// Import the DepositExecutor contract and its dependencies
77
import { RecipeMarketHub, RewardStyle } from "@royco/src/RecipeMarketHub.sol";
88
import { WeirollWalletHelper } from "test/utils/WeirollWalletHelper.sol";
9-
import "src/PredepositLocker.sol";
9+
import "src/DepositLocker.sol";
1010

1111
contract SourceBridgeScript is Script {
1212
address constant weirollHelperAddress = 0xf8E66EaC95D27DD30A756ee1A2D2D96D392b61CB;
13-
address payable constant predepositLockerAddress = payable(0x844F6B31f7D1240134B3d63ffC2b6f1c7F2612b6);
13+
address payable constant depositLockerAddress = payable(0x844F6B31f7D1240134B3d63ffC2b6f1c7F2612b6);
1414
address constant usdc_address = 0x488327236B65C61A6c083e8d811a4E0D3d1D4268; // Stargate USDC on OP Sepolia
1515
uint256 constant numDepositors = 150;
1616
uint256 constant offerSize = 1e9 * numDepositors;
@@ -33,8 +33,8 @@ contract SourceBridgeScript is Script {
3333
// Create Market
3434

3535
// RecipeMarketHubBase.Recipe memory DEPOSIT_RECIPE =
36-
// _buildDepositRecipe(PredepositLocker.deposit.selector, weirollHelperAddress, usdc_address, predepositLockerAddress);
37-
// RecipeMarketHubBase.Recipe memory WITHDRAWAL_RECIPE = _buildWithdrawalRecipe(PredepositLocker.withdraw.selector, predepositLockerAddress);
36+
// _buildDepositRecipe(DepositLocker.deposit.selector, weirollHelperAddress, usdc_address, depositLockerAddress);
37+
// RecipeMarketHubBase.Recipe memory WITHDRAWAL_RECIPE = _buildWithdrawalRecipe(DepositLocker.withdraw.selector, depositLockerAddress);
3838
// bytes32 marketHash = recipeMarketHub.createMarket(usdc_address, 8 weeks, 0.001e18, DEPOSIT_RECIPE, WITHDRAWAL_RECIPE, RewardStyle.Forfeitable);
3939

4040
bytes32 marketHash = bytes32(0xcd520b87754ed96438e199c82c143337c3024af70d0e26ea04f614377e687de8);
@@ -61,13 +61,13 @@ contract SourceBridgeScript is Script {
6161
depositorWallets[i] = weirollWallet;
6262
}
6363

64-
PredepositLocker predepositLocker = PredepositLocker(predepositLockerAddress);
64+
DepositLocker depositLocker = DepositLocker(depositLockerAddress);
6565

66-
predepositLocker.setMulitsig(marketHash, deployer);
66+
depositLocker.setMulitsig(marketHash, deployer);
6767

68-
predepositLocker.setGreenLight(marketHash, true);
68+
depositLocker.setGreenLight(marketHash, true);
6969

70-
predepositLocker.bridge{ value: 1 ether }(marketHash, 25_000_000, depositorWallets);
70+
depositLocker.bridge{ value: 1 ether }(marketHash, 25_000_000, depositorWallets);
7171

7272
// Stop broadcasting transactions
7373
vm.stopBroadcast();
@@ -78,7 +78,7 @@ contract SourceBridgeScript is Script {
7878
bytes4 _depositSelector,
7979
address _helper,
8080
address _tokenAddress,
81-
address _predepositLockerAddress
81+
address _depositLockerAddress
8282
)
8383
internal
8484
pure
@@ -87,7 +87,7 @@ contract SourceBridgeScript is Script {
8787
bytes32[] memory commands = new bytes32[](3);
8888
bytes[] memory state = new bytes[](2);
8989

90-
state[0] = abi.encode(_predepositLockerAddress);
90+
state[0] = abi.encode(_depositLockerAddress);
9191

9292
// GET FILL AMOUNT
9393

@@ -104,7 +104,7 @@ contract SourceBridgeScript is Script {
104104
// Encode args and add command to RecipeMarketHubBase.Recipe
105105
commands[0] = (bytes32(abi.encodePacked(WeirollWalletHelper.amount.selector, f, inputData, o, _helper)));
106106

107-
// APPROVE Predeposit Locker to spend tokens
107+
// APPROVE Deposit Locker to spend tokens
108108

109109
// CALL
110110
f = uint8(0x01);
@@ -119,7 +119,7 @@ contract SourceBridgeScript is Script {
119119
// Encode args and add command to RecipeMarketHubBase.Recipe
120120
commands[1] = (bytes32(abi.encodePacked(ERC20.approve.selector, f, inputData, o, _tokenAddress)));
121121

122-
// CALL DEPOSIT() in Predeposit Locker
122+
// CALL DEPOSIT() in Deposit Locker
123123
f = uint8(0x01);
124124

125125
// Input list: No arguments (END_OF_ARGS = 0xff)
@@ -130,12 +130,12 @@ contract SourceBridgeScript is Script {
130130
o = uint8(0xff);
131131

132132
// Encode args and add command to RecipeMarketHubBase.Recipe
133-
commands[2] = (bytes32(abi.encodePacked(_depositSelector, f, inputData, o, _predepositLockerAddress)));
133+
commands[2] = (bytes32(abi.encodePacked(_depositSelector, f, inputData, o, _depositLockerAddress)));
134134

135135
return RecipeMarketHubBase.Recipe(commands, state);
136136
}
137137

138-
function _buildWithdrawalRecipe(bytes4 _withdrawalSelector, address _predepositLockerAddress) internal pure returns (RecipeMarketHubBase.Recipe memory) {
138+
function _buildWithdrawalRecipe(bytes4 _withdrawalSelector, address _depositLockerAddress) internal pure returns (RecipeMarketHubBase.Recipe memory) {
139139
bytes32[] memory commands = new bytes32[](1);
140140
bytes[] memory state = new bytes[](0);
141141

@@ -154,7 +154,7 @@ contract SourceBridgeScript is Script {
154154
uint8 o = uint8(0xff);
155155

156156
// Encode args and add command to RecipeMarketHubBase.Recipe
157-
commands[0] = (bytes32(abi.encodePacked(_withdrawalSelector, f, inputData, o, _predepositLockerAddress)));
157+
commands[0] = (bytes32(abi.encodePacked(_withdrawalSelector, f, inputData, o, _depositLockerAddress)));
158158

159159
return RecipeMarketHubBase.Recipe(commands, state);
160160
}

script/test_deployments.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ OPSCAN_API_KEY={YOUR_API_KEY}
88
2. source .env
99

1010
3. Deploying PredopistExecutor on OP Sepolia:
11-
forge script script/DeployPredepositExecutor.s.sol --rpc-url $ARB_SEPOLIA_RPC_URL --broadcast --verify -vvvv --etherscan-api-key=$ARBISCAN_API_KEY --verifier-url https://api-sepolia.arbiscan.io/api
11+
forge script script/DeployDepositExecutor.s.sol --rpc-url $ARB_SEPOLIA_RPC_URL --broadcast --verify -vvvv --etherscan-api-key=$ARBISCAN_API_KEY --verifier-url https://api-sepolia.arbiscan.io/api
1212

13-
4. Edit DeployPredepositLocker.s.sol to set the predepositExecutor address as the address of the deployment done in step 3.
13+
4. Edit DeployDepositLocker.s.sol to set the depositExecutor address as the address of the deployment done in step 3.
1414

15-
5. Deploying PredepositLocker on ETH Sepolia:
16-
forge script script/DeployPredepositLocker.s.sol --rpc-url $OP_SEPOLIA_RPC_URL --broadcast --verify -vvvv --etherscan-api-key=$OPSCAN_API_KEY --verifier-url https://api-sepolia-optimistic.etherscan.io/api
15+
5. Deploying DepositLocker on ETH Sepolia:
16+
forge script script/DeployDepositLocker.s.sol --rpc-url $OP_SEPOLIA_RPC_URL --broadcast --verify -vvvv --etherscan-api-key=$OPSCAN_API_KEY --verifier-url https://api-sepolia-optimistic.etherscan.io/api

0 commit comments

Comments
 (0)