Skip to content

Commit

Permalink
fix: remove references to validator set
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxMustermann2 committed Jul 23, 2024
1 parent 94fc43e commit e0691a2
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 178 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Exocore Contracts

The Exocore contracts repository contains a set of smart contracts deployed on both Exocore and the target client chains, managed by the Exocore validator set, which facilitate assets deposit and withdrawal, cross-chain communication, and restaking operations for native assets and liquid staking tokens (LSTs), ensuring secure interactions and efficient management of restaked assets.
The Exocore contracts repository contains a set of smart contracts deployed on both Exocore and the target client chains, which facilitate assets deposit and withdrawal, cross-chain communication, and restaking operations for native assets and liquid staking tokens (LSTs), ensuring secure interactions and efficient management of restaked assets.

## Getting Started

Expand Down
18 changes: 9 additions & 9 deletions docs/client-chain-contracts-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Exocore Client chain smart contracts refer to a set smart contracts that are dep
The two main functionalities of client chain smart contracts include:

1. Take user funds into custody when users ask to enter Exocore system, update user balance periodically and deal with withdrawal request of user based on withdrawable balance.
2. Forward user request from client chain side to Exocore validator set, as well as receive response from Exocore validator set to update state or execute some operations.
2. Forward user request from client chain side to Exocore, as well as receive response from Exocore to update state or execute some operations.

We have these components included in Exocore client chain smart contracts architecture:

1. `ClientChainGateway`: This is the entry point where client chain users make request to Exocore validator set, as well as the end point that receives cross-chain messages from Exocore validator set.
2. `Vault`: This is where user funds are taken into custody and managed. Within `Vault`, user balance is updated periodically by Exocore validator set through cross-chain message to reveal user’s real position (after slashing, rewarding and other impact). Users can withdraw from `Vault` based on grant from the gateway. Every specific asset should have standalone `Vault`.
1. `ClientChainGateway`: This is the entry point where client chain users make a request which will be forwarded to Exocore, as well as the end point that receives cross-chain messages or responses from the chain.
2. `Vault`: This is where user funds are taken into custody and managed. Within `Vault`, user balance is updated periodically by Exocore, in response to cross-chain messages originating from the user, to reveal user’s real position (after slashing, rewarding and other impact). Users can withdraw from `Vault` based on grant from the gateway. Every specific asset should have standalone `Vault`.
3. `LSTRestakingController`: The controller is responsible for managing multiple `Vault`s. It should be the entry point for operations on `Vault`, as well as the entry point for user’s interactions with the gateway. It is inherited / implemented by the `Gateway`.

## Upgrade
Expand Down Expand Up @@ -103,7 +103,7 @@ For more details please refer to these docs:

Similar to LayerZero `endpoint`, `ClientChainGateway` is mainly responsible for sending cross-chain messages and receiving cross-chain messages. The validity of cross-chain messages are guaranteed by LayerZero oracle and relayer if integrated with LayerZero protocol, otherwise `Gateway` itself should validate the cross-chain messages.

Eventually, Exocore validator set should be the owner of `ClientChainGateway` so that it can update some state variables or even upgrade it in the future. In the early stages, a more controlled way to upgrade is needed, for example, a multi-sig.
Eventually, the Exocore validator set should be the owner of `ClientChainGateway` so that it can update some state variables or even upgrade it in the future. In the early stages, a more controlled way to upgrade is needed, for example, a multi-sig.

We have made `ClientChainGateway` contract upgradable so that the state can be retained while adding or removing some features in the future.

