Skip to content

v0.10.0

Compare
Choose a tag to compare
@ra2tech-blockchain-release-please ra2tech-blockchain-release-please released this 15 Mar 08:26
f50cbb4

0.10.0 (2024-03-14)

⚠ BREAKING CHANGES

  • actions: initiateDeposit, validateDeposit, initiateWithdrawal, validateWithdrawal, initiateOpenPosition, validateOpenPosition, initiateClosePosition and validateClosePosition now take a PreviousActionsData struct as last argument. getActionablePendingAction for now returns a single action and its corresponding rawIndex. DoubleEndedQueue returns a second argument with the raw index for methods front, back and at.
  • close-long: Position and PendingAction structs do not return the leverage anymore, they have the position expo instead
  • core: changed visibility of funding and fundingAsset functions (#143)
  • core: view functions for balances now consider funding and fees (#131)
  • usdn: ADJUSTMENT_ROLE becomes REBASER_ROLE, adjustDivisor becomes rebase, DivisorAdjusted becomes Rebase

Features

  • actions: separated external functions in multiple internal functions (#135) (3bdab81)
  • close-long: add the ability to partially close a position (#130) (62ff252)
  • core: changed visibility of funding and fundingAsset functions (#143) (d63cb41)
  • core: view functions for balances now consider funding and fees (#131) (4c323c9)
  • usdn: add automatic rebase (#124) (007df26)

Bug Fixes

  • assettotransfer: fix the double subtraction in asset to transfer when validating a close position (#138) (8bc712c)
  • position-totalexpo: use the liq price without penalty to calculate the position total expo (#134) (90b2ca4)

Code Refactoring

  • actions: allow to pass a list of pending actions data (#133) (efaea43)

Details

  • Funding function now takes only the timestamp and fundingAsset is now internal
  • Modify long/vaultAssetAvailableWithFunding to subtract fees to the returned values
  • Add the ability to partially close a position
  • Add automatic rebase for USDN
  • Can pass a list of prices signatures instead of one when validating pending action
  • Fix: The amount received by the user when closing a position is now calculated correctly
  • Fix: Use the liquidation price without a penalty when calculating the position exposition

Data Structure

New
  • PreviousActionsData :
    • bytes[] priceData An array of bytes, each representing the data to be forwarded to the oracle middleware to validate
    • uint128[] rawIndices An array of raw indices in the pending actions queue, in the same order as the corresponding
Update
  • RewardsParameters:
    • add rebaseGasUsed: uint32

Function

New

UsdnProtocol

  • setTargetUsdnPrice(uint128 newPrice)
  • setUsdnRebaseThreshold(uint128 newThreshold)
  • setUsdnRebaseInterval(uint256 newInterval)
  • calcEMA(int256 lastFunding, uint128 secondsElapsed, uint128 emaPeriod, int256 previousEMA) returns (int256)
  • getUsdnMinDivisor() returns (uint256)
  • getTargetUsdnPrice() returns (uint128)
  • getUsdnRebaseThreshold() returns (uint128)
  • getUsdnRebaseInterval() returns (uint256)
  • getLastRebaseCheck() returns (uint256)
Update

LiquidationRewardsManager

  • getLiquidationRewards(uint16 tickAmount, int256 amountLiquidated, bool rebased)
  • function setRewardsParameters( uint32 gasUsedPerTick,
    uint32 otherGasUsed,
    uint32 rebaseGasUsed,
    uint64 gasPriceLimit,
    uint32 multiplierBps )

Usdn

  • adjustDivisor(uint256 divisor) -> rebase(uint256 divisor)
  • ADJUSTMENT_ROLE() -> REBASER_ROLE()

UsdnProtocol

  • initiateClosePosition(
    int24 tick,
    uint256 tickVersion,
    uint256 index,
    uint128 amountToClose,
    bytes calldata currentPriceData,
    bytes calldata previousActionPriceData)
  • initiateDeposit, validateDeposit, initiateWithdrawal, validateWithdrawal,
    initiateOpenPosition, validateOpenPosition, initiateClosePosition
    and validateClosePosition last parameter is no longer bytes calldata previousActionPriceData
    but PreviousActionsData calldata previousActionsData instead
    see PreviousActionsData for more details
  • DEFAULT_QUEUE_MAX_ITER() -> MAX_ACTIONABLE_PENDING_ACTIONS()
  • getActionablePendingAction(uint256 maxIter) returns (PendingAction memory action_) ->
    getActionablePendingActions(address currentUser) returns (PendingAction[] memory actions_, uint128[] memory rawIndices_)
Remove

UsdnProtocol

  • fundingAsset(uint128 timestamp) -> internal

Events

New

UsdnProtocol

  • TargetUsdnPriceUpdated(uint128 price)
  • UsdnRebaseThresholdUpdated(uint128 threshold)
  • UsdnRebaseIntervalUpdated(uint256 interval)
Update

LiquidationRewardsManager

  • RewardsParametersUpdated(
    uint32 gasUsedPerTick, uint32 otherGasUsed, uint32 rebaseGasUsed, uint64 gasPriceLimit, uint32 multiplierBps
    )

Usdn

  • DivisorAdjusted(uint256 oldDivisor, uint256 newDivisor) -> Rebase(uint256 oldDivisor, uint256 newDivisor)

UsdnProtocol

  • InitiatedClosePosition(
    address indexed user,
    int24 tick,
    uint256 tickVersion,
    uint256 index,
    uint128 amountRemaining,
    uint128 totalExpoRemaining)

Errors

New

LiquidationRewardsManager

  • LiquidationRewardsManagerRebaseGasUsedTooHigh(uint256 value)

UsdnProtocol

  • UsdnProtocolInvalidTargetUsdnPrice()
  • UsdnProtocolInvalidUsdnRebaseThreshold()
  • UsdnProtocolAmountToCloseHigherThanPositionAmount(uint128 amountToClose, uint128 positionAmount)
  • UsdnProtocolAmountToCloseIsZero()
  • UsdnProtocolInvalidPendingActionData()
Remove

Usdn

  • UsdnInvalidDivisor(uint256 divisor)