Skip to content

Commit 923e4a1

Browse files
wphan0xbigzmoosecat2crispheaneyLukasDeco
authored
Wphan/builder codes (#1805)
* program: init lp pool * cargo fmt -- * add total fee fields * add update_target_weights math * program: use sparse matrix for constituent map and update tests * zero copy accounts, init ix (#1578) * update accounts (#1580) * zero copy + permissionless crank ixs (#1581) * program: support negative target weights for borrow-lend * fix tests to work with zero copy * few comment changes * remove discriminator from impl macro * add get_swap_amount, get_swap_fees, get_weight (#1579) * add get_swap_amount, get_swap_fees, get_weight * update accounts * add back ts * rebase * add constituent swap fees * fix swap fee calc (#1582) * add init amm mapping to lp context (#1583) * init constituent * add initializeLpPool test (#1585) * add initializeLpPool test * add check for constituent target weights * add add datum ix * add init tests and invariant checks * rename data to more useful names * dlp use spl token program (#1588) * add crank ix * update total_weight for validation_flags check * push test so far * overriding perp position works * remove message * fix dup total_weight add * constituent map remaining accounts * compiles * bankrun tests pass * compiles but casting failure in overflow protection test * address comment and change token arguments from u64 to u128 * bankrun tests pass * init constituent token account (#1596) * update aum calc * add update /remove mapping ixs * fix test - init constituent spot market * add crank improvements * passes tests * precision fix crank aum * precision fixes and constituent map check for account owner * add passthrough account logic (#1602) * add passthrough account logic * cant read yet * fix all zc alignment issues * make oracle source a u8 on zc struct * Wphan/dlp-swap-ixs (#1592) * add lp_swap ix * rebase * test helpers * swap works * fix swaps, add more cargo tests for fees n swap amt * remove console.logs * address PR comments * merge upstream * post-merge fixes * store bumps on accounts (#1604) * store bumps on accounts * do pda check in constituent map * address comments * Wphan/add liquidity (#1607) * add add remove liquidity fees calc * add liquidity ix * fix init mint and lppool token account, refactor test fees * add removeLiquidity bankrun test * merge upstream * add LPPool.next_mint_redeem_id * program: lp-pool-to-use-target-base-vector (#1615) * init lp pool target-base matrix * working target-base logic * add todos for add/remove liquidity aum * add renames + fix test * add beta and cost to trade in bps to target datum * add more tests * add fields to LP events, fix tests (#1620) * add fields to LP events, fix tests * revert target weight calc * add constituent.next_swap_id, fix cost_to_trade math * dlp jup swap (#1636) * dlp jup swap * add admin client ixs * almost fixed * test working? * update begin and end swap * tweaks * fix math on how much was swapped * remove unnecessary lp pool args * extra account validation * added token account pda checks in other ixs * stablecoin targets (#1638) * is stablecoin * address comments --------- Co-authored-by: Chris Heaney <[email protected]> * cleanup * transfer oracle data ix to constituent (#1643) * transfer oracle data ix to constituent * add lib entrypoint * simplify more * add spot market constraint * big cargo test (#1644) * derivative constituents + better testing + bug fixes (#1657) * all tests technically pass * update tests + prettify * bug fixes and tests pass * fix many bugs and finalize logic * deposit/borrow working and changing positions (#1652) * sdk: allow custom coder * program: dlp add upnl for settles to amm cache (#1659) * program: dlp add-upnl-for-settles-to-amm-cache * finish up lp pool transfer from perp market * add amount_to_transfer using diff * merge * add pnl and fee pool accounting + transfer from dlp to perp market --------- Co-authored-by: Nour Alharithi <[email protected]> * remove unused accounts coder * move customCoder into sdk, lint * testing: ix: settle perp to dlp, insufficient balance edge case and improvements (#1688) * finish edge case test * aum check also passes * prettify * added more settle test coverage and squash bugs (#1689) * dlp: add constituentMap (#1699) * Nour/gauntlet fee impl (#1698) * added correlation matrix infra * refactor builds * mint redeem handled for usdc * remove liquidity also should work * all tests pass * bankrun tests pass too * update aum considers amm cache (#1701) * prettify (#1702) * Wphan/merge master dlp (#1703) * feat: init swift user orders on user account creation if needed * fix: wrong pushing of swift user orders ixs * fix: broken swift tests * fix: swift -> signed msg * refactor(sdk): update jupiter's api url * fix(sdk): remove error thrown * indicative qutoes server changes * sdk: release v2.121.0-beta.7 * sdK: update market index 33 oracle rr (#1606) * sdk: add to spot constants market index 34 * revert adminClient.ts change * sdk: update spot market constants oracle index 33 * sdk: release v2.121.0-beta.8 * sdk: high leverage mode updates (#1605) * sdk: high leverage mode updates * add optional param for fee calc * update changelog * sdk: release v2.121.0-beta.9 * getPlaceSignedMsgTakerPerpOrderIxs infer HLM mode from bitflags (#1608) * sdk: release v2.121.0-beta.10 * fix: dehexify in getPlaceSignedMsgTakerPerpOrderIxs (#1610) * fix: dehexify in getPlaceSignedMsgTakerPerpOrderIxs * bankrun test * sdk: release v2.121.0-beta.11 * sdk: round tick/step size for getVammL2Generateor (#1612) * sdk: round tick/step size for etVammL2Generateor * use standard functions, include in all fcns * fix const declare, rm whitespace * fix posdir sign * sdk: release v2.121.0-beta.12 * sdk: release v2.121.0-beta.13 * sdk: constants market-index-45-46 (#1618) * sdk: release v2.121.0-beta.14 * robustness check for indicative quotes sender (#1621) * robustness check for indicative quotes sender * delete quote from market index of bad quote * sdk: release v2.121.0-beta.15 * Added launchTs for ZEUS, zBTC * sdk: release v2.121.0-beta.16 * sdk: bigz/fix-vamm-l2-generator-baseSwapped var assign (#1622) * sdk: release v2.121.0-beta.17 * sdk: fix vamm l2 generator base swapped (#1623) * sdk: bigz/fix-vamm-l2-generator-baseSwapped var assign * fix ask book else baseSwapped calc * sdk: release v2.121.0-beta.18 * sdk: revert vamm l2 gen (#1624) * Revert "sdk: fix vamm l2 generator base swapped (#1623)" This reverts commit 56bc78d. * Revert "sdk: bigz/fix-vamm-l2-generator-baseSwapped var assign (#1622)" This reverts commit e49cfd5. * Revert "sdk: round tick/step size for getVammL2Generateor (#1612)" This reverts commit f932a4e. * sdk: release v2.121.0-beta.19 * sdk: show protected-asset have zero-borrow-limit (#1603) * sdk: show protected-asset have zero-borrow-limit * rm unused AssetTier import * sdk: release v2.121.0-beta.20 * sdk: market-constants-index-74 (#1629) * sdk: release v2.121.0-beta.21 * program: use saturating_sub for number_of_users (#1616) * program: use saturating_sub for number_of_users * update CHANGELOG.md * program: allow fixing hlm num users (#1630) * sdk: release v2.121.0-beta.22 * sdk: fix switchboard on demand client to use landed at * sdk: release v2.121.0-beta.23 * sdk: spot-market-poolid-4 constants (#1631) * sdk: release v2.121.0-beta.24 * fix high lev mode liq price (#1632) * sdk: release v2.121.0-beta.25 * replace deprecated solana install scripts (#1634) * sdk: release v2.121.0-beta.26 * refactor(sdk): use ReturnType for Timeout types (#1637) * sdk: release v2.121.0-beta.27 * auction price sdk fix * sdk: release v2.121.0-beta.28 * program: multi piecewise interest rate curve (#1560) * program: multi-piecewise-interest-rate-curve * update tests * widen out borrow limits/healthy util check * add break, use array of array for borrow slope segments * program: fix cargo test * sdk: add segmented IR curve to interest rate calc * clean up unusded var, make interest rate segment logic a const * incorp efficiency feedback points * test: add sol realistic market example * cargo fmt -- * CHANGELOG --------- Co-authored-by: Chris Heaney <[email protected]> * sdk: release v2.121.0-beta.29 * program: allow hot admin to update market fuel params (#1640) * v2.121.0 * sdk: release v2.122.0-beta.0 * sdk: fix nullish coalescing * sdk: release v2.122.0-beta.1 * program: add logging for wrong perp market mutability * sdk: check free collateral change in maxTradeSizeUsdcForPerp (#1645) * sdk: check free collateral change in maxTradeSizeUsdcForPerp * update changelog * sdk: release v2.122.0-beta.2 * refactor(sdk): emit newSlot event on initial subscribe call (#1646) * sdk: release v2.122.0-beta.3 * sdk: spot-market-constants-pool-id-2 (#1647) * sdk: release v2.122.0-beta.4 * sdk: add-spot-market-index-52-constants (#1649) * sdk: release v2.122.0-beta.5 * program: add existing position fields to order records (#1614) * program: add quote entry amount to order records * fix cargo fmt and test * more reusable code * more reusable code * add another comment * fix math * account for pos flip * fix typo * missed commit * more fixes * align naming * fix typo * CHANGELOG * program: check limit price after applying buffer in trigger limit ord… (#1648) * program: check limit price after applying buffer in trigger limit order auction * program: reduce duplicate code * fix tests * CHANGELOG --------- Co-authored-by: 0xbigz <[email protected]> * program: fix cargo tests * program: check limit price when setting auction for limit order (#1650) * program: check limit price after applying buffer in trigger limit order auction * program: reduce duplicate code * program: check limit price when setting limit auction params * cargo fmt -- * fix CHANGELOG * tests: updates switchboardTxCus.ts * program: try to fix iteration for max order size (#1651) * Revert "program: try to fix iteration for max order size (#1651)" This reverts commit 3f0eab3. * disable debug logging in bankrun tests * v2.122.0 * sdk: release v2.123.0-beta.0 * sdk: constants-spot-market-index-53 (#1655) * sdk: release v2.123.0-beta.1 * sdk: idl for new existing position order action records * fix: protocol test prettier fix * make ci lut checks not shit * sdk: release v2.123.0-beta.2 * sdk: fix vamm l2 generator base swapped and add new top of book (#1626) * sdk: bigz/fix-vamm-l2-generator-baseSwapped var assign * fix ask book else baseSwapped calc * use proper quoteAmount with baseSwap for top of book orders * clean up console.log * sdk: getVammL2Generator reduce loc (#1628) * sdk: getVammL2Generator-reduce-loc * add MAJORS_TOP_OF_BOOK_QUOTE_AMOUNTS * add marketindex check topOfBookAmounts * yarn lint/prettier * sdk: release v2.123.0-beta.3 * program: allow all limit orders to go through swift (#1661) * program: allow all limit orders to go through swift * add anchor test * CHANGELOG * sdk: add optional initSwiftAccount on existing account deposits (#1660) * sdk: release v2.123.0-beta.4 * program: add taker_speed_bump_override and amm_spread_adjustment * Revert "program: add taker_speed_bump_override and amm_spread_adjustment" This reverts commit 1e19b7e. * program: tests-fee-adjustment-neg-100 (#1656) * program: tests-fee-adjustment-neg-100 * add HLM field to test * cargo fmt -- --------- Co-authored-by: Chris Heaney <[email protected]> * program: simplify user can skip duration (#1668) * program: simplify user can skip duration * update context * CHANGELOG * fix test * fix pmm tests --------- Co-authored-by: Chris Heaney <[email protected]> * program: add taker_speed_bump_override and amm_spread_adjustment (#1665) * program: add taker_speed_bump_override and amm_spread_adjustment * add admin client * cargo test * add impl for amm_spread_adjustment * ensure no overflows * CHANGELOG * cargo fmt -- * sdk types * prettify --------- Co-authored-by: 0xbigz <[email protected]> * program: update-amm-spread-and-availability-constraints (#1663) * program: update-amm-spread-and-availability-constraints * fix cargo tests * program: use saturating mul for amm spread adj * nour/indic-quotes-sender-v2 (#1667) * nour/indic-quotes-sender-v2 * prettify * pass margin category into calculateEntriesEffectOnFreeCollateral (#1669) * fix cargo test * tests: fix oracle guardrail test * sdk: update idl * yarn prettify:fix * tests: fix a few more place and make tests * prettify fix * whitespace readme change * sdk: release v2.123.0-beta.5 * v2.123.0 * sdk: release v2.124.0-beta.0 * v2.123.0-1 * sdk: calculateVolSpreadBN-sync (#1671) * sdk: release v2.124.0-beta.1 * sdk: calculate-spread-bn-add-amm-spread-adjustment (#1672) * sdk: calculate-spread-bn-add-amm-spread-adjustment * corect sign * add math max 1 * prettify * sdk: release v2.124.0-beta.2 * sdk: correct calculateVolSpreadBN reversion * sdk: release v2.124.0-beta.3 * sdk: add getTriggerAuctionStartPrice (#1654) * sdk: add getTriggerAuctionStartPrice * updates * precisions * remove startBuffer param --------- Co-authored-by: Chris Heaney <[email protected]> * sdk: release v2.124.0-beta.4 * feat: customized cadence account loader (#1666) * feat: customized cadence account loader bby * feat: method to read account cadence on custom cadence account loader * feat: PR feedback on customized loader cleaup code and better naming * fix: lint and prettify * feat: more efficient rpc polling on custom polling intervals * feat: custom cadence acct loader override load * chore: prettify * sdk: release v2.124.0-beta.5 * sdk: sync-user-trade-tier-calcs (#1673) * sdk: sync-user-trade-tier-calcs * prettify --------- Co-authored-by: Nick Caradonna <[email protected]> * sdk: release v2.124.0-beta.6 * sdk: add new admin client fn * Revert "sdk: add new admin client fn" This reverts commit c7a4f0b. * sdk: release v2.124.0-beta.7 * refactor(ui): add callback logic, fix polling frequency update * sdk: release v2.124.0-beta.8 * program: less order param sanitization for long tail perps (#1680) * program: allow-auction-start-buffer-on-tail-mkt * fix test * cargo fmt -- * CHANGELOG --------- Co-authored-by: 0xbigz <[email protected]> * Wphan/custom coder (#1682) * sdk: allow custom coder * remove unused accounts coder * linter * move customCoder into sdk, lint * update test helpers * update testhelpers.ts * sdk: release v2.124.0-beta.9 * update sdk exports * sdk: release v2.124.0-beta.10 * sdk: safer-calculate-spread-reserve-math (#1681) * sdk: release v2.124.0-beta.11 * update getMaxLeverageForPerp to use usdc logic (#1678) * sdk: release v2.124.0-beta.12 * program: override for oracle delay (#1679) * programy: override for oracle delay * update impl * switch to i8 * CHANGELOG * program: programmatic rebalance between protocol owned if holdings (#1653) * program: if swap * program: add initial config * add update * more * moar * moar * moar * program: update how swap epoch works * add test * add an invariant * cargo fmt -- * add transfer to rev pool * add mint validation * cargo fmt -- * track in amount between tranfsers * add to ci tests * separate key * program: always transfer max amount to rev pool * CHANGELOG * sdk: release v2.124.0-beta.13 * sdk: improve-aclient-accounts-logic (#1684) * sdk: release v2.124.0-beta.14 * program: improve-amm-spread-validates (#1685) * program: let hot wallet update amm jit intensity * sdk: hot wallet can update amm jit intensity * program: hot wallet can update curve intensity * program: fix build * sdk: update idl * sdk: release v2.124.0-beta.15 * v2.124.0 * sdk: release v2.125.0-beta.0 * program: three-point-std-estimator (#1686) * program: three-point-std-estimator * update tests and add sdk * update changelog * sdk: add-updatePerpMarketOracleSlotDelayOverride (#1691) * sdk: release v2.125.0-beta.1 * program: add-amm-inventory-spread-adjustment-param (#1690) * program: add-amm-inventory-spread-adjustment-param * cargo fmt -- * update sdk * prettier * fix syntax { --------- Co-authored-by: Chris Heaney <[email protected]> * program: max-apr-rev-settle-by-spot-market (#1692) * program: max-apr-rev-settle-by-spot-market * update max * default to u128 to avoid casts * changelog * sdk: release v2.125.0-beta.2 * program: better account for imf in calculate_max_perp_order_size (#1693) * program: better account for imf in calculate_max_perp_order_size * CHANGELOG * v2.125.0 * sdk: release v2.126.0-beta.0 * sdk: only count taker fee in calculateEntriesEffectOnFreeCollateral for maintenance (#1694) * sdk: release v2.126.0-beta.1 * Separate getAddInsuranceFundStakeIxs (#1695) * sdk: release v2.126.0-beta.2 * idl: amm-inv-adj-latest-idl (#1697) * sdk: release v2.126.0-beta.3 * sdk: spot-market-index-54 constants (#1696) * sdk: release v2.126.0-beta.4 * sdk: update spot market index 54 pythlazer id * sdk: release v2.126.0-beta.5 * Update spotMarkets.ts * sdk: release v2.126.0-beta.6 * prettify --------- Co-authored-by: Lukas deConantsesznak <[email protected]> Co-authored-by: Chester Sim <[email protected]> Co-authored-by: Nour Alharithi <[email protected]> Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bigz_Pubkey <[email protected]> Co-authored-by: lowkeynicc <[email protected]> Co-authored-by: jordy25519 <[email protected]> Co-authored-by: Luke Steyn <[email protected]> Co-authored-by: lil perp <[email protected]> Co-authored-by: LukasDeco <[email protected]> Co-authored-by: Nick Caradonna <[email protected]> Co-authored-by: Jesse Cha <[email protected]> * slot staleness checks (#1705) * slot staleness checks * update aum ix to use constituent oracles * Nour/derivative constituent testing (#1708) * slot staleness checks * update aum ix to use constituent oracles * constituent test works when adjusting derivative index * constituent depeg kill switch works * works with multiple derivatives on the same parent * remove incorrect usage of nav * fix adminClient and tests * Nour/fee grid search testing (#1714) * grid search * grid search swap test * Nour/address comments (#1715) * low hanging fruit comments * remove pda checks and store lp pool on zero copy accounts * parameterize depeg threshold * make description in lp pool event * update idl for event change * add swap fee unit tests (#1713) * add swap fee unit tests * remove linear inventory fee component * Nour/settle accounting (#1723) * fixing the main settle test and settle function * all current tests pass * update msg occurrences * dont update lp quote owed unless collateralized * Nour/settle testing (#1725) * refactor settle pnl to modularize and add tests * more cargo tests * prettify * Nour/address more comments (#1726) * use oracle staleness threshold for staleness * add spot market vault invariant * refactor update_aum, add unit tests (#1727) * refactor update_aum, add unit tests * add constituent target base tests * update doc * Nour/parameterize dlp (#1731) * add validates and test for withdraw limit * settlement max * update idl * merge conflicts * fixes * update idl * bug fixes * mostly sdk fixes * bug fixes * bug fix and deploy script * program: new amm oracle (#1738) * zero unused amm fields * cargo fmt * bare bones ix * minimal anchor mm oracle impl * update test file * only do admin validate when not anchor test * updates * generalize native entry * fix weird function name chop off * make it compile for --feature cpi (#1748) Co-authored-by: jordy25519 <[email protected]> * more efficeint clock and state bit flags check * vamm uses mm oracle (#1747) * add offset * working tests * refactor to use MM oracle as its own type * remove weird preface * sdk updates * bankrun tests all pass * fix test * changes and fixes * widen confidence if mm oracle too diff * sdk side for confidence adjust * changelog * fix lint * fix cargo tests * address comments * add conf check * remove anchor ix and cache oracle confidence * only state admin can reenable mm oracle kill switch * cargo fmt --------- Co-authored-by: jordy25519 <[email protected]> * fix tests (#1764) * Nour/move ixs around (#1766) * move around ixs * remove message * add devnet oracle crank wallet * refactored mm oracle * sdk changes + cargo fmt * fix tests * validate price bands with fill fix * normalize fill within price bands * add sdk warning * updated type * undefined guard so anchor tests pass * accept vec for update amm and view amm * adjust test to work with new price bands * Revert "adjust test to work with new price bands" This reverts commit ee40ac8. * remove price bands logic * add zero ix for mm oracle for reset * add new drift client ix grouping * v1 safety improvements * isolate funding from MM oracle * add cargo tests for amm availability * change oracle validity log bool to enum * address comment * make validate fill direction agnostic * fix liquidate borrow for perp pnl test * fix tests and address comments * add RevenueShare and RevenueShareEscrow accounts an init ixs * fix multiple array zc account, and handling different message types in place_signed_msg_taker_order * decoding error * commit constituent map to barrel file * add lp fields to perp market account * recording orders in RevenueShareEscrow workin * rearrange perp market struct for lp fields * cancel and fill orders * idl * fix sdk build * fix math * bug fix for notional position tracking * update RevenueShareOrder bitflags, store builder_idx instead of pubkey * view function * merge RevenueShareOrders on add * fee view functions * max aum + whitelist check and removing get_mint_redeem_fee for now * add wsol support for add liquidity * fix sdk and typing bugs * update lp pool params ix * admin override cache and disable settle functions * remove builder accounts from cancel ixs, wip settle impl * dont fail settlpnl if no builder users provided * devnet swap working * finish settle, rename RevenueShare->Builder, RevenueShareEscrow->BuilderEscrow * add more bankrun tests, clean up * clean up, fix tests * why test fail * dlp taker discovered bug fixes and sdk changes * add subaccountid to BuilderOrder * reduce diff * refactor last settle ts to last settle slot * add referrals * add test can fill settle user with no builderescrow * add referral builder feature flag and referral migration method * fix cargo tests, try fix bankrun test timing issue * Nour/settle pnl fix (#1817) * settle perp to lp pool bug fixes * update bankrun test to not use admin fee pool deposit * fix tests using update spot market balances too * add log msgs for withdraw and fix casting bug * add SignedMsgOrderParamsMessageV2 * check in for z (#1823) * feat: option for custom oracle ws subscriber * fix: pass custom oracle ws sub option in dc constructor * sdk: add spot-market-index-57 to constants (#1815) * sdk: release v2.134.0-beta.2 * lazer oracle migration (#1813) * lazer oracle migration * spot markets too * sdk: release v2.134.0-beta.3 * sdk: release v2.134.0-beta.4 * program: settle pnl invariants (#1812) * program: settle pnl invariants * add test * fix lint * lints * add msg * CHANGELOG * cargo fmt -- * program: add_update_perp_pnl_pool (#1810) * program: add_update_perp_pnl_pool * test * CHANGELOG * sdk: release v2.134.0-beta.5 * program: update-mark-twap-integer-bias (#1783) * program: update-mark-twap-integer-bias * changelog update * program: update-fee-tier-determine-fix5 (#1800) * program: update-fee-tier-determine-fix5 * update changelog * program: update-mark-twap-crank-use-5min-basis (#1769) * program: update-mark-twap-crank-use-5min-basis * changelog * program: update-min-margin-const-limit (#1802) * program: update-min-margin-const-limit * add CHANGELOG.md * sdk: release v2.134.0-beta.6 * program: rm-burn-lp-shares-invariant (#1816) * program: rm-burn-lp-shares-invariant * update changelog * fix test and cargo fmt * fix anchor tests * yarn prettify:fix * reenable settle_pnl mode test * v2.134.0 * sdk: release v2.135.0-beta.0 * Merge pull request #1820 from drift-labs/chester/fix-zod * sdk: release v2.135.0-beta.1 * mm oracle sdk change (#1806) * mm oracle sdk change * better conditional typing * DLOB bug fix * updated idl * rm getAmmBidAskPrice * sdk: release v2.135.0-beta.2 * sdk: fix isHighLeverageMode * sdk: release v2.135.0-beta.3 * refactor(sdk): add update delegate ix method, ovrride authority for settle multiple pnl (#1822) * check in for z * more logging changes * mm oracle sdk additions (#1824) * strict typing for more MM oracle contact points * add comments to auction.ts * prettify * sdk: release v2.135.0-beta.4 * init constituent bug fix and type change * add in invariant to be within 1 bp of balance before after * add strict typing for getPrice and new auction trigger function (#1826) * add strict typing for getPrice and new auction trigger function * refactor getTriggerAuctionStartAndExecutionPrice * sdk: release v2.135.0-beta.5 * update tests and enforce atomic settles for withdraw * add failing withdraw test * withdraw fix * bring diff in validate back to 1 * make lp pool test fail * better failed test * only check after < before, do to spot precision limits * add balance check to be < 1 cent --------- Co-authored-by: Lukas deConantsesznak <[email protected]> Co-authored-by: bigz_Pubkey <[email protected]> Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: LukasDeco <[email protected]> Co-authored-by: lil perp <[email protected]> Co-authored-by: wphan <[email protected]> Co-authored-by: Chester Sim <[email protected]> * zero pad swift messages to make backwards compatible * PR feedback * add price for lp validates (#1833) * update tests/placeAndMakeSignedMsgBankrun.ts to handle client side errors * add missing token account reloads and syncs * add disabled lp pool swaps by default * refactor account logic for borrows * remove double fee count, update tests to check filled position and quote amounts fda * more extensive aum logging * rename Builder -> RevenueShare * add test check accumulated builder/ref fees * fix settle multiple pnl accounts, test ref rewards in multiple markets * express builder fees in tenth of bps * update referral migration params * PR feedback * add builder code feature gate * fix tests * add referral fields * run all tests * kickoff build * disable extra instructions, fix builder code feature flag selection * update driftclient * Revert recent builder codes chain and merge (#1848) * Revert recent builder codes chain and merge * update driftclient * disable extra instructions, fix builder code feature flag selection * clean up account inclusion rules in settle pnl for builder codes * cargo fmt * PR comments, featureflag clean up * move authority check into get_revenue_share_escrow_account * clean up referrer eligibility check, support placeAndTake/Make referral fees * skip builder fee accrual on full escrow account, dont throw * add feature flag sdk fn * program: builder codes dont throw tx on missing acc * placeAndMake respect builder codes * ensure update userstats referrerstatus on migration * hold back OrderActionRecord idl changes * update CHANGELOG.md --------- Co-authored-by: 0xbigz <[email protected]> Co-authored-by: moosecat <[email protected]> Co-authored-by: Chris Heaney <[email protected]> Co-authored-by: Lukas deConantsesznak <[email protected]> Co-authored-by: Chester Sim <[email protected]> Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: lowkeynicc <[email protected]> Co-authored-by: jordy25519 <[email protected]> Co-authored-by: Luke Steyn <[email protected]> Co-authored-by: LukasDeco <[email protected]> Co-authored-by: Nick Caradonna <[email protected]> Co-authored-by: Jesse Cha <[email protected]>
1 parent 6a8a7be commit 923e4a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+5371
-65
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Features
1111

12+
- program: builder codes ([#1805](https://github.com/drift-labs/protocol-v2/pull/1805))
13+
1214
### Fixes
1315

1416
### Breaking

programs/drift/src/controller/liquidation.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,8 @@ pub fn liquidate_perp(
675675
maker_existing_quote_entry_amount: maker_existing_quote_entry_amount,
676676
maker_existing_base_asset_amount: maker_existing_base_asset_amount,
677677
trigger_price: None,
678+
builder_idx: None,
679+
builder_fee: None,
678680
};
679681
emit!(fill_record);
680682

@@ -1038,6 +1040,7 @@ pub fn liquidate_perp_with_fill(
10381040
clock,
10391041
order_params,
10401042
PlaceOrderOptions::default().explanation(OrderActionExplanation::Liquidation),
1043+
&mut None,
10411044
)?;
10421045

10431046
drop(user);
@@ -1058,6 +1061,8 @@ pub fn liquidate_perp_with_fill(
10581061
None,
10591062
clock,
10601063
FillMode::Liquidation,
1064+
&mut None,
1065+
false,
10611066
)?;
10621067

10631068
let mut user = load_mut!(user_loader)?;

programs/drift/src/controller/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub mod pda;
77
pub mod pnl;
88
pub mod position;
99
pub mod repeg;
10+
pub mod revenue_share;
1011
pub mod spot_balance;
1112
pub mod spot_position;
1213
pub mod token;

0 commit comments

Comments
 (0)