Expand Down Expand Up @@ -208,7 +208,7 @@ interface IBaseRestakingController {
/// @notice Client chain users call to claim their unlocked assets from the vault.
/// @dev This function assumes that the claimable assets should have been unlocked before calling this.
/// @dev This function does not ask for grant from Exocore validator set.
/// @dev This function does not interact with Exocore.
/// @param token The address of specific token that the user wants to claim from the vault.
/// @param amount The amount of @param token that the user wants to claim from the vault.
/// @param recipient The destination address that the assets would be transfered to.
Expand All @@ -219,14 +219,14 @@ interface IBaseRestakingController {
interface ILSTRestakingController is IBaseRestakingController {
/// @notice Deposits tokens into the Exocore system for further operations like delegation and staking.
/// @dev This function locks the specified amount of tokens into a vault and informs the Exocore validator set.
/// Deposit is always considered successful on the Exocore chain side.
/// @dev This function locks the specified amount of tokens into a vault and forwards the information to Exocore.
/// @dev Deposit is always considered successful on the Exocore chain side.
/// @param token The address of the specific token that the user wants to deposit.
/// @param amount The amount of the token that the user wants to deposit.
function deposit(address token, uint256 amount) external payable;
/// @notice Requests withdrawal of the principal amount from Exocore to the client chain.
/// @dev This function requests withdrawal approval from the Exocore validator set. If approved, the assets are
/// @dev This function requests withdrawal approval from Exocore. If approved, the assets are
/// unlocked and can be claimed by the user. Otherwise, they remain locked.
/// @param token The address of the specific token that the user wants to withdraw from Exocore.
/// @param principalAmount The principal amount of assets the user deposited into Exocore for delegation and
Expand All @@ -239,7 +239,7 @@ interface ILSTRestakingController is IBaseRestakingController {
function withdrawRewardFromExocore(address token, uint256 rewardAmount) external payable;
/// @notice Deposits tokens and then delegates them to a specific node operator.
/// @dev This function locks the specified amount of tokens into a vault, informs the Exocore validator set, and
/// @dev This function locks the specified amount of tokens into a vault, informs Exocore, and
/// delegates the tokens to the specified node operator.
/// Delegation can fail if the node operator is not registered in Exocore.
/// @param token The address of the specific token that the user wants to deposit and delegate.
Expand Down
6 changes: 3 additions & 3 deletions script/3_Setup.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ contract SetupScript is BaseScript {
_bindPrecompileMocks();
}

// transfer some gas fee to exocore validator set address
// transfer some gas fee to contract owner
clientChain = vm.createSelectFork(clientChainRPCURL);
_topUpPlayer(clientChain, address(0), deployer, exocoreValidatorSet.addr, 0.2 ether);

Expand All @@ -56,7 +56,7 @@ contract SetupScript is BaseScript {
// 1. setup client chain contracts to make them ready for sending and receiving messages from exocore gateway

vm.selectFork(clientChain);
// Exocore validator set should be the owner of these contracts and only owner could setup contracts state
// Set owner of these contracts and only owner could setup contracts state
vm.startBroadcast(exocoreValidatorSet.privateKey);
// set the destination endpoint for corresponding destinations in endpoint mock if USE_ENDPOINT_MOCK is true
if (useEndpointMock) {
Expand All @@ -73,7 +73,7 @@ contract SetupScript is BaseScript {
// gateway, and register client chain meta data to Exocore native module

vm.selectFork(exocore);
// Exocore validator set should be the owner of these contracts and only owner could setup contracts state
// Set the owner of these contracts and only owner could setup contracts state
vm.startBroadcast(exocoreValidatorSet.privateKey);
// set the destination endpoint for corresponding destinations in endpoint mock if USE_ENDPOINT_MOCK is true
if (useEndpointMock) {
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IBaseRestakingController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface IBaseRestakingController {

/// @notice Client chain users call to claim their unlocked assets from the vault.
/// @dev This function assumes that the claimable assets should have been unlocked before calling this.
/// @dev This function does not ask for grant from Exocore validator set.
/// @dev This function does not interact with Exocore.
/// @param token The address of specific token that the user wants to claim from the vault.
/// @param amount The amount of @param token that the user wants to claim from the vault.
/// @param recipient The destination address that the assets would be transfered to.
Expand Down
8 changes: 4 additions & 4 deletions src/interfaces/ILSTRestakingController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import {IBaseRestakingController} from "./IBaseRestakingController.sol";
interface ILSTRestakingController is IBaseRestakingController {

/// @notice Deposits tokens into the Exocore system for further operations like delegation and staking.
/// @dev This function locks the specified amount of tokens into a vault and informs the Exocore validator set.
/// Deposit is always considered successful on the Exocore chain side.
/// @dev This function locks the specified amount of tokens into a vault and forwards the information to Exocore
/// @dev Deposit is always considered successful on the Exocore chain side.
/// @param token The address of the specific token that the user wants to deposit.
/// @param amount The amount of the token that the user wants to deposit.
function deposit(address token, uint256 amount) external payable;

/// @notice Requests withdrawal of the principal amount from Exocore to the client chain.
/// @dev This function requests withdrawal approval from the Exocore validator set. If approved, the assets are
/// @dev This function requests withdrawal approval from Exocore. If approved, the assets are
/// unlocked and can be claimed by the user. Otherwise, they remain locked.
/// @param token The address of the specific token that the user wants to withdraw from Exocore.
/// @param principalAmount The principal amount of assets the user deposited into Exocore for delegation and
Expand All @@ -32,7 +32,7 @@ interface ILSTRestakingController is IBaseRestakingController {
function withdrawRewardFromExocore(address token, uint256 rewardAmount) external payable;

/// @notice Deposits tokens and then delegates them to a specific node operator.
/// @dev This function locks the specified amount of tokens into a vault, informs the Exocore validator set, and
/// @dev This function locks the specified amount of tokens into a vault, informs Exocore, and
/// delegates the tokens to the specified node operator.
/// Delegation can fail if the node operator is not registered in Exocore.
/// @param token The address of the specific token that the user wants to deposit and delegate.
Expand Down
Loading

0 comments on commit e0691a2

Please sign in to comment.