Skip to content

v0.6.0

Compare
Choose a tag to compare
@ra2tech-blockchain-release-please ra2tech-blockchain-release-please released this 15 Feb 16:11
d9be95d

0.6.0 (2024-02-15)

⚠ BREAKING CHANGES

  • transfer remaining collateral to vault upon liquidation (#89)
  • events: Position has no startPrice anymore, InitiatedOpenPosition and ValidatedOpenPosition have different fields
  • middleware: some unused errors don't exist anymore

Features

  • transfer remaining collateral to vault upon liquidation (#89) (92f43e7)
  • update position tick if leverage exceeds max leverage (#76) (aad0e50)

Bug Fixes

  • liquidation: use neutral price and liquidate whenever possible (#94) (92f13b5)
  • middleware: remove unused errors (#83) (6a95a11)
  • only pass required ether to middleware and refund excess (#87) (7c777e4)

Code Refactoring

  • events: remove unused or unneeded fields from events and structs (#88) (672e4f7)

Details

  • Update position tick if leverage exceeds max leverage. If leverage above 10, then update tick to the lower tick with leverage under 10.
  • Fix: ether refund from oracle middleware, was unable to validate two times in the same tx/
  • Update balance between vault and long when a position is liquidated. If there is a gain, the vault will receive the gain, if there is a loss, the vault will pay the loss.
  • Use neutral pyth price for liquidation.

Deployment

  • PYTH_WSTETH_PRICE_ID removed

Data structure

  • Remove uint128 startPrice from Position

Events

Update
  • event InitiatedOpenPosition( address indexed user, Position position, int24 tick, uint256 tickVersion, uint256 index)
    -> event InitiatedOpenPosition( address indexed user, uint40 timestamp, uint128 leverage, uint128 amount, uint128 startPrice, int24 tick, uint256 tickVersion, uint256 index );
  • event ValidatedOpenPosition( address indexed user, Position position, int24 tick, uint256 tickVersion, uint256 index, uint128 liquidationPrice ); -> event ValidatedOpenPosition( address indexed user, uint128 newLeverage, uint128 newStartPrice, int24 tick, uint256 tickVersion, uint256 index );
  • event LiquidatedTick( int24 indexed tick, uint256 indexed oldTickVersion, uint256 liquidationPrice, uint256 effectiveTickPrice );->event LiquidatedTick( int24 indexed tick, uint256 indexed oldTickVersion, uint256 liquidationPrice, uint256 effectiveTickPrice, int256 remainingCollateral )

Errors

New
  • OracleMiddlewareInsufficientFee()
  • OracleMiddlewareEtherRefundFailed()
  • UsdnProtocolInsufficientOracleFee()
  • UsdnProtocolEtherRefundFailed()
Removed
  • OracleMiddlewarePriceRequestTooEarly()
  • OracleMiddlewareOracleMiddlewareWrongPriceTimestamp(uint64 min, uint64 max, uint64 result)
  • OracleMiddlewareUnsupportedAction(ProtocolAction action)
  • OracleMiddlewarePythValidationFailed()