IRebalancerTypes
Defines all custom types used by the Rebalancer contract.
Structs
UserDeposit
Represents the deposit data of a user.
A value of zero for initiateTimestamp
indicates that the deposit or withdrawal has been validated.
struct UserDeposit {
uint40 initiateTimestamp;
uint88 amount;
uint128 entryPositionVersion;
}
Properties
Name | Type | Description |
---|---|---|
initiateTimestamp | uint40 | The timestamp when the deposit or withdrawal was initiated. |
amount | uint88 | The amount of assets deposited by the user. |
entryPositionVersion | uint128 | The version of the position the user entered. |
PositionData
Represents data for a specific version of a position.
The difference between amount
here and the amount saved in the USDN protocol is the liquidation bonus.
struct PositionData {
uint128 amount;
int24 tick;
uint256 tickVersion;
uint256 index;
uint256 entryAccMultiplier;
}
Properties
Name | Type | Description |
---|---|---|
amount | uint128 | The amount of assets used as collateral to open the position. |
tick | int24 | The tick of the position. |
tickVersion | uint256 | The version of the tick. |
index | uint256 | The index of the position in the tick list. |
entryAccMultiplier | uint256 | The accumulated PnL multiplier of all positions up to this one. |
TimeLimits
Defines parameters related to the validation process for rebalancer deposits and withdrawals.
If validationDeadline
has passed, the user must wait until the cooldown duration has elapsed. Then, for
deposit actions, the user must retrieve its funds using resetDepositAssets. For withdrawal actions,
the user can simply initiate a new withdrawal.
struct TimeLimits {
uint64 validationDelay;
uint64 validationDeadline;
uint64 actionCooldown;
uint64 closeDelay;
}
Properties
Name | Type | Description |
---|---|---|
validationDelay | uint64 | The minimum duration in seconds between an initiate action and the corresponding validate action. |
validationDeadline | uint64 | The maximum duration in seconds between an initiate action and the corresponding validate action. |
actionCooldown | uint64 | The duration in seconds from the initiate action during which the user can't interact with the rebalancer if the validationDeadline is exceeded. |
closeDelay | uint64 | The Duration in seconds from the last rebalancer long position opening during which the user can't perform an initiateClosePosition. |