v0.14.0
0.14.0 (2024-05-17)
⚠ BREAKING CHANGES
- actions: add to and validator in pending actions (#242)
- rebalancer: adds the Rebalancer in the USDN protocol, deployment script etc. (#259)
- usdn: The
LiquidationRewardsManager.getLiquidationRewardsfunction has an additional argumentrebaseCallbackResultof typebytes. - middleware:
getConfRatiois now calledgetConfRatioBps.getMaxConfRatiohas been replaced byMAX_CONF_RATIO.getConfRatioDenomhas been replaced byBPS_DIVISOR. - order-manager: everything related to the order manager has been removed
Features
- actions: add to and validator in pending actions (#242) (5d134a8)
- add separate fee parameter for vault actions (#244) (ccad861)
- order-manager: adds the order manager and tests (#249) (1a59ba0)
- order-manager: remove all the components of the order manager as well as the contract itself (#246) (fcaee82)
- params: add new parameter for the rebalancer bonus (#260) (f775065)
- rebalancer: adds the Rebalancer in the USDN protocol, deployment script etc. (#259) (924f73f)
- set a minimum deposit for user in the rebalancer (#265) (f542684)
- usdn: add rebase callback (#253) (0f75211)
Bug Fixes
Code Refactoring
Details
- add to and validator in pending actions
- add the rebalancer in the USDN protocol. Previously named Order Manager.
- add separate fee parameter for vault actions
- add rebase callback for USDN
- Fix : decrease allowance even if token amount is zero
Data Structure
Update
- rename user into validator in PendingAction
Function
New
ChainLinkOracle
- PRICE_TOO_OLD() returns (int256)
OracleMiddleware
- BPS_DIVISOR()
UsdnProtocol
- setVaultFeeBps(uint16 newVaultFee)
- setRebalancerBonusBps(uint16 newBonus)
Usdn
- rebaseCallback(uint256 oldDivisor, uint256 newDivisor)
- convertToTokensRoundUp(uint256 amountShares)
- setRebaseHandler(IRebaseCallback newHandler)
- rebaseHandler()
Update
LiquidationReward
- getLiquidationRewards(
uint16 tickAmount,
int256 remainingCollateral,
bool rebased,
bytes calldata priceData) -> getLiquidationRewards(
uint16 tickAmount,
int256 remainingCollateral,
bool rebased,
bytes calldata rebaseCallbackResult,
bytes calldata priceData)
OracleMiddleware
- getMaxConfRatio() -> MAX_CONF_RATIO()
- getConfRatio() -> getConfRatioBps()
UsdnProtocol
- setOrderManager(IOrderManager newOrderManager) -> setRebalancer(IRebalancer newRebalancer)
- initiateDeposit(
uint128 amount,
address to,
address validator,
bytes calldata currentPriceData,
PreviousActionsData calldata previousActionsData) - validateDeposit(
address validator,
bytes calldata depositPriceData,
PreviousActionsData calldata previousActionsData) - initiateWithdrawal(
uint152 usdnShares,
address to,
address validator,
bytes calldata currentPriceData,
PreviousActionsData calldata previousActionsData) - validateWithdrawal(
address validator,
bytes calldata withdrawalPriceData,
PreviousActionsData calldata previousActionsData) - initiateOpenPosition(
uint128 amount,
uint128 desiredLiqPrice,
address to,
address validator,
bytes calldata currentPriceData,
PreviousActionsData calldata previousActionsData) - validateOpenPosition(
address validator,
bytes calldata openPriceData,
PreviousActionsData calldata previousActionsData) - initiateClosePosition(
PositionId calldata posId,
uint128 amountToClose,
address to,
bytes calldata currentPriceData,
PreviousActionsData calldata previousActionsData) - validateClosePosition(
address owner,
bytes calldata closePriceData,
PreviousActionsData calldata previousActionsData)
Delete
OracleMiddleware
- getConfRatioDenom()
Events
New
Usdn
- RebaseHandlerUpdated(IRebaseCallback newHandler)
UsdnProtocol
- VaultFeeUpdated(uint256 vaultFee)
- RebalancerBonusUpdated(uint256 bonus)
Update
UsdnProtocol
- InitiatedDeposit(address indexed to, address indexed validator, uint256 amount, uint256 timestamp)
- ValidatedDeposit(
address indexed to, address indexed validator, uint256 amountDeposited, uint256 usdnMinted, uint256 timestamp) - InitiatedWithdrawal(address indexed to, address indexed validator, uint256 usdnAmount, uint256 timestamp)
- ValidatedWithdrawal(
address indexed to, address indexed validator, uint256 amountWithdrawn, uint256 usdnBurned, uint256 timestamp) - InitiatedOpenPosition(
address indexed owner,
address indexed validator,
uint40 timestamp,
uint128 totalExpo,
uint128 amount,
uint128 startPrice,
PositionId posId) - ValidatedOpenPosition(
address indexed owner, address indexed validator, uint128 totalExpo, uint128 newStartPrice, PositionId posId) - InitiatedClosePosition(
address indexed owner,
address indexed to,
PositionId posId,
uint128 originalAmount,
uint128 amountToClose,
uint128 totalExpoRemaining) - ValidatedClosePosition(
address indexed owner, address indexed to, PositionId posId, uint256 amountReceived, int256 profit) - StalePendingActionRemoved(address indexed validator, PositionId posId)
- OrderManagerUpdated(address newAddress) -> RebalancerUpdated(address newAddress)
- SecurityDepositRefunded(address indexed pendingActionValidator, address indexed receivedBy, uint256 amount)
- getOrderManager() -> getRebalancer()
- getVaultFeeBps()
- getRebalancerBonusBps()
Errors
New
UsdnProtocol
- UsdnProtocolInvalidAddressValidator()
- UsdnProtocolInvalidVaultFee()
- UsdnProtocolInvalidRebalancerBonus()
Usdn
- UsdnInvalidDivisor()