IRebalancerTypes

Git Source

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

NameTypeDescription
initiateTimestampuint40The timestamp when the deposit or withdrawal was initiated.
amountuint88The amount of assets deposited by the user.
entryPositionVersionuint128The 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

NameTypeDescription
amountuint128The amount of assets used as collateral to open the position.
tickint24The tick of the position.
tickVersionuint256The version of the tick.
indexuint256The index of the position in the tick list.
entryAccMultiplieruint256The 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

NameTypeDescription
validationDelayuint64The minimum duration in seconds between an initiate action and the corresponding validate action.
validationDeadlineuint64The maximum duration in seconds between an initiate action and the corresponding validate action.
actionCooldownuint64The duration in seconds from the initiate action during which the user can't interact with the rebalancer if the validationDeadline is exceeded.
closeDelayuint64The Duration in seconds from the last rebalancer long position opening during which the user can't perform an initiateClosePosition.