This contract functions as the accountant and manager for staking operations. It utilizes EIP-7201 to ensure storage integrity through the use of a transparent proxy pattern .
Copy enum LockAction {
Delegate,
DelegateAndStake
}
Copy struct State {
address locker;
address shareToken;
address liquidToken;
address strategist;
uint64 feePercent;
bytes32[15] __gap;
}
Copy struct ServicePool {
address stakeCandidate;
uint256 rewardDebt;
EnumerableMap.AddressToUintMap poolToId;
EnumerableMap.UintToAddressMap idToPool;
mapping(uint256 => EnumerableSet.UintSet) unstakeData;
EnumerableMap.AddressToUintMap userToId;
EnumerableMap.UintToAddressMap idToUser;
mapping(uint256 => EnumerableSet.UintSet) pendingRedemption;
mapping(address => EnumerableSet.UintSet) redemption;
EnumerableSet.UintSet pendingRedemptionList;
bytes32[15] __gap;
}
Copy struct ServicePoolView {
address stakeCandidate;
uint256 rewardDebt;
uint256 totalShares;
PoolInfoView[] pools;
}
struct PoolInfoView {
address pool;
uint256 deposit;
uint256[] unstakeData;
uint256[] amounts;
uint256[] unstakeAfter;
}
struct UserInfoView {
address user;
PendingRedemptionView[] pendingRedemption;
RedemptionView[] redemption;
}
struct PendingRedemptionView {
uint256 data;
uint256 amount;
uint256 duration;
}
struct RedemptionView {
uint256 data;
IXaiLocker.RedemptionRequest info;
}
Copy function previewLiquidityToShares(uint256 amount) view returns (uint256)
Copy function previewSharesToLiquidity(uint256 amount) view returns (uint256)
Copy function userInfo(address user) public view returns (UserInfoView memory info)
Copy function lockXai(uint256 amount, LockAction action)
function lockEsXai(uint256 amount, LockAction action)
Copy function sharesToLiquidity(uint256 amount)
function liquidityToShares(uint256 amount)
Copy function startRedemption(uint256 amount, uint256 duration, bool fromLiquid)
Copy function cancelPendingRedemption(uint256 pendingRedemptionData, bool toLiquid)
Copy function cancelRedemption(uint256 redemptionData, bool toLiquid)
Copy function completeRedemption(uint256 redemptionData)