diff --git a/package.json b/package.json index 81aa3399c..53cb76704 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "treasury": "cd utils;npm i; cd ..; node utils/testInteractive treasury", "entities": "cd utils;npm i; cd ..; node utils/testInteractive entities", "useTokenLabels": "node utils/scripts/useTokenLabels.js", - "biggest-files": "find ./projects -name '*.js' -not -path './projects/helper/*' -not -path './projects/curve/*' -not -path './projects/sigmao/*' -exec du -sh {} \\; | sort -rh | head -n 100", + "_biggest-files-old": "find ./projects -name '*.js' -not -path './projects/helper/*' -not -path './projects/curve/*' -not -path './projects/sigmao/*' -exec du -sh {} \\; | sort -rh | head -n 100", + "biggest-files": "node utils/scripts/sortTopFilesByLines.js", "check-bitcoin-duplicates": "node utils/scripts/checkBTCDupsv2.js", "string-timestamp": "node utils/scripts/stringTimestamp.js", "sort-chains": "node projects/helper/getChainList.js", diff --git a/projects/cypher-trade/idl.json b/projects/cypher-trade/idl.json index 426f77e8b..3a7c32f61 100644 --- a/projects/cypher-trade/idl.json +++ b/projects/cypher-trade/idl.json @@ -8,27 +8,14 @@ "type": { "kind": "struct", "fields": [ - { - "name": "authority", - "docs": [ - "the authority of the cache" - ], - "type": "publicKey" - }, + {"name": "authority", "docs": ["the authority of the cache"], "type": "publicKey"}, { "name": "caches", "docs": [ "the price caches, we have enough space here for more oracle maps than ever needed", "assuming that oracle products accounts actually get reused" ], - "type": { - "array": [ - { - "defined": "Cache" - }, - 512 - ] - } + "type": {"array": [{"defined": "Cache"}, 512]} } ] } @@ -38,96 +25,16 @@ "type": { "kind": "struct", "fields": [ - { - "name": "bumpSeed", - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "clearingType", - "docs": [ - "the type of the clearing" - ], - "type": { - "defined": "ClearingType" - } - }, - { - "name": "padding1", - "type": { - "array": [ - "u8", - 6 - ] - } - }, - { - "name": "clearingNumberSeed", - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "padding2", - "type": { - "array": [ - "u8", - 7 - ] - } - }, - { - "name": "authority", - "docs": ["the clearing's authority" - ], - "type": "publicKey" - }, - { - "name": "feeMint", - "docs": [ - "the mint of the token used to calculate fee tiers" - ], - "type": "publicKey" - }, - { - "name": "padding3", - "type": { - "array": [ - "u64", - 4 - ] - } - }, - { - "name": "feeTiers", - "docs": [ - "the fee tiers" - ], - "type": { - "array": [ - { - "defined": "FeeTier" - }, - 10 - ] - } - }, - { - "name": "config", - "docs": [ - "the config of the clearing" - ], - "type": { - "defined": "ClearingConfig" - } - } + {"name": "bumpSeed", "type": {"array": ["u8", 1]}}, + {"name": "clearingType", "docs": ["the type of the clearing"], "type": {"defined": "ClearingType"}}, + {"name": "padding1", "type": {"array": ["u8", 6]}}, + {"name": "clearingNumberSeed", "type": {"array": ["u8", 1]}}, + {"name": "padding2", "type": {"array": ["u8", 7]}}, + {"name": "authority", "docs": ["the clearing's authority"], "type": "publicKey"}, + {"name": "feeMint", "docs": ["the mint of the token used to calculate fee tiers"], "type": "publicKey"}, + {"name": "padding3", "type": {"array": ["u64", 4]}}, + {"name": "feeTiers", "docs": ["the fee tiers"], "type": {"array": [{"defined": "FeeTier"}, 10]}}, + {"name": "config", "docs": ["the config of the clearing"], "type": {"defined": "ClearingConfig"}} ] } }, @@ -136,33 +43,10 @@ "type": { "kind": "struct", "fields": [ - { - "name": "clearing", - "docs": [ - "the corresponding clearing" - ], - "type": "publicKey" - }, - { - "name": "authority", - "docs": ["the clearing's authority" - ], - "type": "publicKey" - }, - { - "name": "accountOwner", - "docs": [ - "the account owner" - ], - "type": "publicKey" - }, - { - "name": "account", - "docs": [ - "the actual cypher account" - ], - "type": "publicKey" - }, + {"name": "clearing", "docs": ["the corresponding clearing"], "type": "publicKey"}, + {"name": "authority", "docs": ["the clearing's authority"], "type": "publicKey"}, + {"name": "accountOwner", "docs": ["the account owner"], "type": "publicKey"}, + {"name": "account", "docs": ["the actual cypher account"], "type": "publicKey"}, { "name": "status", "docs": [ @@ -170,19 +54,9 @@ "i.e, when a whitelist status is revoked, the authority of the clearing should be able", "to suspend a cypher account" ], - "type": { - "defined": "WhitelistStatus" - } + "type": {"defined": "WhitelistStatus"} }, - { - "name": "padding1", - "type": { - "array": [ - "u8", - 7 - ] - } - } + {"name": "padding1", "type": {"array": ["u8", 7]}} ] } }, @@ -193,36 +67,12 @@ "fields": [ { "name": "inner", - "docs": [ - "the inner structure which contains all relevant agnostic orderbook related public keys and fields" - ], - "type": { - "defined": "AgnosticMarket" - } - }, - { - "name": "idoAuthority", - "docs": [ - "the ido authority of the market, if applicable" - ], - "type": "publicKey" - }, - { - "name": "underlyingMint", - "docs": [ - "the mint of the underlying token this derivative market may physically deliver" - ], - "type": "publicKey" - }, - { - "name": "padding1", - "type": { - "array": [ - "u64", - 8 - ] - } + "docs": ["the inner structure which contains all relevant agnostic orderbook related public keys and fields"], + "type": {"defined": "AgnosticMarket"} }, + {"name": "idoAuthority", "docs": ["the ido authority of the market, if applicable"], "type": "publicKey"}, + {"name": "underlyingMint", "docs": ["the mint of the underlying token this derivative market may physically deliver"], "type": "publicKey"}, + {"name": "padding1", "type": {"array": ["u64", 8]}}, { "name": "tokenSupply", "docs": [ @@ -232,61 +82,16 @@ ], "type": "u64" }, - { - "name": "activatesAt", - "docs": [ - "timestamp at which the market becomes active" - ], - "type": "u64" - }, - { - "name": "expiresAt", - "docs": [ - "timestamp at which the market expires" - ], - "type": "u64" - }, - { - "name": "positionsCount", - "docs": [ - "number of open positions in this market" - ], - "type": "u64" - }, - { - "name": "marketPrice", - "docs": [ - "the twap price" - ], - "type": "i128" - }, - { - "name": "totalBorrows", - "docs": [ - "the total amount of borrows of the derivative" - ], - "type": "u64" - }, - { - "name": "totalPurchased", - "docs": [ - "the total amount of purchased tokens in the case of a pre-ido market" - ], - "type": "u64" - }, - { - "name": "padding2", - "type": { - "array": [ - "u64", - 2 - ] - } - }, + {"name": "activatesAt", "docs": ["timestamp at which the market becomes active"], "type": "u64"}, + {"name": "expiresAt", "docs": ["timestamp at which the market expires"], "type": "u64"}, + {"name": "positionsCount", "docs": ["number of open positions in this market"], "type": "u64"}, + {"name": "marketPrice", "docs": ["the twap price"], "type": "i128"}, + {"name": "totalBorrows", "docs": ["the total amount of borrows of the derivative"], "type": "u64"}, + {"name": "totalPurchased", "docs": ["the total amount of purchased tokens in the case of a pre-ido market"], "type": "u64"}, + {"name": "padding2", "type": {"array": ["u64", 2]}}, { "name": "totalRaised", - "docs": ["the total amount of quote token that is available for the pre-ido token project's team to be collected" - ], + "docs": ["the total amount of quote token that is available for the pre-ido token project's team to be collected"], "type": "i128" } ] @@ -299,73 +104,17 @@ "fields": [ { "name": "inner", - "docs": [ - "the inner structure which contains all relevant agnostic orderbook related public keys and fields" - ], - "type": { - "defined": "AgnosticMarket" - } + "docs": ["the inner structure which contains all relevant agnostic orderbook related public keys and fields"], + "type": {"defined": "AgnosticMarket"} }, - { - "name": "longFunding", - "docs": [ - "the long funding" - ], - "type": "i128" - }, - { - "name": "shortFunding", - "docs": [ - "the short funding" - ], - "type": "i128" - }, - { - "name": "lastFundingUpdate", - "docs": [ - "the timestamp of the last funding update" - ], - "type": "u64" - }, - { - "name": "impactQuantity", - "docs": [ - "the impact quantity used when getting bids and asks to calculate book mid price" - ], - "type": "u64" - }, - { - "name": "padding1", - "type": { - "array": [ - "u64", - 10 - ] - } - }, - { - "name": "minFunding", - "docs": [ - "the minimum funding rate for this market, in percentage" - ], - "type": "i8" - }, - { - "name": "maxFunding", - "docs": [ - "the maximum funding rate for this market, in percentage" - ], - "type": "i8" - }, - { - "name": "padding2", - "type": { - "array": [ - "u8", - 6 - ] - } - } + {"name": "longFunding", "docs": ["the long funding"], "type": "i128"}, + {"name": "shortFunding", "docs": ["the short funding"], "type": "i128"}, + {"name": "lastFundingUpdate", "docs": ["the timestamp of the last funding update"], "type": "u64"}, + {"name": "impactQuantity", "docs": ["the impact quantity used when getting bids and asks to calculate book mid price"], "type": "u64"}, + {"name": "padding1", "type": {"array": ["u64", 10]}}, + {"name": "minFunding", "docs": ["the minimum funding rate for this market, in percentage"], "type": "i8"}, + {"name": "maxFunding", "docs": ["the maximum funding rate for this market, in percentage"], "type": "i8"}, + {"name": "padding2", "type": {"array": ["u8", 6]}} ] } }, @@ -374,24 +123,8 @@ "type": { "kind": "struct", "fields": [ - { - "name": "productsType", - "docs": [ - "the products type" - ], - "type": { - "defined": "ProductsType" - } - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 7 - ] - } - }, + {"name": "productsType", "docs": ["the products type"], "type": {"defined": "ProductsType"}}, + {"name": "padding", "type": {"array": ["u8", 7]}}, { "name": "symbol", "docs": [ @@ -399,64 +132,14 @@ "", "this is used as a PDA for the oracle products account to more easily derive this account and see if it exists so it is properly reused" ], - "type": { - "array": [ - "u8", - 32 - ] - } + "type": {"array": ["u8", 32]} }, - { - "name": "maxConfidenceInterval", - "docs": [ - "the maximum confidence interval for the oracle price" - ], - "type": "f64" - }, - { - "name": "futuresMarket", - "docs": [ - "the futures market associated with this oracle products account" - ], - "type": "publicKey" - }, - { - "name": "perpMarket", - "docs": [ - "the perp market associated with this oracle products account" - ], - "type": "publicKey" - }, - { - "name": "tokenMint", - "docs": [ - "the token mint associated with this oracle products account" - ], - "type": "publicKey" - }, - { - "name": "products", - "docs": [ - "the product accounts" - ], - "type": { - "vec": { - "array": [ - "u8", - 32 - ] - } - } - }, - { - "name": "weights", - "docs": [ - "the weights of the products" - ], - "type": { - "vec": "u16" - } - } + {"name": "maxConfidenceInterval", "docs": ["the maximum confidence interval for the oracle price"], "type": "f64"}, + {"name": "futuresMarket", "docs": ["the futures market associated with this oracle products account"], "type": "publicKey"}, + {"name": "perpMarket", "docs": ["the perp market associated with this oracle products account"], "type": "publicKey"}, + {"name": "tokenMint", "docs": ["the token mint associated with this oracle products account"], "type": "publicKey"}, + {"name": "products", "docs": ["the product accounts"], "type": {"vec": {"array": ["u8", 32]}}}, + {"name": "weights", "docs": ["the weights of the products"], "type": {"vec": "u16"}} ] } }, @@ -465,25 +148,8 @@ "type": { "kind": "struct", "fields": [ - { - "name": "symbol", - "docs": [ - "the symbol of the underlying token that this oracle stub provides a feed for" - ], - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "price", - "docs": [ - "The oracle price" - ], - "type": "i128" - } + {"name": "symbol", "docs": ["the symbol of the underlying token that this oracle stub provides a feed for"], "type": {"array": ["u8", 32]}}, + {"name": "price", "docs": ["The oracle price"], "type": "i128"} ] } }, @@ -492,131 +158,20 @@ "type": { "kind": "struct", "fields": [ - { - "name": "orderCount", - "docs": [ - "number of orders" - ], - "type": "u8" - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 7 - ] - } - }, - { - "name": "authority", - "docs": ["the account's authority" - ], - "type": "publicKey" - }, - { - "name": "market", - "docs": ["the account's authority" - ], - "type": "publicKey" - }, - { - "name": "masterAccount", - "docs": [ - "the master account pubkey" - ], - "type": "publicKey" - }, - { - "name": "makerBaseVolume", - "docs": [ - "the accumulated maker base token volume" - ], - "type": "u64" - }, - { - "name": "makerQuoteVolume", - "docs": [ - "the accumulated maker quote token volume" - ], - "type": "u64" - }, - { - "name": "takerBaseVolume", - "docs": [ - "the accumulated taker base token volume" - ], - "type": "u64" - }, - { - "name": "takerQuoteVolume", - "docs": [ - "the accumulated taker quote token volume" - ], - "type": "u64" - }, - { - "name": "baseTokenFree", - "docs": [ - "the amount of base token free" - ], - "type": { - "array": [ - "u64", - 24 - ] - } - }, - { - "name": "baseTokenLocked", - "docs": [ - "the amount of base token locked" - ], - "type": { - "array": [ - "u64", - 24 - ] - } - }, - { - "name": "quoteTokenFree", - "docs": [ - "the amount of quote token free" - ], - "type": { - "array": [ - "u64", - 24 - ] - } - }, - { - "name": "quoteTokenLocked", - "docs": [ - "the amount of quote token locked in orders" - ], - "type": { - "array": [ - "u64", - 24 - ] - } - }, - { - "name": "openOrders", - "docs": [ - "the open orders in this account" - ], - "type": { - "array": [ - { - "defined": "OpenOrder" - }, - 128 - ] - } - } + {"name": "orderCount", "docs": ["number of orders"], "type": "u8"}, + {"name": "padding", "type": {"array": ["u8", 7]}}, + {"name": "authority", "docs": ["the account's authority"], "type": "publicKey"}, + {"name": "market", "docs": ["the account's authority"], "type": "publicKey"}, + {"name": "masterAccount", "docs": ["the master account pubkey"], "type": "publicKey"}, + {"name": "makerBaseVolume", "docs": ["the accumulated maker base token volume"], "type": "u64"}, + {"name": "makerQuoteVolume", "docs": ["the accumulated maker quote token volume"], "type": "u64"}, + {"name": "takerBaseVolume", "docs": ["the accumulated taker base token volume"], "type": "u64"}, + {"name": "takerQuoteVolume", "docs": ["the accumulated taker quote token volume"], "type": "u64"}, + {"name": "baseTokenFree", "docs": ["the amount of base token free"], "type": {"array": ["u64", 24]}}, + {"name": "baseTokenLocked", "docs": ["the amount of base token locked"], "type": {"array": ["u64", 24]}}, + {"name": "quoteTokenFree", "docs": ["the amount of quote token free"], "type": {"array": ["u64", 24]}}, + {"name": "quoteTokenLocked", "docs": ["the amount of quote token locked in orders"], "type": {"array": ["u64", 24]}}, + {"name": "openOrders", "docs": ["the open orders in this account"], "type": {"array": [{"defined": "OpenOrder"}, 128]}} ] } }, @@ -625,136 +180,24 @@ "type": { "kind": "struct", "fields": [ - { - "name": "cacheIndex", - "docs": [ - "the index of the cache for the pool that this node belongs to" - ], - "type": "u16" - }, - { - "name": "vaultSignerSeed", - "docs": [ - "the bump seed" - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "nodeNumber", - "docs": [ - "the number of the node, also used as a seed for the pool node pda" - ], - "type": "u8" - }, - { - "name": "operatingStatus", - "type": { - "defined": "OperatingStatus" - } - }, - { - "name": "padding1", - "type": { - "array": [ - "u8", - 11 - ] - } - }, - { - "name": "selfAddress", - "docs": ["the pool node's address, used as a seed for the vault signer" - ], - "type": "publicKey" - }, - { - "name": "authority", - "docs": [ - "the authority over this account" - ], - "type": "publicKey" - }, - { - "name": "cache", - "docs": [ - "the cache account" - ], - "type": "publicKey" - }, - { - "name": "pool", - "docs": [ - "the pool this node belongs to" - ], - "type": "publicKey" - }, - { - "name": "tokenMint", - "docs": ["the node's token mint" - ], - "type": "publicKey" - }, - { - "name": "tokenVault", - "docs": ["the node's token vault" - ], - "type": "publicKey" - }, - { - "name": "vaultSigner", - "docs": ["the node's vault signer" - ], - "type": "publicKey" - }, - { - "name": "deposits", - "docs": [ - "the amount of deposits" - ], - "type": "i128" - }, - { - "name": "borrows", - "docs": [ - "the amount of borrows" - ], - "type": "i128" - }, - { - "name": "accumBorrows", - "docs": [ - "accumulated borrows" - ], - "type": "i128" - }, - { - "name": "accumRepays", - "docs": [ - "accumulated repays" - ], - "type": "i128" - }, - { - "name": "protocolFees", - "docs": [ - "protocol fees accumulated so far" - ], - "type": "u64" - }, - { - "name": "padding2", - "type": { - "array": [ - "u64", - 1 - ] - } - } + {"name": "cacheIndex", "docs": ["the index of the cache for the pool that this node belongs to"], "type": "u16"}, + {"name": "vaultSignerSeed", "docs": ["the bump seed"], "type": {"array": ["u8", 1]}}, + {"name": "nodeNumber", "docs": ["the number of the node, also used as a seed for the pool node pda"], "type": "u8"}, + {"name": "operatingStatus", "type": {"defined": "OperatingStatus"}}, + {"name": "padding1", "type": {"array": ["u8", 11]}}, + {"name": "selfAddress", "docs": ["the pool node's address, used as a seed for the vault signer"], "type": "publicKey"}, + {"name": "authority", "docs": ["the authority over this account"], "type": "publicKey"}, + {"name": "cache", "docs": ["the cache account"], "type": "publicKey"}, + {"name": "pool", "docs": ["the pool this node belongs to"], "type": "publicKey"}, + {"name": "tokenMint", "docs": ["the node's token mint"], "type": "publicKey"}, + {"name": "tokenVault", "docs": ["the node's token vault"], "type": "publicKey"}, + {"name": "vaultSigner", "docs": ["the node's vault signer"], "type": "publicKey"}, + {"name": "deposits", "docs": ["the amount of deposits"], "type": "i128"}, + {"name": "borrows", "docs": ["the amount of borrows"], "type": "i128"}, + {"name": "accumBorrows", "docs": ["accumulated borrows"], "type": "i128"}, + {"name": "accumRepays", "docs": ["accumulated repays"], "type": "i128"}, + {"name": "protocolFees", "docs": ["protocol fees accumulated so far"], "type": "u64"}, + {"name": "padding2", "type": {"array": ["u64", 1]}} ] } }, @@ -763,192 +206,29 @@ "type": { "kind": "struct", "fields": [ - { - "name": "bumpSeed", - "docs": [ - "the bump seed" - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "operatingStatus", - "docs": ["the pool's operating status" - ], - "type": { - "defined": "OperatingStatus" - } - }, - { - "name": "padding1", - "type": { - "array": [ - "u8", - 14 - ] - } - }, - { - "name": "poolName", - "docs": [ - "the name of the pool, which is also used as a seed" - ], - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "config", - "docs": [ - "the pool config" - ], - "type": { - "defined": "PoolConfig" - } - }, - { - "name": "authority", - "docs": [ - "the authority over this account" - ], - "type": "publicKey" - }, - { - "name": "tokenMint", - "docs": [ - "the address of the token mint this pool represents" - ], - "type": "publicKey" - }, - { - "name": "padding2", - "type": { - "array": [ - "u64", - 4 - ] - } - }, - { - "name": "oracleProducts", - "docs": [ - "the oracle products account" - ], - "type": "publicKey" - }, - { - "name": "dexMarket", - "docs": [ - "the dex market for this pool" - ], - "type": "publicKey" - }, - { - "name": "cache", - "docs": [ - "the price cache account" - ], - "type": "publicKey" - }, - { - "name": "padding3", - "type": { - "array": [ - "u64", - 8 - ] - } - }, - { - "name": "deposits", - "docs": [ - "the amount of deposits across all nodes" - ], - "type": "i128" - }, - { - "name": "borrows", - "docs": [ - "the amount of borrows across all nodes" - ], - "type": "i128" - }, - { - "name": "depositIndex", - "docs": [ - "the deposit index" - ], - "type": "i128" - }, - { - "name": "borrowIndex", - "docs": [ - "the borrow index" - ], - "type": "i128" - }, - { - "name": "accumDepositInterestPayment", - "docs": [ - "accumulated deposit interest payments denominated in quote currency" - ], - "type": "i128" - }, - { - "name": "accumBorrowInterestPayment", - "docs": [ - "accumulated borrow interest payments denominated in quote currency" - ], - "type": "i128" - }, - { - "name": "indexUpdatedAt", - "docs": [ - "timestamp of the last index update" - ], - "type": "u64" - }, - { - "name": "protocolFees", - "docs": [ - "protocol fees accumulated so far" - ], - "type": "u64" - }, - { - "name": "insuranceFund", - "docs": [ - "the insurance fund for this pool" - ], - "type": "u64" - }, - { - "name": "padding4", - "type": { - "array": [ - "u64", - 12 - ] - } - }, - { - "name": "nodes", - "type": { - "array": [ - { - "defined": "NodeInfo" - }, - 24 - ] - } - } + {"name": "bumpSeed", "docs": ["the bump seed"], "type": {"array": ["u8", 1]}}, + {"name": "operatingStatus", "docs": ["the pool's operating status"], "type": {"defined": "OperatingStatus"}}, + {"name": "padding1", "type": {"array": ["u8", 14]}}, + {"name": "poolName", "docs": ["the name of the pool, which is also used as a seed"], "type": {"array": ["u8", 32]}}, + {"name": "config", "docs": ["the pool config"], "type": {"defined": "PoolConfig"}}, + {"name": "authority", "docs": ["the authority over this account"], "type": "publicKey"}, + {"name": "tokenMint", "docs": ["the address of the token mint this pool represents"], "type": "publicKey"}, + {"name": "padding2", "type": {"array": ["u64", 4]}}, + {"name": "oracleProducts", "docs": ["the oracle products account"], "type": "publicKey"}, + {"name": "dexMarket", "docs": ["the dex market for this pool"], "type": "publicKey"}, + {"name": "cache", "docs": ["the price cache account"], "type": "publicKey"}, + {"name": "padding3", "type": {"array": ["u64", 8]}}, + {"name": "deposits", "docs": ["the amount of deposits across all nodes"], "type": "i128"}, + {"name": "borrows", "docs": ["the amount of borrows across all nodes"], "type": "i128"}, + {"name": "depositIndex", "docs": ["the deposit index"], "type": "i128"}, + {"name": "borrowIndex", "docs": ["the borrow index"], "type": "i128"}, + {"name": "accumDepositInterestPayment", "docs": ["accumulated deposit interest payments denominated in quote currency"], "type": "i128"}, + {"name": "accumBorrowInterestPayment", "docs": ["accumulated borrow interest payments denominated in quote currency"], "type": "i128"}, + {"name": "indexUpdatedAt", "docs": ["timestamp of the last index update"], "type": "u64"}, + {"name": "protocolFees", "docs": ["protocol fees accumulated so far"], "type": "u64"}, + {"name": "insuranceFund", "docs": ["the insurance fund for this pool"], "type": "u64"}, + {"name": "padding4", "type": {"array": ["u64", 12]}}, + {"name": "nodes", "type": {"array": [{"defined": "NodeInfo"}, 24]}} ] } }, @@ -957,67 +237,14 @@ "type": { "kind": "struct", "fields": [ - { - "name": "market", - "docs": [ - "market this price history is for" - ], - "type": "publicKey" - }, - { - "name": "data", - "docs": [ - "array of price infos." - ], - "type": { - "array": [ - { - "defined": "PriceWithTs" - }, - 14400 - ] - } - }, - { - "name": "config", - "type": { - "defined": "PriceHistoryConfig" - } - }, - { - "name": "longerHead", - "docs": [ - "head of prices for longer time horizon." - ], - "type": "u16" - }, - { - "name": "shorterHead", - "docs": [ - "head of prices for shorter time horizon." - ], - "type": "u16" - }, - { - "name": "tail", - "docs": [ - "tail of prices(most recently added price)." - ], - "type": "u16" - }, - { - "name": "padding1", - "type": "u16" - }, - { - "name": "padding2", - "type": { - "array": [ - "u64", - 8 - ] - } - } + {"name": "market", "docs": ["market this price history is for"], "type": "publicKey"}, + {"name": "data", "docs": ["array of price infos."], "type": {"array": [{"defined": "PriceWithTs"}, 14400]}}, + {"name": "config", "type": {"defined": "PriceHistoryConfig"}}, + {"name": "longerHead", "docs": ["head of prices for longer time horizon."], "type": "u16"}, + {"name": "shorterHead", "docs": ["head of prices for shorter time horizon."], "type": "u16"}, + {"name": "tail", "docs": ["tail of prices(most recently added price)."], "type": "u16"}, + {"name": "padding1", "type": "u16"}, + {"name": "padding2", "type": {"array": ["u64", 8]}} ] } }, @@ -1026,104 +253,17 @@ "type": { "kind": "struct", "fields": [ - { - "name": "bumpSeed", - "docs": [ - "the bump seed" - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "accountNumberSeed", - "docs": [ - "the account number seed" - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "accountType", - "docs": [ - "the account type" - ], - "type": { - "defined": "AccountType" - } - }, - { - "name": "feeTier", - "docs": [ - "the fee tier of this account" - ], - "type": "u8" - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 12 - ] - } - }, - { - "name": "clearing", - "docs": [ - "the clearing this account belongs to" - ], - "type": "publicKey" - }, - { - "name": "authority", - "docs": ["the account's authority, should match sub accounts authority" - ], - "type": "publicKey" - }, - { - "name": "delegate", - "docs": ["the account's delegate" - ], - "type": "publicKey" - }, - { - "name": "subAccountCaches", - "docs": [ - "the sub account cache" - ], - "type": { - "array": [ - { - "defined": "SubAccountCache" - }, - 24 - ] - } - }, - { - "name": "updatedAt", - "docs": [ - "slot of the last account update" - ], - "type": "u64" - }, - { - "name": "padding2", - "type": { - "array": [ - "u8", - 8 - ] - } - } + {"name": "bumpSeed", "docs": ["the bump seed"], "type": {"array": ["u8", 1]}}, + {"name": "accountNumberSeed", "docs": ["the account number seed"], "type": {"array": ["u8", 1]}}, + {"name": "accountType", "docs": ["the account type"], "type": {"defined": "AccountType"}}, + {"name": "feeTier", "docs": ["the fee tier of this account"], "type": "u8"}, + {"name": "padding", "type": {"array": ["u8", 12]}}, + {"name": "clearing", "docs": ["the clearing this account belongs to"], "type": "publicKey"}, + {"name": "authority", "docs": ["the account's authority, should match sub accounts authority"], "type": "publicKey"}, + {"name": "delegate", "docs": ["the account's delegate"], "type": "publicKey"}, + {"name": "subAccountCaches", "docs": ["the sub account cache"], "type": {"array": [{"defined": "SubAccountCache"}, 24]}}, + {"name": "updatedAt", "docs": ["slot of the last account update"], "type": "u64"}, + {"name": "padding2", "type": {"array": ["u8", 8]}} ] } }, @@ -1132,134 +272,20 @@ "type": { "kind": "struct", "fields": [ - { - "name": "bumpSeed", - "docs": [ - "the bump seed" - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "accountNumberSeed", - "docs": [ - "the account number seed" - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "marginingType", - "docs": [ - "the margining type of this account" - ], - "type": { - "defined": "SubAccountMargining" - } - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 13 - ] - } - }, - { - "name": "accountAlias", - "docs": [ - "the alias of the account" - ], - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "clearing", - "docs": [ - "the associated clearing" - ], - "type": "publicKey" - }, - { - "name": "masterAccount", - "docs": [ - "the master account" - ], - "type": "publicKey" - }, - { - "name": "authority", - "docs": [ - "the authority" - ], - "type": "publicKey" - }, - { - "name": "delegate", - "docs": [ - "the delegate" - ], - "type": "publicKey" - }, - { - "name": "updatedAt", - "docs": [ - "the slot of the last update of this account" - ], - "type": "u64" - }, - { - "name": "claimableRewards", - "docs": [ - "the amount of claimable liquidity mining rewards" - ], - "type": "u64" - }, - { - "name": "padding2", - "type": { - "array": [ - "u64", - 7 - ] - } - }, - { - "name": "padding3", - "type": { - "array": [ - "u8", - 8 - ] - } - }, - { - "name": "positions", - "docs": [ - "the positions of this sub account" - ], - "type": { - "array": [ - { - "defined": "PositionSlot" - }, - 24 - ] - } - } + {"name": "bumpSeed", "docs": ["the bump seed"], "type": {"array": ["u8", 1]}}, + {"name": "accountNumberSeed", "docs": ["the account number seed"], "type": {"array": ["u8", 1]}}, + {"name": "marginingType", "docs": ["the margining type of this account"], "type": {"defined": "SubAccountMargining"}}, + {"name": "padding", "type": {"array": ["u8", 13]}}, + {"name": "accountAlias", "docs": ["the alias of the account"], "type": {"array": ["u8", 32]}}, + {"name": "clearing", "docs": ["the associated clearing"], "type": "publicKey"}, + {"name": "masterAccount", "docs": ["the master account"], "type": "publicKey"}, + {"name": "authority", "docs": ["the authority"], "type": "publicKey"}, + {"name": "delegate", "docs": ["the delegate"], "type": "publicKey"}, + {"name": "updatedAt", "docs": ["the slot of the last update of this account"], "type": "u64"}, + {"name": "claimableRewards", "docs": ["the amount of claimable liquidity mining rewards"], "type": "u64"}, + {"name": "padding2", "type": {"array": ["u64", 7]}}, + {"name": "padding3", "type": {"array": ["u8", 8]}}, + {"name": "positions", "docs": ["the positions of this sub account"], "type": {"array": [{"defined": "PositionSlot"}, 24]}} ] } } @@ -1270,225 +296,52 @@ "type": { "kind": "struct", "fields": [ - { - "name": "oracleProducts", - "docs": [ - "the oracle products account that is used to derive this price feed" - ], - "type": "publicKey" - }, - { - "name": "oraclePrice", - "docs": [ - "the latest price" - ], - "type": "i128" - }, - { - "name": "marketPrice", - "docs": [ - "the twap price for the futures market" - ], - "type": "i128" - }, - { - "name": "updatedAt", - "docs": [ - "the slot at which this cache was last updated" - ], - "type": "u64" - }, - { - "name": "padding1", - "type": { - "array": [ - "u8", - 8 - ] - } - }, - { - "name": "depositIndex", - "docs": [ - "the deposit index of the spot token" - ], - "type": "i128" - }, - { - "name": "borrowIndex", - "docs": [ - "the borrow index of the spot token" - ], - "type": "i128" - }, - { - "name": "spotInitAssetWeight", - "docs": [ - "the init asset weight of the spot token" - ], - "type": "u8" - }, - { - "name": "spotMaintAssetWeight", - "docs": [ - "the maint asset weight of the spot token" - ], - "type": "u8" - }, - { - "name": "spotInitLiabWeight", - "docs": [ - "the init liab weight of the spot token" - ], - "type": "u8" - }, - { - "name": "spotMaintLiabWeight", - "docs": [ - "the maint liab weight of the spot token" - ], - "type": "u8" - }, - { - "name": "futuresInitAssetWeight", - "docs": [ - "the init asset weight of the futures position" - ], - "type": "u8" - }, - { - "name": "futuresMaintAssetWeight", - "docs": [ - "the maint asset weight of the futures position" - ], - "type": "u8" - }, - { - "name": "futuresInitLiabWeight", - "docs": [ - "the init liab weight of the futures position" - ], - "type": "u8" - }, - { - "name": "futuresMaintLiabWeight", - "docs": [ - "the maint liab weight of the futures position" - ], - "type": "u8" - }, - { - "name": "perpInitAssetWeight", - "docs": [ - "the init asset weight of the perp position" - ], - "type": "u8" - }, - { - "name": "perpMaintAssetWeight", - "docs": [ - "the maint asset weight of the perp position" - ], - "type": "u8" - }, - { - "name": "perpInitLiabWeight", - "docs": [ - "the init liab weight of the perp position" - ], - "type": "u8" - }, - { - "name": "perpMaintLiabWeight", - "docs": [ - "the maint liab weight of the perp position" - ], - "type": "u8" - }, - { - "name": "decimals", - "docs": [ - "the decimals of the spl token traded on the spot market and available for deposit" - ], - "type": "u8" - }, - { - "name": "futuresDecimals", - "docs": [ - "the decimals of derivative asset for futures markets" - ], - "type": "u8" - }, - { - "name": "perpDecimals", - "docs": [ - "the decimals of derivative asset for perpetual markets" - ], - "type": "u8" - }, - { - "name": "padding2", - "type": { - "array": [ - "u8", - 1 - ] - } - } + {"name": "oracleProducts", "docs": ["the oracle products account that is used to derive this price feed"], "type": "publicKey"}, + {"name": "oraclePrice", "docs": ["the latest price"], "type": "i128"}, + {"name": "marketPrice", "docs": ["the twap price for the futures market"], "type": "i128"}, + {"name": "updatedAt", "docs": ["the slot at which this cache was last updated"], "type": "u64"}, + {"name": "padding1", "type": {"array": ["u8", 8]}}, + {"name": "depositIndex", "docs": ["the deposit index of the spot token"], "type": "i128"}, + {"name": "borrowIndex", "docs": ["the borrow index of the spot token"], "type": "i128"}, + {"name": "spotInitAssetWeight", "docs": ["the init asset weight of the spot token"], "type": "u8"}, + {"name": "spotMaintAssetWeight", "docs": ["the maint asset weight of the spot token"], "type": "u8"}, + {"name": "spotInitLiabWeight", "docs": ["the init liab weight of the spot token"], "type": "u8"}, + {"name": "spotMaintLiabWeight", "docs": ["the maint liab weight of the spot token"], "type": "u8"}, + {"name": "futuresInitAssetWeight", "docs": ["the init asset weight of the futures position"], "type": "u8"}, + {"name": "futuresMaintAssetWeight", "docs": ["the maint asset weight of the futures position"], "type": "u8"}, + {"name": "futuresInitLiabWeight", "docs": ["the init liab weight of the futures position"], "type": "u8"}, + {"name": "futuresMaintLiabWeight", "docs": ["the maint liab weight of the futures position"], "type": "u8"}, + {"name": "perpInitAssetWeight", "docs": ["the init asset weight of the perp position"], "type": "u8"}, + {"name": "perpMaintAssetWeight", "docs": ["the maint asset weight of the perp position"], "type": "u8"}, + {"name": "perpInitLiabWeight", "docs": ["the init liab weight of the perp position"], "type": "u8"}, + {"name": "perpMaintLiabWeight", "docs": ["the maint liab weight of the perp position"], "type": "u8"}, + {"name": "decimals", "docs": ["the decimals of the spl token traded on the spot market and available for deposit"], "type": "u8"}, + {"name": "futuresDecimals", "docs": ["the decimals of derivative asset for futures markets"], "type": "u8"}, + {"name": "perpDecimals", "docs": ["the decimals of derivative asset for perpetual markets"], "type": "u8"}, + {"name": "padding2", "type": {"array": ["u8", 1]}} ] } }, + {"name": "ClearingType", "type": {"kind": "enum", "variants": [{"name": "Public"}, {"name": "Private"}]}}, { "name": "FeeTier", "type": { "kind": "struct", "fields": [ - { - "name": "balance", - "docs": [ - "the balance necessary" - ], - "type": "u64" - }, + {"name": "balance", "docs": ["the balance necessary"], "type": "u64"}, { "name": "makerBps", - "docs": [ - "the maker fee in bps", - "i.e, this value should be zero whenever the maker rebate is supposed to be positive" - ], - "type": "u8" - }, - { - "name": "takerBps", - "docs": [ - "the taker fee in bps" - ], + "docs": ["the maker fee in bps", "i.e, this value should be zero whenever the maker rebate is supposed to be positive"], "type": "u8" }, + {"name": "takerBps", "docs": ["the taker fee in bps"], "type": "u8"}, { "name": "rebateBps", - "docs": [ - "the maker rebate in bps", - "i.e this value should only be positive whenever the maker rate itself is zero" - ], + "docs": ["the maker rebate in bps", "i.e this value should only be positive whenever the maker rate itself is zero"], "type": "u8" }, - { - "name": "tier", - "docs": [ - "the tier identifier, should start at 1" - ], - "type": "u8" - }, - { - "name": "padding1", - "type": { - "array": [ - "u8", - 4 - ] - } - } + {"name": "tier", "docs": ["the tier identifier, should start at 1"], "type": "u8"}, + {"name": "padding1", "type": {"array": ["u8", 4]}} ] } }, @@ -1497,50 +350,47 @@ "type": { "kind": "struct", "fields": [ - { - "name": "maintMargin", - "docs": [ - "the maintenance margin" - ], - "type": "u8" - }, - { - "name": "initMargin", - "docs": [ - "the initialization margin" - ], - "type": "u8" - }, - { - "name": "targetMargin", - "docs": [ - "the target margin used by liquidators" - ], - "type": "u8" - }, - { - "name": "liqLiqorFee", - "docs": [ - "the liquidation fee bonus for the liquidator" - ], - "type": "u8" - }, - { - "name": "liqInsuranceFee", - "docs": [ - "the liquidation fee for the insurance fund" - ], - "type": "u8" - }, - { - "name": "padding1", - "type": { - "array": [ - "u8", - 3 - ] - } - } + {"name": "maintMargin", "docs": ["the maintenance margin"], "type": "u8"}, + {"name": "initMargin", "docs": ["the initialization margin"], "type": "u8"}, + {"name": "targetMargin", "docs": ["the target margin used by liquidators"], "type": "u8"}, + {"name": "liqLiqorFee", "docs": ["the liquidation fee bonus for the liquidator"], "type": "u8"}, + {"name": "liqInsuranceFee", "docs": ["the liquidation fee for the insurance fund"], "type": "u8"}, + {"name": "padding1", "type": {"array": ["u8", 3]}} + ] + } + }, + {"name": "WhitelistStatus", "type": {"kind": "enum", "variants": [{"name": "Pending"}, {"name": "Active"}, {"name": "Revoked"}]}}, + { + "name": "AgnosticMarket", + "type": { + "kind": "struct", + "fields": [ + {"name": "config", "docs": ["the config of the market"], "type": {"defined": "MarketConfig"}}, + {"name": "marketName", "docs": ["the name of the market, which is also used as a seed"], "type": {"array": ["u8", 32]}}, + {"name": "orderbook", "docs": ["the order book for this market"], "type": "publicKey"}, + {"name": "bids", "docs": ["the bids account for this market"], "type": "publicKey"}, + {"name": "asks", "docs": ["the asks account for this market"], "type": "publicKey"}, + {"name": "eventQueue", "docs": ["the asks account for this market"], "type": "publicKey"}, + {"name": "authority", "docs": ["the authority of the market"], "type": "publicKey"}, + {"name": "priceHistory", "docs": ["the price history account for on-chain twap"], "type": "publicKey"}, + {"name": "oracleProducts", "docs": ["the oracle products account"], "type": "publicKey"}, + {"name": "padding1", "type": {"array": ["u64", 8]}}, + {"name": "cache", "docs": ["the cache account"], "type": "publicKey"}, + {"name": "quotePool", "docs": ["the quote pool"], "type": "publicKey"}, + {"name": "padding2", "type": {"array": ["u64", 8]}}, + {"name": "padding3", "type": {"array": ["u64", 2]}}, + {"name": "baseVolume", "docs": ["the market's total historical volume in base token"], "type": "u64"}, + {"name": "quoteVolume", "docs": ["the market's total historical volume in quote token"], "type": "u64"}, + {"name": "liquidityMiningInfo", "docs": ["the current liquidity mining parameters"], "type": {"defined": "LiquidityMiningInfo"}}, + {"name": "minBaseOrderSize", "docs": ["the market's minimum allowed order size in base token amount"], "type": "u64"}, + {"name": "tickSize", "docs": ["the tick size of the market"], "type": "u64"}, + {"name": "baseMultiplier", "docs": ["the base currency multiplier"], "type": "u64"}, + {"name": "quoteMultiplier", "docs": ["the quote currency multiplier"], "type": "u64"}, + {"name": "protocolFees", "docs": ["the currently accumulated trading fees"], "type": "u64"}, + {"name": "insuranceFund", "docs": ["the curently accumulated insurance fund for this market"], "type": "u64"}, + {"name": "maxBaseOrderSize", "docs": ["the maximum order base size for non-postOnly orders"], "type": "u64"}, + {"name": "maxQuoteOrderSize", "docs": ["the maximum order quote size for non-postOnly orders"], "type": "u64"}, + {"name": "padding4", "type": {"array": ["u64", 8]}} ] } }, @@ -1549,35 +399,12 @@ "type": { "kind": "struct", "fields": [ - { - "name": "signerSeeds", - "docs": [ - "the signer seeds for this account" - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "marketType", - "docs": [ - "the type of this market" - ], - "type": { - "defined": "MarketType" - } - }, + {"name": "signerSeeds", "docs": ["the signer seeds for this account"], "type": {"array": ["u8", 1]}}, + {"name": "marketType", "docs": ["the type of this market"], "type": {"defined": "MarketType"}}, { "name": "settlementType", - "docs": [ - "the type of delivery for this market in case it is a futures market" - ], - "type": { - "defined": "SettlementType" - } + "docs": ["the type of delivery for this market in case it is a futures market"], + "type": {"defined": "SettlementType"} }, { "name": "isActive", @@ -1589,421 +416,91 @@ ], "type": "bool" }, - { - "name": "cacheIndex", - "docs": [ - "the cache index for this market" - ], - "type": "u16" - }, - { - "name": "initAssetWeight", - "docs": ["the init asset weight of the pool's positions for margin calculations" - ], - "type": "u8" - }, - { - "name": "initLiabWeight", - "docs": ["the init liability weight of the pool's positions for margin calculations" - ], - "type": "u8" - }, - { - "name": "maintAssetWeight", - "docs": ["the maint asset weight of the pool's positions for margin calculations" - ], - "type": "u8" - }, - { - "name": "maintLiabWeight", - "docs": ["the maint liability weight of the pool's positions for margin calculations" - ], - "type": "u8" - }, - { - "name": "decimals", - "docs": ["the decimals used for the target oracle price of this pool's asset" - ], - "type": "u8" - }, - { - "name": "operatingStatus", - "docs": [ - "the operating status of the market" - ], - "type": { - "defined": "OperatingStatus" - } - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 4 - ] - } - } + {"name": "cacheIndex", "docs": ["the cache index for this market"], "type": "u16"}, + {"name": "initAssetWeight", "docs": ["the init asset weight of the pool's positions for margin calculations"], "type": "u8"}, + {"name": "initLiabWeight", "docs": ["the init liability weight of the pool's positions for margin calculations"], "type": "u8"}, + {"name": "maintAssetWeight", "docs": ["the maint asset weight of the pool's positions for margin calculations"], "type": "u8"}, + {"name": "maintLiabWeight", "docs": ["the maint liability weight of the pool's positions for margin calculations"], "type": "u8"}, + {"name": "decimals", "docs": ["the decimals used for the target oracle price of this pool's asset"], "type": "u8"}, + {"name": "operatingStatus", "docs": ["the operating status of the market"], "type": {"defined": "OperatingStatus"}}, + {"name": "padding", "type": {"array": ["u8", 4]}} ] } }, + { + "name": "MarketType", + "docs": ["market types"], + "type": { + "kind": "enum", + "variants": [{"name": "Default"}, {"name": "PairFuture"}, {"name": "PerpetualFuture"}, {"name": "PreIDO"}, {"name": "IndexFuture"}] + } + }, + { + "name": "SettlementType", + "docs": ["settlement types for futures markets"], + "type": {"kind": "enum", "variants": [{"name": "CashSettled"}, {"name": "PhysicalDelivery"}]} + }, + { + "name": "OperatingStatus", + "type": {"kind": "enum", "variants": [{"name": "Active"}, {"name": "ReduceOnly"}, {"name": "CancelOnly"}, {"name": "Halted"}]} + }, { "name": "LiquidityMiningInfo", "type": { "kind": "struct", "fields": [ - { - "name": "tokenMint", - "docs": [ - "the token mint of the token being used for rewards" - ], - "type": "publicKey" - }, - { - "name": "rate", - "docs": [ - "the rate that is used to convert liquidity points to the LM reward token" - ], - "type": "i128" - }, - { - "name": "maxDepthBps", - "docs": [ - "max depth on the book in bps" - ], - "type": "i128" - }, - { - "name": "periodStart", - "docs": [ - "timestamp of the start of the liquidity mining incentive period" - ], - "type": "u64" - }, - { - "name": "targetPeriodLength", - "docs": [ - "target time length for a liquidity mining period" - ], - "type": "u64" - }, - { - "name": "tokensLeft", - "docs": [ - "tokens left for this period." - ], - "type": "u64" - }, - { - "name": "tokensPerPeriod", - "docs": [ - "total amount of tokens allocated for a given period" - ], - "type": "u64" - }, - { - "name": "minRateAdj", - "docs": [ - "the minimum rate adjustment" - ], - "type": "u64" - }, - { - "name": "maxRateAdj", - "docs": [ - "the maximum rate adjusment" - ], - "type": "u64" - }, - { - "name": "sizeCutoff", - "docs": [ - "the size cut off for rewards" - ], - "type": "u64" - }, - { - "name": "tokenDecimals", - "docs": [ - "the decimals of the token being rewarded" - ], - "type": "u8" - }, - { - "name": "padding1", - "type": { - "array": [ - "u8", - 7 - ] - } - } - ] - } - }, - { - "name": "AgnosticMarket", - "type": { - "kind": "struct", - "fields": [ - { - "name": "config", - "docs": [ - "the config of the market" - ], - "type": { - "defined": "MarketConfig" - } - }, - { - "name": "marketName", - "docs": [ - "the name of the market, which is also used as a seed" - ], - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "orderbook", - "docs": [ - "the order book for this market" - ], - "type": "publicKey" - }, - { - "name": "bids", - "docs": [ - "the bids account for this market" - ], - "type": "publicKey" - }, - { - "name": "asks", - "docs": [ - "the asks account for this market" - ], - "type": "publicKey" - }, - { - "name": "eventQueue", - "docs": [ - "the asks account for this market" - ], - "type": "publicKey" - }, - { - "name": "authority", - "docs": [ - "the authority of the market" - ], - "type": "publicKey" - }, - { - "name": "priceHistory", - "docs": [ - "the price history account for on-chain twap" - ], - "type": "publicKey" - }, - { - "name": "oracleProducts", - "docs": [ - "the oracle products account" - ], - "type": "publicKey" - }, - { - "name": "padding1", - "type": { - "array": [ - "u64", - 8 - ] - } - }, - { - "name": "cache", - "docs": [ - "the cache account" - ], - "type": "publicKey" - }, - { - "name": "quotePool", - "docs": [ - "the quote pool" - ], - "type": "publicKey" - }, - { - "name": "padding2", - "type": { - "array": [ - "u64", - 8 - ] - } - }, - { - "name": "padding3", - "type": { - "array": [ - "u64", - 2 - ] - } - }, - { - "name": "baseVolume", - "docs": ["the market's total historical volume in base token" - ], - "type": "u64" - }, - { - "name": "quoteVolume", - "docs": ["the market's total historical volume in quote token" - ], - "type": "u64" - }, - { - "name": "liquidityMiningInfo", - "docs": [ - "the current liquidity mining parameters" - ], - "type": { - "defined": "LiquidityMiningInfo" - } - }, - { - "name": "minBaseOrderSize", - "docs": ["the market's minimum allowed order size in base token amount" - ], - "type": "u64" - }, - { - "name": "tickSize", - "docs": [ - "the tick size of the market" - ], - "type": "u64" - }, - { - "name": "baseMultiplier", - "docs": [ - "the base currency multiplier" - ], - "type": "u64" - }, - { - "name": "quoteMultiplier", - "docs": [ - "the quote currency multiplier" - ], - "type": "u64" - }, - { - "name": "protocolFees", - "docs": [ - "the currently accumulated trading fees" - ], - "type": "u64" - }, - { - "name": "insuranceFund", - "docs": [ - "the curently accumulated insurance fund for this market" - ], - "type": "u64" - }, - { - "name": "maxBaseOrderSize", - "docs": [ - "the maximum order base size for non-postOnly orders" - ], - "type": "u64" - }, - { - "name": "maxQuoteOrderSize", - "docs": [ - "the maximum order quote size for non-postOnly orders" - ], - "type": "u64" - }, - { - "name": "padding4", - "type": { - "array": [ - "u64", - 8 - ] - } - } + {"name": "tokenMint", "docs": ["the token mint of the token being used for rewards"], "type": "publicKey"}, + {"name": "rate", "docs": ["the rate that is used to convert liquidity points to the LM reward token"], "type": "i128"}, + {"name": "maxDepthBps", "docs": ["max depth on the book in bps"], "type": "i128"}, + {"name": "periodStart", "docs": ["timestamp of the start of the liquidity mining incentive period"], "type": "u64"}, + {"name": "targetPeriodLength", "docs": ["target time length for a liquidity mining period"], "type": "u64"}, + {"name": "tokensLeft", "docs": ["tokens left for this period."], "type": "u64"}, + {"name": "tokensPerPeriod", "docs": ["total amount of tokens allocated for a given period"], "type": "u64"}, + {"name": "minRateAdj", "docs": ["the minimum rate adjustment"], "type": "u64"}, + {"name": "maxRateAdj", "docs": ["the maximum rate adjusment"], "type": "u64"}, + {"name": "sizeCutoff", "docs": ["the size cut off for rewards"], "type": "u64"}, + {"name": "tokenDecimals", "docs": ["the decimals of the token being rewarded"], "type": "u8"}, + {"name": "padding1", "type": {"array": ["u8", 7]}} ] } }, + {"name": "ProductsType", "type": {"kind": "enum", "variants": [{"name": "Stub"}, {"name": "Pyth"}, {"name": "Switchboard"}]}}, { "name": "OpenOrder", "type": { "kind": "struct", "fields": [ - { - "name": "side", - "docs": [ - "the side of the order" - ], - "type": { - "defined": "Side" - } - }, - { - "name": "subAccountIdx", - "docs": [ - "the sub account idx" - ], - "type": "u8" - }, - { - "name": "orderType", - "docs": [ - "the type of the order" - ], - "type": { - "defined": "DerivativeOrderType" - } - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 5 - ] - } - }, - { - "name": "timestamp", - "docs": [ - "the timestamp that the order was posted" - ], - "type": "u64" - }, - { - "name": "clientOrderId", - "docs": ["the client's order id" - ], - "type": "u64" - }, - { - "name": "orderId", - "docs": [ - "the order id after being posted on the book" - ], - "type": "u128" - } + {"name": "side", "docs": ["the side of the order"], "type": {"defined": "Side"}}, + {"name": "subAccountIdx", "docs": ["the sub account idx"], "type": "u8"}, + {"name": "orderType", "docs": ["the type of the order"], "type": {"defined": "DerivativeOrderType"}}, + {"name": "padding", "type": {"array": ["u8", 5]}}, + {"name": "timestamp", "docs": ["the timestamp that the order was posted"], "type": "u64"}, + {"name": "clientOrderId", "docs": ["the client's order id"], "type": "u64"}, + {"name": "orderId", "docs": ["the order id after being posted on the book"], "type": "u128"} + ] + } + }, + {"name": "Side", "type": {"kind": "enum", "variants": [{"name": "Bid"}, {"name": "Ask"}]}}, + { + "name": "DerivativeOrderType", + "type": {"kind": "enum", "variants": [{"name": "Limit"}, {"name": "ImmediateOrCancel"}, {"name": "FillOrKill"}, {"name": "PostOnly"}]} + }, + { + "name": "PoolConfig", + "type": { + "kind": "struct", + "fields": [ + {"name": "optimalUtil", "docs": ["optimal utilization ratio for this token"], "type": "u16"}, + {"name": "optimalApr", "docs": ["optimal apr for this token"], "type": "u16"}, + {"name": "maxApr", "docs": ["maximum apr for this token"], "type": "u16"}, + {"name": "cacheIndex", "docs": ["the index of this pool in the cache"], "type": "u16"}, + {"name": "decimals", "docs": ["the decimals of the spl token mint associated with the pool"], "type": "u8"}, + {"name": "initAssetWeight", "docs": ["the init asset weight of the pool's positions for margin calculations"], "type": "u8"}, + {"name": "initLiabWeight", "docs": ["the init liability weight of the pool's positions for margin calculations"], "type": "u8"}, + {"name": "maintAssetWeight", "docs": ["the maint asset weight of the pool's positions for margin calculations"], "type": "u8"}, + {"name": "maintLiabWeight", "docs": ["the maint liability weight of the pool's positions for margin calculations"], "type": "u8"}, + {"name": "padding2", "type": {"array": ["u8", 3]}}, + {"name": "padding3", "type": {"array": ["u64", 2]}} ] } }, @@ -2012,258 +509,51 @@ "type": { "kind": "struct", "fields": [ - { - "name": "poolNode", - "docs": ["the node's pubkey" - ], - "type": "publicKey" - }, - { - "name": "nodeVault", - "docs": ["the node's vault pubkey" - ], - "type": "publicKey" - }, - { - "name": "deposits", - "docs": [ - "the deposits in the node" - ], - "type": "i128" - }, - { - "name": "borrows", - "docs": [ - "the borrows in the node" - ], - "type": "i128" - }, - { - "name": "padding", - "type": { - "array": [ - "u64", - 4 - ] - } - } - ] - } - }, - { - "name": "PoolConfig", - "type": { - "kind": "struct", - "fields": [ - { - "name": "optimalUtil", - "docs": [ - "optimal utilization ratio for this token" - ], - "type": "u16" - }, - { - "name": "optimalApr", - "docs": [ - "optimal apr for this token" - ], - "type": "u16" - }, - { - "name": "maxApr", - "docs": [ - "maximum apr for this token" - ], - "type": "u16" - }, - { - "name": "cacheIndex", - "docs": [ - "the index of this pool in the cache" - ], - "type": "u16" - }, - { - "name": "decimals", - "docs": [ - "the decimals of the spl token mint associated with the pool" - ], - "type": "u8" - }, - { - "name": "initAssetWeight", - "docs": ["the init asset weight of the pool's positions for margin calculations" - ], - "type": "u8" - }, - { - "name": "initLiabWeight", - "docs": ["the init liability weight of the pool's positions for margin calculations" - ], - "type": "u8" - }, - { - "name": "maintAssetWeight", - "docs": ["the maint asset weight of the pool's positions for margin calculations" - ], - "type": "u8" - }, - { - "name": "maintLiabWeight", - "docs": ["the maint liability weight of the pool's positions for margin calculations" - ], - "type": "u8" - }, - { - "name": "padding2", - "type": { - "array": [ - "u8", - 3 - ] - } - }, - { - "name": "padding3", - "type": { - "array": [ - "u64", - 2 - ] - } - } + {"name": "poolNode", "docs": ["the node's pubkey"], "type": "publicKey"}, + {"name": "nodeVault", "docs": ["the node's vault pubkey"], "type": "publicKey"}, + {"name": "deposits", "docs": ["the deposits in the node"], "type": "i128"}, + {"name": "borrows", "docs": ["the borrows in the node"], "type": "i128"}, + {"name": "padding", "type": {"array": ["u64", 4]}} ] } }, + {"name": "PriceWithTs", "type": {"kind": "struct", "fields": [{"name": "price", "type": "i128"}, {"name": "timestamp", "type": "u64"}]}}, { "name": "PriceHistoryConfig", "type": { "kind": "struct", "fields": [ - { - "name": "longerTimeHorizon", - "type": "u64" - }, - { - "name": "shorterTimeHorizon", - "type": "u64" - }, - { - "name": "priceCollectionTick", - "type": "u64" - } - ] - } - }, - { - "name": "PriceWithTs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "price", - "type": "i128" - }, - { - "name": "timestamp", - "type": "u64" - } + {"name": "longerTimeHorizon", "type": "u64"}, + {"name": "shorterTimeHorizon", "type": "u64"}, + {"name": "priceCollectionTick", "type": "u64"} ] } }, + {"name": "AccountType", "type": {"kind": "enum", "variants": [{"name": "Regular"}, {"name": "Whitelisted"}]}}, { "name": "SubAccountCache", "type": { "kind": "struct", "fields": [ - { - "name": "assetsValue", - "docs": [ - "the value of the assets of this account" - ], - "type": "i128" - }, - { - "name": "liabilitiesValue", - "docs": [ - "the value of the liabilities of this account" - ], - "type": "i128" - }, - { - "name": "cRatio", - "docs": [ - "the margin c-ratio of this sub account" - ], - "type": "i128" - }, - { - "name": "updatedAt", - "docs": [ - "slot of the last cache update" - ], - "type": "u64" - }, - { - "name": "margining", - "docs": [ - "the sub account margining" - ], - "type": { - "defined": "SubAccountMargining" - } - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 7 - ] - } - }, - { - "name": "subAccount", - "docs": [ - "the sub account" - ], - "type": "publicKey" - }, - { - "name": "padding2", - "type": { - "array": [ - "u64", - 4 - ] - } - } + {"name": "assetsValue", "docs": ["the value of the assets of this account"], "type": "i128"}, + {"name": "liabilitiesValue", "docs": ["the value of the liabilities of this account"], "type": "i128"}, + {"name": "cRatio", "docs": ["the margin c-ratio of this sub account"], "type": "i128"}, + {"name": "updatedAt", "docs": ["slot of the last cache update"], "type": "u64"}, + {"name": "margining", "docs": ["the sub account margining"], "type": {"defined": "SubAccountMargining"}}, + {"name": "padding", "type": {"array": ["u8", 7]}}, + {"name": "subAccount", "docs": ["the sub account"], "type": "publicKey"}, + {"name": "padding2", "type": {"array": ["u64", 4]}} ] } }, + {"name": "SubAccountMargining", "type": {"kind": "enum", "variants": [{"name": "Cross"}, {"name": "Isolated"}]}}, { "name": "PositionSlot", "type": { "kind": "struct", "fields": [ - { - "name": "spot", - "docs": [ - "the spot position" - ], - "type": { - "defined": "SpotPosition" - } - }, - { - "name": "derivative", - "docs": [ - "the derivative position" - ], - "type": { - "defined": "DerivativePosition" - } - } + {"name": "spot", "docs": ["the spot position"], "type": {"defined": "SpotPosition"}}, + {"name": "derivative", "docs": ["the derivative position"], "type": {"defined": "DerivativePosition"}} ] } }, @@ -2272,117 +562,18 @@ "type": { "kind": "struct", "fields": [ - { - "name": "tokenMint", - "docs": [ - "the token mint that this position pertains to" - ], - "type": "publicKey" - }, + {"name": "tokenMint", "docs": ["the token mint that this position pertains to"], "type": "publicKey"}, { "name": "position", "docs": [ - "the position denominated in the base token","if this value is negative then the outstanding position is a short, otherwise it's a long" + "the position denominated in the base token", + "if this value is negative then the outstanding position is a short, otherwise it's a long" ], "type": "i128" }, - { - "name": "openOrdersCache", - "docs": [ - "the open orders cache" - ], - "type": { - "defined": "OpenOrdersCache" - } - }, - { - "name": "cacheIndex", - "docs": [ - "the index of this position in the cache" - ], - "type": "u16" - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 6 - ] - } - } - ] - } - }, - { - "name": "DerivativePosition", - "type": { - "kind": "struct", - "fields": [ - { - "name": "market", - "docs": [ - "the public key of the market that this position pertains to" - ], - "type": "publicKey" - }, - { - "name": "basePosition", - "docs": [ - "the position denominated in the base token","if this value is negative then the outstanding position is a short, otherwise it's a long" - ], - "type": "i128" - }, - { - "name": "openOrdersCache", - "docs": [ - "the open orders cache" - ], - "type": { - "defined": "OpenOrdersCache" - } - }, - { - "name": "longFundingSettled", - "docs": [ - "the long funding that has been settled for this position" - ], - "type": "i128" - }, - { - "name": "shortFundingSettled", - "docs": [ - "the short funding that has been settled for this position" - ], - "type": "i128" - }, - { - "name": "cacheIndex", - "docs": [ - "the index of this position in the cache" - ], - "type": "u16" - }, - { - "name": "marketType", - "docs": [ - "the type of market of this position", - "", - "this is necessary in order to fetch the appropriate weights" - ], - "type": { - "defined": "MarketType" - } - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 5 - ] - } - } + {"name": "openOrdersCache", "docs": ["the open orders cache"], "type": {"defined": "OpenOrdersCache"}}, + {"name": "cacheIndex", "docs": ["the index of this position in the cache"], "type": "u16"}, + {"name": "padding", "type": {"array": ["u8", 6]}} ] } }, @@ -2393,229 +584,44 @@ "fields": [ { "name": "coinTotal", - "docs": [ - "total amount of native base tokens in the open orders account, includes locked and free tokens" - ], - "type": "u64" - }, - { - "name": "coinFree", - "docs": [ - "amount of free native base tokens in the open orders account" - ], + "docs": ["total amount of native base tokens in the open orders account, includes locked and free tokens"], "type": "u64" }, + {"name": "coinFree", "docs": ["amount of free native base tokens in the open orders account"], "type": "u64"}, { "name": "pcTotal", - "docs": [ - "total amount of native quote tokens in the open orders account, includes locked and free tokens" - ], + "docs": ["total amount of native quote tokens in the open orders account, includes locked and free tokens"], "type": "u64" }, + {"name": "pcFree", "docs": ["amount of free native quote tokens in the open orders account"], "type": "u64"}, + {"name": "referrerRebatesAccrued", "docs": ["the amount of referrer rebates accrued, in native quote token"], "type": "u64"} + ] + } + }, + { + "name": "DerivativePosition", + "type": { + "kind": "struct", + "fields": [ + {"name": "market", "docs": ["the public key of the market that this position pertains to"], "type": "publicKey"}, { - "name": "pcFree", + "name": "basePosition", "docs": [ - "amount of free native quote tokens in the open orders account" + "the position denominated in the base token", + "if this value is negative then the outstanding position is a short, otherwise it's a long" ], - "type": "u64" + "type": "i128" }, + {"name": "openOrdersCache", "docs": ["the open orders cache"], "type": {"defined": "OpenOrdersCache"}}, + {"name": "longFundingSettled", "docs": ["the long funding that has been settled for this position"], "type": "i128"}, + {"name": "shortFundingSettled", "docs": ["the short funding that has been settled for this position"], "type": "i128"}, + {"name": "cacheIndex", "docs": ["the index of this position in the cache"], "type": "u16"}, { - "name": "referrerRebatesAccrued", - "docs": [ - "the amount of referrer rebates accrued, in native quote token" - ], - "type": "u64" - } - ] - } - }, - { - "name": "OrderType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Limit" + "name": "marketType", + "docs": ["the type of market of this position", "", "this is necessary in order to fetch the appropriate weights"], + "type": {"defined": "MarketType"} }, - { - "name": "ImmediateOrCancel" - }, - { - "name": "PostOnly" - } - ] - } - }, - { - "name": "DerivativeOrderType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Limit" - }, - { - "name": "ImmediateOrCancel" - }, - { - "name": "FillOrKill" - }, - { - "name": "PostOnly" - } - ] - } - }, - { - "name": "Side", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Bid" - }, - { - "name": "Ask" - } - ] - } - }, - { - "name": "ClearingType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Public" - }, - { - "name": "Private" - } - ] - } - }, - { - "name": "WhitelistStatus", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Pending" - }, - { - "name": "Active" - }, - { - "name": "Revoked" - } - ] - } - }, - { - "name": "MarketType", - "docs": [ - "market types" - ], - "type": { - "kind": "enum", - "variants": [ - { - "name": "Default" - }, - { - "name": "PairFuture" - }, - { - "name": "PerpetualFuture" - }, - { - "name": "PreIDO" - }, - { - "name": "IndexFuture" - } - ] - } - }, - { - "name": "SettlementType", - "docs": [ - "settlement types for futures markets" - ], - "type": { - "kind": "enum", - "variants": [ - { - "name": "CashSettled" - }, - { - "name": "PhysicalDelivery" - } - ] - } - }, - { - "name": "ProductsType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Stub" - }, - { - "name": "Pyth" - }, - { - "name": "Switchboard" - } - ] - } - }, - { - "name": "SubAccountMargining", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Cross" - }, - { - "name": "Isolated" - } - ] - } - }, - { - "name": "AccountType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Regular" - }, - { - "name": "Whitelisted" - } - ] - } - }, - { - "name": "OperatingStatus", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Active" - }, - { - "name": "ReduceOnly" - }, - { - "name": "CancelOnly" - }, - { - "name": "Halted" - } + {"name": "padding", "type": {"array": ["u8", 5]}} ] } } diff --git a/projects/cypher-trade/index.js b/projects/cypher-trade/index.js index 8430131b3..dcefadbf8 100644 --- a/projects/cypher-trade/index.js +++ b/projects/cypher-trade/index.js @@ -1,23 +1,6 @@ -const { Program } = require("@project-serum/anchor"); -const { getProvider, sumTokens2, } = require("../helper/solana"); -const idl = require('./idl.json') - -async function tvl() { - const provider = getProvider() - const program = new Program(idl, 'CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3', provider) - const pools = await program.account.pool.all() - const tokenAccounts = pools.map(({ account }) => { - return account.nodes.map(i => i.nodeVault.toString()).filter(i => i !== '11111111111111111111111111111111') - }).flat() - return sumTokens2({ tokenAccounts}) -} - module.exports = { - // hallmarks: [ - // [1691373600,"exploit/security incident"] //https://twitter.com/cypher_protocol/status/1688641036476731393 - // ], deadFrom: '2023-08-07', timetravel: false, - solana: { tvl, }, + solana: { tvl: () => ({}), }, } diff --git a/projects/knightrade/index.js b/projects/knightrade/index.js index 08ff2bcb8..456c78444 100644 --- a/projects/knightrade/index.js +++ b/projects/knightrade/index.js @@ -66,36 +66,36 @@ async function tvlSolana(api) { const idl = require("./drift_idl.json") const programId = new PublicKey('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH') const provider = getProvider() - const program = new Program(idl, programId, provider) + const program = new Program(idl, programId, provider) for (const account of accounts) { - const userData = program.coder.accounts.decode("User", account.data); - for (const spotPosition of userData.spotPositions) { - if (!new BN(spotPosition.scaledBalance).isZero()) { - const marketIndex = spotPosition.marketIndex - const balanceType = Object.keys(spotPosition.balanceType ?? {})?.[0] - const scaledBalance = new BN(spotPosition.scaledBalance) - const token = getTokenInfo(true, marketIndex) - if (!token) continue; - const balance = scaledBalance - .mul(new BN(balanceType === 'deposit' ? 1 : -1)) - .div(new BN(10).pow(new BN(token.decimals - 9))); - - api.add(token.mint, balance.toString()) - } + const userData = program.coder.accounts.decode("User", account.data); + for (const spotPosition of userData.spotPositions) { + if (!new BN(spotPosition.scaledBalance).isZero()) { + const marketIndex = spotPosition.marketIndex + const balanceType = Object.keys(spotPosition.balanceType ?? {})?.[0] + const scaledBalance = new BN(spotPosition.scaledBalance) + const token = getTokenInfo(true, marketIndex) + if (!token) continue; + const balance = scaledBalance + .mul(new BN(balanceType === 'deposit' ? 1 : -1)) + .div(new BN(10).pow(new BN(token.decimals - 9))); + + api.add(token.mint, balance.toString()) } - for (const perpPosition of userData.perpPositions) { - if (!new BN(perpPosition.baseAssetAmount).isZero()) { - const marketIndex = perpPosition.marketIndex - const token = getTokenInfo(false, marketIndex) - if (!token) continue; - const baseAssetAmount = new BN(perpPosition.baseAssetAmount) - .div(new BN(10).pow(new BN(token.decimals - 9))); - const quoteAssetAmount = new BN(perpPosition.quoteAssetAmount) - api.add(TOKEN_INFO['USDC'].mint, quoteAssetAmount.toString()) - api.add(token.mint, baseAssetAmount.toString()) - } + } + for (const perpPosition of userData.perpPositions) { + if (!new BN(perpPosition.baseAssetAmount).isZero()) { + const marketIndex = perpPosition.marketIndex + const token = getTokenInfo(false, marketIndex) + if (!token) continue; + const baseAssetAmount = new BN(perpPosition.baseAssetAmount) + .div(new BN(10).pow(new BN(token.decimals - 9))); + const quoteAssetAmount = new BN(perpPosition.quoteAssetAmount) + api.add(TOKEN_INFO['USDC'].mint, quoteAssetAmount.toString()) + api.add(token.mint, baseAssetAmount.toString()) } + } } } @@ -124,54 +124,54 @@ async function tvlArbitrum(api) { const v2ReaderAbi = require('./v2_reader_abi.json'); const v2ReaderAddress = '0xf60becbba223EEA9495Da3f606753867eC10d139'; const dataStoreAddress = '0xFD70de6b91282D8017aA4E741e9Ae325CAb992d8'; - - const getAccountPositionsAbi = v2ReaderAbi.find(f => f.name === 'getAccountPositions'); - const getMarketsAbi = v2ReaderAbi.find(f => f.name === 'getMarkets'); const markets = await api.call({ - abi: getMarketsAbi, + abi: v2ReaderAbi.getMarkets, target: v2ReaderAddress, params: [dataStoreAddress, 0, 32] - }); + }) + const marketToTokenMap = {}; for (const market of markets) { marketToTokenMap[market[0]] = market[1]; } - for (const vault of vaults) { - await api.sumTokens({ - tokensAndOwners: [ - // Wallet - [ADDRESSES.arbitrum.USDC, vault], - [ADDRESSES.arbitrum.USDT, vault], - [ADDRESSES.arbitrum.USDC_CIRCLE, vault], - [ADDRESSES.arbitrum.WETH, vault], - [ADDRESSES.null, vault], - [ADDRESSES.arbitrum.WBTC, vault], - // GMXv2 Earn - [addresses.gmWeth, vault], - [addresses.gmBtc, vault], - // Aave - [addresses.aaveEthAToken, vault], - [addresses.aaveBtcAToken, vault], - [addresses.aaveUsdcAToken, vault], - [addresses.aaveEthDebtToken, vault], - [addresses.aaveBtcDebtToken, vault], - [addresses.aaveUsdcDebtToken, vault], - ] - }); - // GMXv2 Trade - const positions = await api.call({ - abi: getAccountPositionsAbi, - target: v2ReaderAddress, - params: [dataStoreAddress, vault, 0, 999999999999] - }); - for (const pos of positions) { - // collateral - await api.add(pos.addresses.collateralToken, pos.numbers.collateralAmount); - // pnl = sizeInTokens * tokenPrice - sizeInUsd - await api.add(marketToTokenMap[pos.addresses.market], pos.numbers.sizeInTokens); - await api.add(ADDRESSES.arbitrum.USDC_CIRCLE, -pos.numbers.sizeInUsd * 1e-24); - } + await api.sumTokens({ + tokens: [ + // Wallet + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.WETH, + ADDRESSES.null, + ADDRESSES.arbitrum.WBTC, + // GMXv2 Earn + addresses.gmWeth, + addresses.gmBtc, + // Aave + addresses.aaveEthAToken, + addresses.aaveBtcAToken, + addresses.aaveUsdcAToken, + addresses.aaveEthDebtToken, + addresses.aaveBtcDebtToken, + addresses.aaveUsdcDebtToken, + ], + owners: vaults + }) + + // GMXv2 Trade + const calls = vaults.map(vault => ({ params: [dataStoreAddress, vault, 0, 999999999999], })) + const positions = await api.multiCall({ + abi: v2ReaderAbi.getAccountPositions, + target: v2ReaderAddress, + calls, + }); + for (const pos of positions) { + if (!pos || !pos.addresses || !pos.numbers) continue; + // collateral + api.add(pos.addresses.collateralToken, pos.numbers.collateralAmount); + // pnl = sizeInTokens * tokenPrice - sizeInUsd + api.add(marketToTokenMap[pos.addresses.market], pos.numbers.sizeInTokens); + api.add(ADDRESSES.arbitrum.USDC_CIRCLE, -pos.numbers.sizeInUsd * 1e-24); } } diff --git a/projects/knightrade/v2_reader_abi.json b/projects/knightrade/v2_reader_abi.json index 7a6a0474d..2be1fc0be 100644 --- a/projects/knightrade/v2_reader_abi.json +++ b/projects/knightrade/v2_reader_abi.json @@ -1,3748 +1,4 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "DisabledMarket", - "type": "error" - }, - { - "inputs": [], - "name": "EmptyMarket", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getAccountOrders", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct Order.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct Order.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isFrozen", - "type": "bool" - } - ], - "internalType": "struct Order.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Order.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract IReferralStorage", - "name": "referralStorage", - "type": "address" - }, - { - "internalType": "bytes32[]", - "name": "positionKeys", - "type": "bytes32[]" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices[]", - "name": "prices", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - } - ], - "name": "getAccountPositionInfoList", - "outputs": [ - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralToken", - "type": "address" - } - ], - "internalType": "struct Position.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "increasedAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decreasedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct Position.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "internalType": "struct Position.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Position.Props", - "name": "position", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "affiliate", - "type": "address" - }, - { - "internalType": "address", - "name": "trader", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalRebateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalRebateAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "affiliateRewardAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionReferralFees", - "name": "referral", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "fundingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestFundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestLongTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestShortTokenClaimableFundingAmountPerSize", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFundingFees", - "name": "funding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "borrowingFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmountForFeeReceiver", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionBorrowingFees", - "name": "borrowing", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "uiFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "uiFeeAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionUiFees", - "name": "ui", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "collateralTokenPrice", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "positionFeeFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "protocolFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeReceiverAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmountExcludingFunding", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFees", - "name": "fees", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "int256", - "name": "priceImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "priceImpactDiffUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionPrice", - "type": "uint256" - } - ], - "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", - "name": "executionPriceResult", - "type": "tuple" - }, - { - "internalType": "int256", - "name": "basePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "uncappedBasePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "pnlAfterPriceImpactUsd", - "type": "int256" - } - ], - "internalType": "struct ReaderUtils.PositionInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getAccountPositions", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralToken", - "type": "address" - } - ], - "internalType": "struct Position.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "increasedAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decreasedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct Position.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "internalType": "struct Position.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Position.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - } - ], - "name": "getAdlState", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getDeposit", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialLongToken", - "type": "address" - }, - { - "internalType": "address", - "name": "initialShortToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct Deposit.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "initialLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minMarketTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - } - ], - "internalType": "struct Deposit.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - } - ], - "internalType": "struct Deposit.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Deposit.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "longTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenAmount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - } - ], - "name": "getDepositAmountOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "marketKey", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "positionSizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionSizeInTokens", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "sizeDeltaUsd", - "type": "int256" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "name": "getExecutionPrice", - "outputs": [ - { - "components": [ - { - "internalType": "int256", - "name": "priceImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "priceImpactDiffUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionPrice", - "type": "uint256" - } - ], - "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "key", - "type": "address" - } - ], - "name": "getMarket", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - } - ], - "name": "getMarketBySalt", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "address", - "name": "marketKey", - "type": "address" - } - ], - "name": "getMarketInfo", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "borrowingFactorPerSecondForLongs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFactorPerSecondForShorts", - "type": "uint256" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "fundingFeeAmountPerSize", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "claimableFundingAmountPerSize", - "type": "tuple" - } - ], - "internalType": "struct ReaderUtils.BaseFundingValues", - "name": "baseFunding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "longsPayShorts", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "fundingFactorPerSecond", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "nextSavedFundingFactorPerSecond", - "type": "int256" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "fundingFeeAmountPerSizeDelta", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "claimableFundingAmountPerSizeDelta", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.GetNextFundingAmountPerSizeResult", - "name": "nextFunding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "virtualPoolAmountForLongToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "virtualPoolAmountForShortToken", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "virtualInventoryForPositions", - "type": "int256" - } - ], - "internalType": "struct ReaderUtils.VirtualInventory", - "name": "virtualInventory", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isDisabled", - "type": "bool" - } - ], - "internalType": "struct ReaderUtils.MarketInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices[]", - "name": "marketPricesList", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getMarketInfoList", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "borrowingFactorPerSecondForLongs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFactorPerSecondForShorts", - "type": "uint256" - }, - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "fundingFeeAmountPerSize", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "claimableFundingAmountPerSize", - "type": "tuple" - } - ], - "internalType": "struct ReaderUtils.BaseFundingValues", - "name": "baseFunding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "longsPayShorts", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "fundingFactorPerSecond", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "nextSavedFundingFactorPerSecond", - "type": "int256" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "fundingFeeAmountPerSizeDelta", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "long", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "longToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortToken", - "type": "uint256" - } - ], - "internalType": "struct MarketUtils.CollateralType", - "name": "short", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.PositionType", - "name": "claimableFundingAmountPerSizeDelta", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.GetNextFundingAmountPerSizeResult", - "name": "nextFunding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "virtualPoolAmountForLongToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "virtualPoolAmountForShortToken", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "virtualInventoryForPositions", - "type": "int256" - } - ], - "internalType": "struct ReaderUtils.VirtualInventory", - "name": "virtualInventory", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isDisabled", - "type": "bool" - } - ], - "internalType": "struct ReaderUtils.MarketInfo[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - }, - { - "internalType": "bytes32", - "name": "pnlFactorType", - "type": "bytes32" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getMarketTokenPrice", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "components": [ - { - "internalType": "int256", - "name": "poolValue", - "type": "int256" - }, - { - "internalType": "int256", - "name": "longPnl", - "type": "int256" - }, - { - "internalType": "int256", - "name": "shortPnl", - "type": "int256" - }, - { - "internalType": "int256", - "name": "netPnl", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "longTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowingFees", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeePoolFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "impactPoolAmount", - "type": "uint256" - } - ], - "internalType": "struct MarketPoolValueInfo.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "uint256", - "name": "start", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "end", - "type": "uint256" - } - ], - "name": "getMarkets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getNetPnl", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getOpenInterestWithPnl", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getOrder", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "initialCollateralToken", - "type": "address" - }, - { - "internalType": "address[]", - "name": "swapPath", - "type": "address[]" - } - ], - "internalType": "struct Order.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "enum Order.OrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "enum Order.DecreasePositionSwapType", - "name": "decreasePositionSwapType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "initialCollateralDeltaAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "triggerPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "acceptablePrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minOutputAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct Order.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isFrozen", - "type": "bool" - } - ], - "internalType": "struct Order.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Order.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getPnl", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "marketAddress", - "type": "address" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - }, - { - "internalType": "bool", - "name": "maximize", - "type": "bool" - } - ], - "name": "getPnlToPoolFactor", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getPosition", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralToken", - "type": "address" - } - ], - "internalType": "struct Position.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "increasedAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decreasedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct Position.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "internalType": "struct Position.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Position.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "contract IReferralStorage", - "name": "referralStorage", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "positionKey", - "type": "bytes32" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "bool", - "name": "usePositionSizeAsSizeDeltaUsd", - "type": "bool" - } - ], - "name": "getPositionInfo", - "outputs": [ - { - "components": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address", - "name": "collateralToken", - "type": "address" - } - ], - "internalType": "struct Position.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "sizeInUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sizeInTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "collateralAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "increasedAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "decreasedAtBlock", - "type": "uint256" - } - ], - "internalType": "struct Position.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isLong", - "type": "bool" - } - ], - "internalType": "struct Position.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Position.Props", - "name": "position", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "referralCode", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "affiliate", - "type": "address" - }, - { - "internalType": "address", - "name": "trader", - "type": "address" - }, - { - "internalType": "uint256", - "name": "totalRebateFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalRebateAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "traderDiscountAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "affiliateRewardAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionReferralFees", - "name": "referral", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "fundingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimableShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestFundingFeeAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestLongTokenClaimableFundingAmountPerSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "latestShortTokenClaimableFundingAmountPerSize", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFundingFees", - "name": "funding", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "borrowingFeeUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowingFeeAmountForFeeReceiver", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionBorrowingFees", - "name": "borrowing", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "uiFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "uiFeeAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionUiFees", - "name": "ui", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "collateralTokenPrice", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "positionFeeFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "protocolFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeReceiverAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "positionFeeAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmountExcludingFunding", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalCostAmount", - "type": "uint256" - } - ], - "internalType": "struct PositionPricingUtils.PositionFees", - "name": "fees", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "int256", - "name": "priceImpactUsd", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "priceImpactDiffUsd", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionPrice", - "type": "uint256" - } - ], - "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", - "name": "executionPriceResult", - "type": "tuple" - }, - { - "internalType": "int256", - "name": "basePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "uncappedBasePnlUsd", - "type": "int256" - }, - { - "internalType": "int256", - "name": "pnlAfterPriceImpactUsd", - "type": "int256" - } - ], - "internalType": "struct ReaderUtils.PositionInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "bytes32", - "name": "positionKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "sizeDeltaUsd", - "type": "uint256" - } - ], - "name": "getPositionPnlUsd", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "address", - "name": "tokenIn", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - } - ], - "name": "getSwapAmountOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "feeReceiverAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeAmountForPool", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountAfterFees", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "uiFeeReceiverFactor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "uiFeeAmount", - "type": "uint256" - } - ], - "internalType": "struct SwapPricingUtils.SwapFees", - "name": "fees", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "address", - "name": "marketKey", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenIn", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenOut", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountIn", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "tokenInPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "tokenOutPrice", - "type": "tuple" - } - ], - "name": "getSwapPriceImpact", - "outputs": [ - { - "internalType": "int256", - "name": "", - "type": "int256" - }, - { - "internalType": "int256", - "name": "", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getWithdrawal", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "callbackContract", - "type": "address" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - }, - { - "internalType": "address", - "name": "market", - "type": "address" - }, - { - "internalType": "address[]", - "name": "longTokenSwapPath", - "type": "address[]" - }, - { - "internalType": "address[]", - "name": "shortTokenSwapPath", - "type": "address[]" - } - ], - "internalType": "struct Withdrawal.Addresses", - "name": "addresses", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minLongTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShortTokenAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "updatedAtBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "executionFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "callbackGasLimit", - "type": "uint256" - } - ], - "internalType": "struct Withdrawal.Numbers", - "name": "numbers", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "shouldUnwrapNativeToken", - "type": "bool" - } - ], - "internalType": "struct Withdrawal.Flags", - "name": "flags", - "type": "tuple" - } - ], - "internalType": "struct Withdrawal.Props", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract DataStore", - "name": "dataStore", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "marketToken", - "type": "address" - }, - { - "internalType": "address", - "name": "indexToken", - "type": "address" - }, - { - "internalType": "address", - "name": "longToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortToken", - "type": "address" - } - ], - "internalType": "struct Market.Props", - "name": "market", - "type": "tuple" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "indexTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "longTokenPrice", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "internalType": "struct Price.Props", - "name": "shortTokenPrice", - "type": "tuple" - } - ], - "internalType": "struct MarketUtils.MarketPrices", - "name": "prices", - "type": "tuple" - }, - { - "internalType": "uint256", - "name": "marketTokenAmount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "uiFeeReceiver", - "type": "address" - } - ], - "name": "getWithdrawalAmountOut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ] \ No newline at end of file +{ + "getAccountPositions": "function getAccountPositions(address dataStore, address account, uint256 start, uint256 end) view returns (((address account, address market, address collateralToken) addresses, (uint256 sizeInUsd, uint256 sizeInTokens, uint256 collateralAmount, uint256 borrowingFactor, uint256 fundingFeeAmountPerSize, uint256 longTokenClaimableFundingAmountPerSize, uint256 shortTokenClaimableFundingAmountPerSize, uint256 increasedAtBlock, uint256 decreasedAtBlock) numbers, (bool isLong) flags)[])", + "getMarkets": "function getMarkets(address dataStore, uint256 start, uint256 end) view returns ((address marketToken, address indexToken, address longToken, address shortToken)[])" +} \ No newline at end of file diff --git a/projects/loopscale/index.js b/projects/loopscale/index.js index 57ec1cf79..e862ecbf5 100644 --- a/projects/loopscale/index.js +++ b/projects/loopscale/index.js @@ -1,8 +1,182 @@ -const sdk = require('@defillama/sdk') -const { Connection, PublicKey } = require('@solana/web3.js') +const { PublicKey } = require('@solana/web3.js') const { Program, AnchorProvider, BN } = require("@coral-xyz/anchor"); -const { getConnection, getProvider, decodeAccount } = require('../helper/solana'); -const loopscaleIdl = require('./loopscale.json'); +const { getConnection, } = require('../helper/solana'); +const loopscaleIdl = { + "address": "1oopBoJG58DgkUVKkEzKgyG9dvRmpgeEm1AVjoHkF78", + "metadata": {"name": "loopscale", "version": "0.1.0", "spec": "0.1.0", "description": "Created with Anchor"}, + "instructions": [], + "accounts": [ + {"name": "Loan", "discriminator": [20, 195, 70, 117, 165, 227, 182, 1]}, + {"name": "Strategy", "discriminator": [174, 110, 39, 119, 82, 106, 169, 102]} + ], + "events": [], + "errors": [], + "types": [ + { + "name": "Loan", + "serialization": "bytemuck", + "repr": {"kind": "c", "packed": true}, + "type": { + "kind": "struct", + "fields": [ + {"name": "version", "type": "u8"}, + {"name": "bump", "type": "u8"}, + {"name": "loan_status", "type": "u8"}, + {"name": "borrower", "type": "pubkey"}, + {"name": "nonce", "type": "u64"}, + {"name": "start_time", "type": {"defined": {"name": "PodU64"}}}, + {"name": "ledgers", "type": {"array": [{"defined": {"name": "Ledger"}}, 5]}}, + {"name": "collateral", "type": {"array": [{"defined": {"name": "CollateralData"}}, 5]}} + ] + } + }, + { + "name": "PodU64", + "docs": ["Represents a 64-bit unsigned integer stored as bytes (little-endian)"], + "repr": {"kind": "transparent"}, + "type": {"kind": "struct", "fields": [{"array": ["u8", 8]}]} + }, + { + "name": "Ledger", + "serialization": "bytemuck", + "repr": {"kind": "c", "packed": true}, + "type": { + "kind": "struct", + "fields": [ + {"name": "status", "type": "u8"}, + {"name": "strategy", "type": "pubkey"}, + {"name": "principal_mint", "type": "pubkey"}, + {"name": "market_information", "type": "pubkey"}, + {"name": "principal_due", "type": {"defined": {"name": "PodU64"}}}, + {"name": "principal_repaid", "type": {"defined": {"name": "PodU64"}}}, + {"name": "interest_due", "type": {"defined": {"name": "PodU64"}}}, + {"name": "interest_repaid", "type": {"defined": {"name": "PodU64"}}}, + {"name": "duration", "type": {"defined": {"name": "Duration"}}}, + {"name": "interest_per_second", "type": {"defined": {"name": "PodDecimal"}}}, + {"name": "start_time", "type": {"defined": {"name": "PodU64"}}}, + {"name": "end_time", "type": {"defined": {"name": "PodU64"}}}, + {"name": "apy", "type": {"defined": {"name": "PodU64CBPS"}}} + ] + } + }, + { + "name": "Duration", + "serialization": "bytemuck", + "repr": {"kind": "c", "packed": true}, + "type": {"kind": "struct", "fields": [{"name": "duration", "type": {"defined": {"name": "PodU32"}}}, {"name": "duration_type", "type": "u8"}]} + }, + { + "name": "PodU32", + "docs": ["Represents a 32-bit unsigned integer stored as bytes (little-endian)"], + "repr": {"kind": "transparent"}, + "type": {"kind": "struct", "fields": [{"array": ["u8", 4]}]} + }, + { + "name": "PodDecimal", + "docs": [ + "this is the scaled representation of a whole number. The whole number is scaled by 10^18 to avoid floating point errors when performing arithmetic operations." + ], + "repr": {"kind": "c"}, + "type": {"kind": "struct", "fields": [{"array": ["u8", 24]}]} + }, + { + "name": "PodU64CBPS", + "docs": ["helper type to store u64 cbps values"], + "repr": {"kind": "c"}, + "type": {"kind": "struct", "fields": [{"array": ["u8", 8]}]} + }, + { + "name": "CollateralData", + "serialization": "bytemuck", + "repr": {"kind": "c", "packed": true}, + "type": { + "kind": "struct", + "fields": [ + {"name": "asset_mint", "type": "pubkey"}, + {"name": "amount", "type": {"defined": {"name": "PodU64"}}}, + {"name": "asset_type", "type": "u8"}, + {"name": "asset_identifier", "type": "pubkey"} + ] + } + }, + { + "name": "Strategy", + "serialization": "bytemuck", + "repr": {"kind": "c", "packed": true}, + "type": { + "kind": "struct", + "fields": [ + {"name": "version", "type": "u8"}, + {"name": "nonce", "type": "pubkey"}, + {"name": "bump", "type": "u8"}, + {"name": "principal_mint", "type": "pubkey"}, + {"name": "lender", "type": "pubkey"}, + {"name": "originations_enabled", "type": {"defined": {"name": "PodBool"}}}, + {"name": "external_yield_source", "type": "u8"}, + {"name": "interest_per_second", "type": {"defined": {"name": "PodDecimal"}}}, + { + "name": "last_accrued_timestamp", + "docs": ["timestamp interest per second's interest was last accrued"], + "type": {"defined": {"name": "PodU64"}} + }, + { + "name": "liquidity_buffer", + "docs": ["the is the amount of liquidity % that always needs to be in the strategy"], + "type": {"defined": {"name": "PodU64CBPS"}} + }, + {"name": "token_balance", "docs": ["amount of principal in the strategy"], "type": {"defined": {"name": "PodU64"}}}, + { + "name": "interest_fee", + "docs": ["this is the fee charged by and accrued to the manager on the interest accrued via external yield and loans"], + "type": {"defined": {"name": "PodU64CBPS"}} + }, + { + "name": "principal_fee", + "docs": ["this is the fee charged by and accrued to the manager on the origination fee"], + "type": {"defined": {"name": "PodU64CBPS"}} + }, + {"name": "origination_fee", "docs": ["fee charged on origination of new loans"], "type": {"defined": {"name": "PodU64CBPS"}}}, + {"name": "origination_cap", "docs": ["the maximum size of a loan that can be originated"], "type": {"defined": {"name": "PodU64"}}}, + { + "name": "external_yield_amount", + "docs": ["this is the amount of principal currently in external yield. has to always be updated on any new nav action"], + "type": {"defined": {"name": "PodU64"}} + }, + { + "name": "current_deployed_amount", + "docs": ["this is the amount of principal currently deployed in loans"], + "type": {"defined": {"name": "PodU64"}} + }, + { + "name": "outstanding_interest_amount", + "docs": ["this is the interest that has not been repaid yet but accrued"], + "type": {"defined": {"name": "PodU64"}} + }, + {"name": "fee_claimable", "docs": ["this is the amount that has accrued to the manager"], "type": {"defined": {"name": "PodU64"}}}, + {"name": "cumulative_principal_originated", "type": {"defined": {"name": "PodU128"}}}, + {"name": "cumulative_interest_accrued", "type": {"defined": {"name": "PodU128"}}}, + {"name": "cumulative_loan_count", "type": {"defined": {"name": "PodU64"}}}, + {"name": "active_loan_count", "type": {"defined": {"name": "PodU64"}}}, + {"name": "market_information", "type": "pubkey"}, + {"name": "collateral_map", "type": {"array": [{"array": [{"defined": {"name": "PodU64"}}, 5]}, 200]}}, + {"name": "external_yield_accounts", "type": {"defined": {"name": "ExternalYieldAccounts"}}} + ] + } + }, + {"name": "PodBool", "docs": ["Represents a bool stored as a byte"], "repr": {"kind": "transparent"}, "type": {"kind": "struct", "fields": ["u8"]}}, + { + "name": "PodU128", + "docs": ["Represents a 128-bit unsigned integer stored as bytes (little-endian)"], + "repr": {"kind": "c"}, + "type": {"kind": "struct", "fields": [{"array": ["u8", 16]}]} + }, + { + "name": "ExternalYieldAccounts", + "repr": {"kind": "c", "packed": true}, + "type": {"kind": "struct", "fields": [{"name": "external_yield_account", "type": "pubkey"}, {"name": "external_yield_vault", "type": "pubkey"}]} + } + ] +} const endpoint = 'https://loopscale-pricing-adapters-109615290061.europe-west2.run.app/decompile_mints' @@ -154,5 +328,5 @@ module.exports = { timetravel: false, methodology: 'TVL is calculated by summing up lending deposits and supplied collateral. Borrowed tokens are included.', - solana: { tvl, borrowed }, + solana: { tvl, borrowed, }, } diff --git a/projects/loopscale/loopscale.json b/projects/loopscale/loopscale.json index 9a3979da4..ceba1b766 100644 --- a/projects/loopscale/loopscale.json +++ b/projects/loopscale/loopscale.json @@ -1,2667 +1,129 @@ { "address": "1oopBoJG58DgkUVKkEzKgyG9dvRmpgeEm1AVjoHkF78", - "metadata": { - "name": "loopscale", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, + "metadata": {"name": "loopscale", "version": "0.1.0", "spec": "0.1.0", "description": "Created with Anchor"}, "instructions": [], - "accounts": [ - { - "name": "Loan", - "discriminator": [ - 20, - 195, - 70, - 117, - 165, - 227, - 182, - 1 - ] - }, - { - "name": "MarketInformation", - "discriminator": [ - 194, - 154, - 190, - 99, - 64, - 111, - 37, - 205 - ] - }, - { - "name": "Position", - "discriminator": [ - 170, - 188, - 143, - 228, - 122, - 64, - 247, - 208 - ] - }, - { - "name": "Strategy", - "discriminator": [ - 174, - 110, - 39, - 119, - 82, - 106, - 169, - 102 - ] - }, - { - "name": "Timelock", - "discriminator": [ - 189, - 33, - 78, - 75, - 205, - 31, - 4, - 177 - ] - }, - { - "name": "UserRewardsInfo", - "discriminator": [ - 242, - 27, - 82, - 180, - 183, - 119, - 156, - 237 - ] - }, - { - "name": "Vault", - "discriminator": [ - 211, - 8, - 232, - 43, - 2, - 152, - 117, - 119 - ] - }, - { - "name": "VaultRewardsInfo", - "discriminator": [ - 4, - 142, - 66, - 219, - 168, - 11, - 4, - 14 - ] - }, - { - "name": "VaultStake", - "discriminator": [ - 225, - 34, - 128, - 53, - 167, - 239, - 182, - 107 - ] - }, - { - "name": "Whirlpool", - "discriminator": [ - 63, - 149, - 209, - 12, - 225, - 128, - 99, - 9 - ] - } - ], + "accounts": [{"name": "Strategy", "discriminator": [174, 110, 39, 119, 82, 106, 169, 102]}, + + {"name": "Loan", "discriminator": [20, 195, 70, 117, 165, 227, 182, 1]}], "events": [], "errors": [], "types": [ { - "name": "AddCollateralTimeLockArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "collateral_terms", - "type": { - "defined": { - "name": "CollateralTerms" - } - } - }, - { - "name": "update_market_information_params", - "type": { - "defined": { - "name": "UpdateMarketInformationParams" - } - } - } - ] - } - }, - { - "name": "AssetData", + "name": "Loan", "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, + "repr": {"kind": "c", "packed": true}, "type": { "kind": "struct", "fields": [ - { - "name": "asset_identifier", - "type": "pubkey" - }, - { - "name": "quote_mint", - "type": "pubkey" - }, - { - "name": "oracle_account", - "type": "pubkey" - }, - { - "name": "oracle_type", - "type": "u8" - }, - { - "name": "max_uncertainty", - "type": { - "defined": { - "name": "PodU32CBPS" - } - } - }, - { - "name": "max_age", - "type": { - "defined": { - "name": "PodU16" - } - } - }, - { - "name": "decimals", - "type": "u8" - }, - { - "name": "ltv", - "type": { - "defined": { - "name": "PodU32CBPS" - } - } - }, - { - "name": "liquidation_threshold", - "type": { - "defined": { - "name": "PodU32CBPS" - } - } - } + {"name": "version", "type": "u8"}, + {"name": "bump", "type": "u8"}, + {"name": "loan_status", "type": "u8"}, + {"name": "borrower", "type": "pubkey"}, + {"name": "nonce", "type": "u64"}, + {"name": "start_time", "type": {"defined": {"name": "PodU64"}}}, + {"name": "ledgers", "type": {"array": [{"defined": {"name": "Ledger"}}, 5]}}, + {"name": "collateral", "type": {"array": [{"defined": {"name": "CollateralData"}}, 5]}}, + {"name": "weight_matrix", "type": {"array": [{"array": [{"defined": {"name": "PodU32CBPS"}}, 5]}, 5]}}, + {"name": "ltv_matrix", "type": {"array": [{"array": [{"defined": {"name": "PodU32CBPS"}}, 5]}, 5]}}, + {"name": "lqt_matrix", "type": {"array": [{"array": [{"defined": {"name": "PodU32CBPS"}}, 5]}, 5]}} ] } }, { - "name": "BorrowPrincipalParams", - "docs": [ - "Remaining accounts:\n\nnum ledgers = L\n\n 1. LTV Write:\n 0: Ledger[ledger_index] Market Information\n\n 2. Healthcheck:\n For each ledger:\n Ledger market information\n Principal oracle accounts + conversion oracle accounts\n Then for each collateral in the loan:\n Collateral oracle accounts + conversion oracle accounts\n\nAsset index guidance:\n\n1. LTV write:\n For ledger[ledger_index]:\n Collateral index for each collateral\n2. Healthcheck:\n For each ledger:\n For each collateral in the loan:\n Principal index\n Collateral index" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "asset_index_guidance", - "type": "bytes" - }, - { - "name": "duration", - "type": "u8" - }, - { - "name": "expected_loan_values", - "type": { - "defined": { - "name": "ExpectedLoanValues" - } - } - }, - { - "name": "skip_sol_unwrap", - "type": "bool" - } - ] - } - }, - { - "name": "ClaimVaultFeeParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount", - "type": "u64" - } - ] - } - }, - { - "name": "CollateralData", + "name": "Strategy", "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, + "repr": {"kind": "c", "packed": true}, "type": { "kind": "struct", "fields": [ + {"name": "version", "type": "u8"}, + {"name": "nonce", "type": "pubkey"}, + {"name": "bump", "type": "u8"}, + {"name": "principal_mint", "type": "pubkey"}, + {"name": "lender", "type": "pubkey"}, + {"name": "originations_enabled", "type": {"defined": {"name": "PodBool"}}}, + {"name": "external_yield_source", "type": "u8"}, + {"name": "interest_per_second", "type": {"defined": {"name": "PodDecimal"}}}, { - "name": "asset_mint", - "type": "pubkey" - }, - { - "name": "amount", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "asset_type", - "type": "u8" - }, - { - "name": "asset_identifier", - "type": "pubkey" - } - ] - } - }, - { - "name": "CollateralTerms", - "type": { - "kind": "struct", - "fields": [ - { - "name": "asset_identifier", - "type": "pubkey" - }, - { - "name": "terms", - "type": { - "array": [ - "u64", - 5 - ] - } - } - ] - } - }, - { - "name": "CollateralTermsIndices", - "type": { - "kind": "struct", - "fields": [ - { - "name": "collateral_index", - "type": "u8" - }, - { - "name": "duration_index", - "type": "u8" - } - ] - } - }, - { - "name": "CreateLoanParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "nonce", - "type": "u64" - } - ] - } - }, - { - "name": "CreateMarketInformationParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "principal_mint", - "type": "pubkey" - }, - { - "name": "authority", - "type": "pubkey" - } - ] - } - }, - { - "name": "CreateRewardsScheduleParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "total_weighted_stake_supply", - "type": { - "defined": { - "name": "PodDecimal" - } - } - }, - { - "name": "reward_start_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "reward_end_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "duration_stake_weights", - "type": { - "array": [ - { - "defined": { - "name": "PodU32CBPS" - } - }, - 5 - ] - } - } - ] - } - }, - { - "name": "CreateStrategyParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "lender", - "type": "pubkey" - }, - { - "name": "origination_cap", - "type": "u64" + "name": "last_accrued_timestamp", + "docs": ["timestamp interest per second's interest was last accrued"], + "type": {"defined": {"name": "PodU64"}} }, { "name": "liquidity_buffer", - "type": "u64" + "docs": ["the is the amount of liquidity % that always needs to be in the strategy"], + "type": {"defined": {"name": "PodU64CBPS"}} }, + {"name": "token_balance", "docs": ["amount of principal in the strategy"], "type": {"defined": {"name": "PodU64"}}}, { "name": "interest_fee", - "type": "u64" - }, - { - "name": "origination_fee", - "type": "u64" + "docs": ["this is the fee charged by and accrued to the manager on the interest accrued via external yield and loans"], + "type": {"defined": {"name": "PodU64CBPS"}} }, { "name": "principal_fee", - "type": "u64" + "docs": ["this is the fee charged by and accrued to the manager on the origination fee"], + "type": {"defined": {"name": "PodU64CBPS"}} + }, + {"name": "origination_fee", "docs": ["fee charged on origination of new loans"], "type": {"defined": {"name": "PodU64CBPS"}}}, + {"name": "origination_cap", "docs": ["the maximum size of a loan that can be originated"], "type": {"defined": {"name": "PodU64"}}}, + { + "name": "external_yield_amount", + "docs": ["this is the amount of principal currently in external yield. has to always be updated on any new nav action"], + "type": {"defined": {"name": "PodU64"}} }, { - "name": "originations_enabled", - "type": "bool" + "name": "current_deployed_amount", + "docs": ["this is the amount of principal currently deployed in loans"], + "type": {"defined": {"name": "PodU64"}} }, { - "name": "external_yield_source_args", - "type": { - "option": { - "defined": { - "name": "ExternalYieldSourceArgs" - } - } - } - } - ] - } - }, - { - "name": "CreateVaultParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "token_name", - "type": "string" - }, - { - "name": "token_symbol", - "type": "string" - }, - { - "name": "token_uri", - "type": "string" - }, - { - "name": "manager", - "type": "pubkey" - }, - { - "name": "create_strategy_params", - "type": { - "defined": { - "name": "CreateStrategyParams" - } - } - } - ] - } - }, - { - "name": "DepositCollateralParams", - "docs": [ - "Remaining accounts:\n\nnum ledgers = L\n\n1. LTV Write:\n 0 -> (L-1): Ledger Market Information\n\nAsset index guidance:\n1. LTV Write:\n 0 -> (L-1): Collateral index for deposited collateral on the ledger market information" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "asset_type", - "type": "u8" - }, - { - "name": "asset_index_guidance", - "type": "bytes" - }, - { - "name": "expected_loan_values", - "type": { - "defined": { - "name": "ExpectedLoanValues" - } - } - } - ] - } - }, - { - "name": "Duration", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "duration", - "type": { - "defined": { - "name": "PodU32" - } - } - }, - { - "name": "duration_type", - "type": "u8" - } - ] - } - }, - { - "name": "ExactInParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount_in", - "type": "u64" - }, - { - "name": "min_amount_out", - "type": "u64" - } - ] - } - }, - { - "name": "ExactOutParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount_out", - "type": "u64" - }, - { - "name": "max_amount_in", - "type": "u64" - } - ] - } - }, - { - "name": "ExpectedLoanValues", - "type": { - "kind": "struct", - "fields": [ - { - "name": "expected_apy", - "type": "u64" - }, - { - "name": "expected_liquidation_threshold", - "type": { - "array": [ - "u32", - 5 - ] - } - } - ] - } - }, - { - "name": "ExternalYieldAccounts", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "external_yield_account", - "type": "pubkey" - }, - { - "name": "external_yield_vault", - "type": "pubkey" - } - ] - } - }, - { - "name": "ExternalYieldSourceArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "new_external_yield_source", - "type": "u8" - }, - { - "name": "external_yield_vault", - "type": "pubkey" - } - ] - } - }, - { - "name": "Ledger", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "status", - "type": "u8" - }, - { - "name": "strategy", - "type": "pubkey" - }, - { - "name": "principal_mint", - "type": "pubkey" - }, - { - "name": "market_information", - "type": "pubkey" - }, - { - "name": "principal_due", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "principal_repaid", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "interest_due", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "interest_repaid", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "duration", - "type": { - "defined": { - "name": "Duration" - } - } - }, - { - "name": "interest_per_second", - "type": { - "defined": { - "name": "PodDecimal" - } - } - }, - { - "name": "start_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "end_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "apy", - "type": { - "defined": { - "name": "PodU64CBPS" - } - } - } - ] - } - }, - { - "name": "LiquidateLedgerParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "ledger_index", - "type": "u8" - }, - { - "name": "unwrap_sol", - "type": "bool" - }, - { - "name": "asset_index_guidance", - "type": "bytes" - } - ] - } - }, - { - "name": "Loan", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "version", - "type": "u8" - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "loan_status", - "type": "u8" - }, - { - "name": "borrower", - "type": "pubkey" - }, - { - "name": "nonce", - "type": "u64" - }, - { - "name": "start_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "ledgers", - "type": { - "array": [ - { - "defined": { - "name": "Ledger" - } - }, - 5 - ] - } - }, - { - "name": "collateral", - "type": { - "array": [ - { - "defined": { - "name": "CollateralData" - } - }, - 5 - ] - } - }, - { - "name": "weight_matrix", - "type": { - "array": [ - { - "array": [ - { - "defined": { - "name": "PodU32CBPS" - } - }, - 5 - ] - }, - 5 - ] - } - }, - { - "name": "ltv_matrix", - "type": { - "array": [ - { - "array": [ - { - "defined": { - "name": "PodU32CBPS" - } - }, - 5 - ] - }, - 5 - ] - } - }, - { - "name": "lqt_matrix", - "type": { - "array": [ - { - "array": [ - { - "defined": { - "name": "PodU32CBPS" - } - }, - 5 - ] - }, - 5 - ] - } - } - ] - } - }, - { - "name": "LoanUnlockParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "asset_index_guidance", - "type": "bytes" - } - ] - } - }, - { - "name": "LockLoanParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "unlock_idx", - "type": "u8" - } - ] - } - }, - { - "name": "LpParams", - "type": { - "kind": "enum", - "variants": [ - { - "name": "ExactIn", - "fields": [ - { - "defined": { - "name": "ExactInParams" - } - } - ] - }, - { - "name": "ExactOut", - "fields": [ - { - "defined": { - "name": "ExactOutParams" - } - } - ] - } - ] - } - }, - { - "name": "ManageOrcaLiquidityParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "collateral_index", - "type": "u8" - }, - { - "name": "liquidity_amount", - "type": "u128" - }, - { - "name": "transfer_params", - "type": { - "defined": { - "name": "OrcaTransferTypeParams" - } - } - }, - { - "name": "asset_index_guidance", - "type": "bytes" - } - ] - } - }, - { - "name": "MarketInformation", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "authority", - "type": "pubkey" - }, - { - "name": "delegate", - "type": "pubkey" - }, - { - "name": "principal_mint", - "type": "pubkey" - }, - { - "name": "asset_data", - "type": { - "array": [ - { - "defined": { - "name": "AssetData" - } - }, - 200 - ] - } - } - ] - } - }, - { - "name": "MultiCollateralTermsUpdateParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "apy", - "type": "u64" - }, - { - "name": "indices", - "type": { - "vec": { - "defined": { - "name": "CollateralTermsIndices" - } - } - } - } - ] - } - }, - { - "name": "OrcaLiquidityParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "slippage_tolerance_bps", - "type": "u16" - } - ] - } - }, - { - "name": "OrcaTokenAmountsParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "token_a_amount", - "type": "u64" - }, - { - "name": "token_b_amount", - "type": "u64" - } - ] - } - }, - { - "name": "OrcaTransferTypeParams", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Liquidity", - "fields": [ - { - "defined": { - "name": "OrcaLiquidityParams" - } - } - ] - }, - { - "name": "TokenAmounts", - "fields": [ - { - "defined": { - "name": "OrcaTokenAmountsParams" - } - } - ] - } - ] - } - }, - { - "name": "PodBool", - "docs": [ - "Represents a bool stored as a byte" - ], - "repr": { - "kind": "transparent" - }, - "type": { - "kind": "struct", - "fields": [ - "u8" + "name": "outstanding_interest_amount", + "docs": ["this is the interest that has not been repaid yet but accrued"], + "type": {"defined": {"name": "PodU64"}} + }, + {"name": "fee_claimable", "docs": ["this is the amount that has accrued to the manager"], "type": {"defined": {"name": "PodU64"}}}, + {"name": "cumulative_principal_originated", "type": {"defined": {"name": "PodU128"}}}, + {"name": "cumulative_interest_accrued", "type": {"defined": {"name": "PodU128"}}}, + {"name": "cumulative_loan_count", "type": {"defined": {"name": "PodU64"}}}, + {"name": "active_loan_count", "type": {"defined": {"name": "PodU64"}}}, + {"name": "market_information", "type": "pubkey"}, + {"name": "collateral_map", "type": {"array": [{"array": [{"defined": {"name": "PodU64"}}, 5]}, 200]}}, + {"name": "external_yield_accounts", "type": {"defined": {"name": "ExternalYieldAccounts"}}} ] } }, + {"name": "PodBool", "docs": ["Represents a bool stored as a byte"], "repr": {"kind": "transparent"}, "type": {"kind": "struct", "fields": ["u8"]}}, { "name": "PodDecimal", "docs": [ "this is the scaled representation of a whole number. The whole number is scaled by 10^18 to avoid floating point errors when performing arithmetic operations." ], - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "array": [ - "u8", - 24 - ] - } - ] - } - }, - { - "name": "PodU128", - "docs": [ - "Represents a 128-bit unsigned integer stored as bytes (little-endian)" - ], - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "array": [ - "u8", - 16 - ] - } - ] - } - }, - { - "name": "PodU16", - "docs": [ - "Represents a 16-bit unsigned integer stored as bytes (little-endian)" - ], - "repr": { - "kind": "transparent" - }, - "type": { - "kind": "struct", - "fields": [ - { - "array": [ - "u8", - 2 - ] - } - ] - } - }, - { - "name": "PodU32", - "docs": [ - "Represents a 32-bit unsigned integer stored as bytes (little-endian)" - ], - "repr": { - "kind": "transparent" - }, - "type": { - "kind": "struct", - "fields": [ - { - "array": [ - "u8", - 4 - ] - } - ] - } - }, - { - "name": "PodU32CBPS", - "docs": [ - "helper type to store u32 cbps values" - ], - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "array": [ - "u8", - 4 - ] - } - ] - } + "repr": {"kind": "c"}, + "type": {"kind": "struct", "fields": [{"array": ["u8", 24]}]} }, { "name": "PodU64", - "docs": [ - "Represents a 64-bit unsigned integer stored as bytes (little-endian)" - ], - "repr": { - "kind": "transparent" - }, - "type": { - "kind": "struct", - "fields": [ - { - "array": [ - "u8", - 8 - ] - } - ] - } + "docs": ["Represents a 64-bit unsigned integer stored as bytes (little-endian)"], + "repr": {"kind": "transparent"}, + "type": {"kind": "struct", "fields": [{"array": ["u8", 8]}]} }, { "name": "PodU64CBPS", - "docs": [ - "helper type to store u64 cbps values" - ], - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "array": [ - "u8", - 8 - ] - } - ] - } + "docs": ["helper type to store u64 cbps values"], + "repr": {"kind": "c"}, + "type": {"kind": "struct", "fields": [{"array": ["u8", 8]}]} }, { - "name": "Position", - "type": { - "kind": "struct", - "fields": [ - { - "name": "whirlpool", - "type": "pubkey" - }, - { - "name": "position_mint", - "type": "pubkey" - }, - { - "name": "liquidity", - "type": "u128" - }, - { - "name": "tick_lower_index", - "type": "i32" - }, - { - "name": "tick_upper_index", - "type": "i32" - }, - { - "name": "fee_growth_checkpoint_a", - "type": "u128" - }, - { - "name": "fee_owed_a", - "type": "u64" - }, - { - "name": "fee_growth_checkpoint_b", - "type": "u128" - }, - { - "name": "fee_owed_b", - "type": "u64" - }, - { - "name": "reward_infos", - "type": { - "array": [ - { - "defined": { - "name": "PositionRewardInfo" - } - }, - 3 - ] - } - } - ] - } + "name": "PodU128", + "docs": ["Represents a 128-bit unsigned integer stored as bytes (little-endian)"], + "repr": {"kind": "c"}, + "type": {"kind": "struct", "fields": [{"array": ["u8", 16]}]} }, { - "name": "PositionRewardInfo", - "type": { - "kind": "struct", - "fields": [ - { - "name": "growth_inside_checkpoint", - "type": "u128" - }, - { - "name": "amount_owed", - "type": "u64" - } - ] - } - }, - { - "name": "RefinanceLedgerParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "ledger_index", - "type": "u8" - }, - { - "name": "duration_index", - "type": "u8" - }, - { - "name": "asset_index_guidance", - "type": "bytes" - } - ] - } - }, - { - "name": "RepayPrincipalParams", - "docs": [ - "No remaining accounts or asset index guidance needed. In full repayment, we zero out the matrix for the specific ledger using default loan values." - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "ledger_index", - "type": "u8" - }, - { - "name": "repay_all", - "type": "bool" - } - ] - } - }, - { - "name": "RewardsClaimedEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault_address", - "type": "pubkey" - }, - { - "name": "user_address", - "type": "pubkey" - }, - { - "name": "stake_account_address", - "type": "pubkey" - }, - { - "name": "amount", - "type": "u64" - }, - { - "name": "mint", - "type": "pubkey" - }, - { - "name": "timestamp", - "type": "u64" - } - ] - } - }, - { - "name": "SellLedgerParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "ledger_index", - "type": "u8" - }, - { - "name": "expected_sale_price", - "type": "u64" - }, - { - "name": "asset_index_guidance", - "type": "bytes" - } - ] - } - }, - { - "name": "StakeEvent", - "docs": [ - "metadata for vault actions" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "user", - "type": "pubkey" - }, - { - "name": "address", - "type": "pubkey" - }, - { - "name": "vault_address", - "type": "pubkey" - }, - { - "name": "principal_mint", - "type": "pubkey" - }, - { - "name": "duration_type", - "type": "u8" - }, - { - "name": "amount", - "type": "u64" - }, - { - "name": "action_type", - "type": "u8" - }, - { - "name": "principal_amount", - "type": "u64" - } - ] - } - }, - { - "name": "Strategy", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "version", - "type": "u8" - }, - { - "name": "nonce", - "type": "pubkey" - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "principal_mint", - "type": "pubkey" - }, - { - "name": "lender", - "type": "pubkey" - }, - { - "name": "originations_enabled", - "type": { - "defined": { - "name": "PodBool" - } - } - }, - { - "name": "external_yield_source", - "type": "u8" - }, - { - "name": "interest_per_second", - "type": { - "defined": { - "name": "PodDecimal" - } - } - }, - { - "name": "last_accrued_timestamp", - "docs": [ - "timestamp interest per second's interest was last accrued" - ], - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "liquidity_buffer", - "docs": [ - "the is the amount of liquidity % that always needs to be in the strategy" - ], - "type": { - "defined": { - "name": "PodU64CBPS" - } - } - }, - { - "name": "token_balance", - "docs": [ - "amount of principal in the strategy" - ], - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "interest_fee", - "docs": [ - "this is the fee charged by and accrued to the manager on the interest accrued via external yield and loans" - ], - "type": { - "defined": { - "name": "PodU64CBPS" - } - } - }, - { - "name": "principal_fee", - "docs": [ - "this is the fee charged by and accrued to the manager on the origination fee" - ], - "type": { - "defined": { - "name": "PodU64CBPS" - } - } - }, - { - "name": "origination_fee", - "docs": [ - "fee charged on origination of new loans" - ], - "type": { - "defined": { - "name": "PodU64CBPS" - } - } - }, - { - "name": "origination_cap", - "docs": [ - "the maximum size of a loan that can be originated" - ], - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "external_yield_amount", - "docs": [ - "this is the amount of principal currently in external yield. has to always be updated on any new nav action" - ], - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "current_deployed_amount", - "docs": [ - "this is the amount of principal currently deployed in loans" - ], - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "outstanding_interest_amount", - "docs": [ - "this is the interest that has not been repaid yet but accrued" - ], - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "fee_claimable", - "docs": [ - "this is the amount that has accrued to the manager" - ], - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "cumulative_principal_originated", - "type": { - "defined": { - "name": "PodU128" - } - } - }, - { - "name": "cumulative_interest_accrued", - "type": { - "defined": { - "name": "PodU128" - } - } - }, - { - "name": "cumulative_loan_count", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "active_loan_count", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "market_information", - "type": "pubkey" - }, - { - "name": "collateral_map", - "type": { - "array": [ - { - "array": [ - { - "defined": { - "name": "PodU64" - } - }, - 5 - ] - }, - 200 - ] - } - }, - { - "name": "external_yield_accounts", - "type": { - "defined": { - "name": "ExternalYieldAccounts" - } - } - } - ] - } - }, - { - "name": "Timelock", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "init_timestamp", - "type": "i64" - }, - { - "name": "execution_delay", - "type": "i64" - }, - { - "name": "params", - "type": { - "defined": { - "name": "TimelockUpdateParams" - } - } - } - ] - } - }, - { - "name": "TimelockCanceledEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timelock", - "type": "string" - } - ] - } - }, - { - "name": "TimelockCreatedEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timelock_address", - "type": "string" - }, - { - "name": "vault_address", - "type": "string" - }, - { - "name": "timelock_params", - "type": { - "defined": { - "name": "TimelockUpdateParams" - } - } - }, - { - "name": "timelock_init_timestamp", - "type": "i64" - }, - { - "name": "timelock_execution_delay", - "type": "i64" - } - ] - } - }, - { - "name": "TimelockExecutedEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timelock", - "type": "string" - } - ] - } - }, - { - "name": "TimelockUpdateParams", - "type": { - "kind": "enum", - "variants": [ - { - "name": "AddCollateral", - "fields": [ - { - "defined": { - "name": "AddCollateralTimeLockArgs" - } - } - ] - }, - { - "name": "UpdateLtv", - "fields": [ - { - "defined": { - "name": "UpdateMarketInformationParams" - } - } - ] - }, - { - "name": "RemoveCollateral", - "fields": [ - { - "defined": { - "name": "CollateralTerms" - } - } - ] - }, - { - "name": "UpdateApy", - "fields": [ - { - "defined": { - "name": "CollateralTerms" - } - } - ] - }, - { - "name": "UpdateStrategy", - "fields": [ - { - "defined": { - "name": "UpdateStrategyParams" - } - } - ] - }, - { - "name": "UpdateVault", - "fields": [ - "u64" - ] - } - ] - } - }, - { - "name": "TransferOrcaPositionParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "liquidity_amount", - "type": "u128" - }, - { - "name": "transfer_params", - "type": { - "defined": { - "name": "OrcaTransferTypeParams" - } - } - }, - { - "name": "tick_lower_index", - "type": "i32" - }, - { - "name": "tick_upper_index", - "type": "i32" - }, - { - "name": "asset_index_guidance", - "type": "bytes" - } - ] - } - }, - { - "name": "UpdateMarketInformationParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "asset_identifier", - "type": "pubkey" - }, - { - "name": "quote_mint", - "type": { - "option": "pubkey" - } - }, - { - "name": "oracle_account", - "type": { - "option": "pubkey" - } - }, - { - "name": "oracle_type", - "type": { - "option": "u8" - } - }, - { - "name": "max_uncertainty", - "type": { - "option": "u32" - } - }, - { - "name": "max_age", - "type": { - "option": "u16" - } - }, - { - "name": "ltv", - "type": { - "option": "u32" - } - }, - { - "name": "liquidation_threshold", - "type": { - "option": "u32" - } - }, - { - "name": "remove", - "type": { - "option": "bool" - } - } - ] - } - }, - { - "name": "UpdateRewardsScheduleParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount_to_transfer", - "type": "u64" - }, - { - "name": "extend_end_time", - "type": { - "option": "u64" - } - }, - { - "name": "schedule_index", - "type": "u8" - } - ] - } - }, - { - "name": "UpdateStrategyParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "originations_enabled", - "type": { - "option": "bool" - } - }, - { - "name": "liquidity_buffer", - "type": { - "option": "u64" - } - }, - { - "name": "interest_fee", - "type": { - "option": "u64" - } - }, - { - "name": "origination_fee", - "type": { - "option": "u64" - } - }, - { - "name": "principal_fee", - "type": { - "option": "u64" - } - }, - { - "name": "origination_cap", - "type": { - "option": "u64" - } - }, - { - "name": "market_information", - "type": { - "option": "pubkey" - } - }, - { - "name": "external_yield_source_args", - "type": { - "option": { - "defined": { - "name": "ExternalYieldSourceArgs" - } - } - } - } - ] - } - }, - { - "name": "UpdateVaultParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "deposits_enabled", - "type": "bool" - }, - { - "name": "init_vault_rewards_info", - "type": "bool" - } - ] - } - }, - { - "name": "UpdateWeightMatrixParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "asset_index_guidance", - "type": "bytes" - }, - { - "name": "collateral_index", - "type": "u8" - }, - { - "name": "weight_matrix_update", - "type": { - "array": [ - "u32", - 5 - ] - } - } - ] - } - }, - { - "name": "UserRewardsInfo", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault_address", - "type": "pubkey" - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "stake_account_address", - "type": "pubkey" - }, - { - "name": "stake_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "lp_amount", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "duration_index", - "type": "u8" - }, - { - "name": "last_reward_indexes", - "type": { - "array": [ - { - "defined": { - "name": "PodDecimal" - } - }, - 5 - ] - } - }, - { - "name": "pending_rewards", - "type": { - "array": [ - { - "defined": { - "name": "PodU64" - } - }, - 5 - ] - } - }, - { - "name": "last_reward_index_update_time", - "type": { - "array": [ - { - "defined": { - "name": "PodU64" - } - }, - 5 - ] - } - } - ] - } - }, - { - "name": "UserRewardsInfoClosed", - "type": { - "kind": "struct", - "fields": [ - { - "name": "address", - "type": "pubkey" - } - ] - } - }, - { - "name": "Vault", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "manager", - "type": "pubkey" - }, - { - "name": "nonce", - "type": "pubkey" - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "lp_supply", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "lp_mint", - "type": "pubkey" - }, - { - "name": "principal_mint", - "type": "pubkey" - }, - { - "name": "cumulative_principal_deposited", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "deposits_enabled", - "type": { - "defined": { - "name": "PodBool" - } - } - }, - { - "name": "max_early_unstake_fee", - "type": { - "defined": { - "name": "PodU64CBPS" - } - } - } - ] - } - }, - { - "name": "VaultRewardsInfo", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault_address", - "type": "pubkey" - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "schedules", - "type": { - "array": [ - { - "defined": { - "name": "VaultRewardsSchedule" - } - }, - 5 - ] - } - } - ] - } - }, - { - "name": "VaultRewardsSchedule", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "reward_mint", - "type": "pubkey" - }, - { - "name": "total_weighted_stake_supply", - "type": { - "defined": { - "name": "PodDecimal" - } - } - }, - { - "name": "reward_start_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "reward_end_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "total_emissions_amount", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "emissions_per_second", - "type": { - "defined": { - "name": "PodDecimal" - } - } - }, - { - "name": "reward_index", - "type": { - "defined": { - "name": "PodDecimal" - } - } - }, - { - "name": "last_reward_index_update_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "emissions_claimed", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "created_at", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "duration_stake_weights", - "type": { - "array": [ - { - "defined": { - "name": "PodU32CBPS" - } - }, - 5 - ] - } - } - ] - } - }, - { - "name": "VaultStake", - "serialization": "bytemuck", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "nonce", - "type": "pubkey" - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "amount", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "duration", - "type": { - "defined": { - "name": "Duration" - } - } - }, - { - "name": "start_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "end_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "unstake_time", - "type": { - "defined": { - "name": "PodU64" - } - } - }, - { - "name": "unstake_fee_applied", - "type": { - "defined": { - "name": "PodU64" - } - } - } - ] - } - }, - { - "name": "VaultStakeParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "principal_amount", - "type": "u64" - }, - { - "name": "stake_all", - "type": { - "option": "bool" - } - }, - { - "name": "duration", - "type": "u32" - }, - { - "name": "duration_type", - "type": "u8" - }, - { - "name": "action_type", - "type": "u8" - } - ] - } - }, - { - "name": "VaultUnstakeParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "action_type", - "type": "u8" - }, - { - "name": "principal_amount", - "type": "u64" - } - ] - } - }, - { - "name": "Whirlpool", - "type": { - "kind": "struct", - "fields": [ - { - "name": "whirlpools_config", - "type": "pubkey" - }, - { - "name": "whirlpool_bump", - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "tick_spacing", - "type": "u16" - }, - { - "name": "fee_tier_index_seed", - "type": { - "array": [ - "u8", - 2 - ] - } - }, - { - "name": "fee_rate", - "type": "u16" - }, - { - "name": "protocol_fee_rate", - "type": "u16" - }, - { - "name": "liquidity", - "type": "u128" - }, - { - "name": "sqrt_price", - "type": "u128" - }, - { - "name": "tick_current_index", - "type": "i32" - }, - { - "name": "protocol_fee_owed_a", - "type": "u64" - }, - { - "name": "protocol_fee_owed_b", - "type": "u64" - }, - { - "name": "token_mint_a", - "type": "pubkey" - }, - { - "name": "token_vault_a", - "type": "pubkey" - }, - { - "name": "fee_growth_global_a", - "type": "u128" - }, - { - "name": "token_mint_b", - "type": "pubkey" - }, - { - "name": "token_vault_b", - "type": "pubkey" - }, - { - "name": "fee_growth_global_b", - "type": "u128" - }, - { - "name": "reward_last_updated_timestamp", - "type": "u64" - }, - { - "name": "reward_infos", - "type": { - "array": [ - { - "defined": { - "name": "WhirlpoolRewardInfo" - } - }, - 3 - ] - } - } - ] - } - }, - { - "name": "WhirlpoolRewardInfo", - "docs": [ - "Stores the state relevant for tracking liquidity mining rewards at the `Whirlpool` level.", - "These values are used in conjunction with `PositionRewardInfo`, `Tick.reward_growths_outside`,", - "and `Whirlpool.reward_last_updated_timestamp` to determine how many rewards are earned by open", - "positions." - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "mint", - "docs": [ - "Reward token mint." - ], - "type": "pubkey" - }, - { - "name": "vault", - "docs": [ - "Reward vault token account." - ], - "type": "pubkey" - }, - { - "name": "authority", - "docs": [ - "Authority account that has permission to initialize the reward and set emissions." - ], - "type": "pubkey" - }, - { - "name": "emissions_per_second_x64", - "docs": [ - "Q64.64 number that indicates how many tokens per second are earned per unit of liquidity." - ], - "type": "u128" - }, - { - "name": "growth_global_x64", - "docs": [ - "Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward", - "emissions were turned on." - ], - "type": "u128" - } - ] - } - }, - { - "name": "WithdrawCollateralParams", - "docs": [ - "Remaining accounts:\n\nnum ledgers = L\n\n1. 0 -> 2L-1: Strategy + MarketInformation for ledger L_i\n\n2. Healthcheck:\n For each ledger:\n Ledger market information\n Principal oracle accounts + conversion oracle accounts\n Then again for each ledger and collateral:\n Collateral oracle accounts + conversion oracle accounts\n\n\nAsset index guidance:\n1. Healthcheck:\n For each ledger:\n For each collateral in the loan:\n Principal index\n Collateral index" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "collateral_index", - "type": "u8" - }, - { - "name": "asset_index_guidance", - "type": "bytes" - }, - { - "name": "expected_loan_values", - "type": { - "defined": { - "name": "ExpectedLoanValues" - } - } - }, - { - "name": "close_if_eligible", - "type": "bool" - } - ] - } + "name": "ExternalYieldAccounts", + "repr": {"kind": "c", "packed": true}, + "type": {"kind": "struct", "fields": [{"name": "external_yield_account", "type": "pubkey"}, {"name": "external_yield_vault", "type": "pubkey"}]} } ] } \ No newline at end of file diff --git a/projects/meteora-dlmm/idl.json b/projects/meteora-dlmm/idl.json index eabf56b58..c51e07001 100644 --- a/projects/meteora-dlmm/idl.json +++ b/projects/meteora-dlmm/idl.json @@ -1,4431 +1,44 @@ - { +{ "version": "0.9.0", "name": "lb_clmm", - "constants": [ - { - "name": "BASIS_POINT_MAX", - "type": "i32", - "value": "10000" - }, - { - "name": "MAX_BIN_PER_ARRAY", - "type": { - "defined": "usize" - }, - "value": "70" - }, - { - "name": "MAX_BIN_PER_POSITION", - "type": { - "defined": "usize" - }, - "value": "70" - }, - { - "name": "MAX_RESIZE_LENGTH", - "type": { - "defined": "usize" - }, - "value": "70" - }, - { - "name": "POSITION_MAX_LENGTH", - "type": { - "defined": "usize" - }, - "value": "1400" - }, - { - "name": "MIN_BIN_ID", - "type": "i32", - "value": "- 443636" - }, - { - "name": "MAX_BIN_ID", - "type": "i32", - "value": "443636" - }, - { - "name": "MAX_FEE_RATE", - "type": "u64", - "value": "100_000_000" - }, - { - "name": "FEE_PRECISION", - "type": "u64", - "value": "1_000_000_000" - }, - { - "name": "MAX_PROTOCOL_SHARE", - "type": "u16", - "value": "2_500" - }, - { - "name": "HOST_FEE_BPS", - "type": "u16", - "value": "2_000" - }, - { - "name": "NUM_REWARDS", - "type": { - "defined": "usize" - }, - "value": "2" - }, - { - "name": "MIN_REWARD_DURATION", - "type": "u64", - "value": "1" - }, - { - "name": "MAX_REWARD_DURATION", - "type": "u64", - "value": "31536000" - }, - { - "name": "EXTENSION_BINARRAY_BITMAP_SIZE", - "type": { - "defined": "usize" - }, - "value": "12" - }, - { - "name": "BIN_ARRAY_BITMAP_SIZE", - "type": "i32", - "value": "512" - }, - { - "name": "MAX_REWARD_BIN_SPLIT", - "type": { - "defined": "usize" - }, - "value": "15" - }, - { - "name": "ILM_PROTOCOL_SHARE", - "type": "u16", - "value": "2000" - }, - { - "name": "PROTOCOL_SHARE", - "type": "u16", - "value": "500" - }, - { - "name": "MAX_BIN_STEP", - "type": "u16", - "value": "400" - }, - { - "name": "MAX_BASE_FEE", - "type": "u128", - "value": "100_000_000" - }, - { - "name": "MIN_BASE_FEE", - "type": "u128", - "value": "100_000" - }, - { - "name": "MINIMUM_LIQUIDITY", - "type": "u128", - "value": "1_000_000" - }, - { - "name": "BIN_ARRAY", - "type": "bytes", - "value": "[98, 105, 110, 95, 97, 114, 114, 97, 121]" - }, - { - "name": "ORACLE", - "type": "bytes", - "value": "[111, 114, 97, 99, 108, 101]" - }, - { - "name": "BIN_ARRAY_BITMAP_SEED", - "type": "bytes", - "value": "[98, 105, 116, 109, 97, 112]" - }, - { - "name": "PRESET_PARAMETER", - "type": "bytes", - "value": "[112, 114, 101, 115, 101, 116, 95, 112, 97, 114, 97, 109, 101, 116, 101, 114]" - }, - { - "name": "PRESET_PARAMETER2", - "type": "bytes", - "value": "[112, 114, 101, 115, 101, 116, 95, 112, 97, 114, 97, 109, 101, 116, 101, 114, 50]" - }, - { - "name": "POSITION", - "type": "bytes", - "value": "[112, 111, 115, 105, 116, 105, 111, 110]" - }, - { - "name": "CLAIM_PROTOCOL_FEE_OPERATOR", - "type": "bytes", - "value": "[99, 102, 95, 111, 112, 101, 114, 97, 116, 111, 114]" - } - ], - "instructions": [ - { - "name": "initializeLbPair", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenMintX", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenMintY", - "isMut": false, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "presetParameter", - "isMut": false, - "isSigner": false - }, - { - "name": "funder", - "isMut": true, - "isSigner": true - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "activeId", - "type": "i32" - }, - { - "name": "binStep", - "type": "u16" - } - ] - }, - { - "name": "initializePermissionLbPair", - "accounts": [ - { - "name": "base", - "isMut": false, - "isSigner": true - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenMintX", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenMintY", - "isMut": false, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": true, - "isSigner": true - }, - { - "name": "tokenBadgeX", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenBadgeY", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenProgramX", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgramY", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "ixData", - "type": { - "defined": "InitPermissionPairIx" - } - } - ] - }, - { - "name": "initializeCustomizablePermissionlessLbPair", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenMintX", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenMintY", - "isMut": false, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenX", - "isMut": false, - "isSigner": false - }, - { - "name": "funder", - "isMut": true, - "isSigner": true - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "params", - "type": { - "defined": "CustomizableParams" - } - } - ] - }, - { - "name": "initializeBinArrayBitmapExtension", - "accounts": [ - { - "name": "lbPair", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "docs": [ - "Initialize an account to store if a bin array is initialized." - ] - }, - { - "name": "funder", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "initializeBinArray", - "accounts": [ - { - "name": "lbPair", - "isMut": false, - "isSigner": false - }, - { - "name": "binArray", - "isMut": true, - "isSigner": false - }, - { - "name": "funder", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "index", - "type": "i64" - } - ] - }, - { - "name": "addLiquidity", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityParameter", - "type": { - "defined": "LiquidityParameter" - } - } - ] - }, - { - "name": "addLiquidityByWeight", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityParameter", - "type": { - "defined": "LiquidityParameterByWeight" - } - } - ] - }, - { - "name": "addLiquidityByStrategy", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityParameter", - "type": { - "defined": "LiquidityParameterByStrategy" - } - } - ] - }, - { - "name": "addLiquidityByStrategyOneSide", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userToken", - "isMut": true, - "isSigner": false - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenMint", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityParameter", - "type": { - "defined": "LiquidityParameterByStrategyOneSide" - } - } - ] - }, - { - "name": "addLiquidityOneSide", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userToken", - "isMut": true, - "isSigner": false - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenMint", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityParameter", - "type": { - "defined": "LiquidityOneSideParameter" - } - } - ] - }, - { - "name": "removeLiquidity", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "binLiquidityRemoval", - "type": { - "vec": { - "defined": "BinLiquidityReduction" - } - } - } - ] - }, - { - "name": "initializePosition", - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true - }, - { - "name": "position", - "isMut": true, - "isSigner": true - }, - { - "name": "lbPair", - "isMut": false, - "isSigner": false - }, - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "lowerBinId", - "type": "i32" - }, - { - "name": "width", - "type": "i32" - } - ] - }, - { - "name": "initializePositionPda", - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true - }, - { - "name": "base", - "isMut": false, - "isSigner": true - }, - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": false, - "isSigner": false - }, - { - "name": "owner", - "isMut": false, - "isSigner": true, - "docs": [ - "owner" - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "lowerBinId", - "type": "i32" - }, - { - "name": "width", - "type": "i32" - } - ] - }, - { - "name": "initializePositionByOperator", - "accounts": [ - { - "name": "payer", - "isMut": true, - "isSigner": true - }, - { - "name": "base", - "isMut": false, - "isSigner": true - }, - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": false, - "isSigner": false - }, - { - "name": "owner", - "isMut": false, - "isSigner": false - }, - { - "name": "operator", - "isMut": false, - "isSigner": true, - "docs": [ - "operator" - ] - }, - { - "name": "operatorTokenX", - "isMut": false, - "isSigner": false - }, - { - "name": "ownerTokenX", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "lowerBinId", - "type": "i32" - }, - { - "name": "width", - "type": "i32" - }, - { - "name": "feeOwner", - "type": "publicKey" - }, - { - "name": "lockReleasePoint", - "type": "u64" - } - ] - }, - { - "name": "updatePositionOperator", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "owner", - "isMut": false, - "isSigner": true - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "operator", - "type": "publicKey" - } - ] - }, - { - "name": "swap", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenIn", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenOut", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "hostFeeIn", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "user", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "amountIn", - "type": "u64" - }, - { - "name": "minAmountOut", - "type": "u64" - } - ] - }, - { - "name": "swapExactOut", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenIn", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenOut", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "hostFeeIn", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "user", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "maxInAmount", - "type": "u64" - }, - { - "name": "outAmount", - "type": "u64" - } - ] - }, - { - "name": "swapWithPriceImpact", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenIn", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenOut", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "hostFeeIn", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "user", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "amountIn", - "type": "u64" - }, - { - "name": "activeId", - "type": { - "option": "i32" - } - }, - { - "name": "maxPriceImpactBps", - "type": "u16" - } - ] - }, - { - "name": "withdrawProtocolFee", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "receiverTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "receiverTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "claimFeeOperator", - "isMut": false, - "isSigner": false - }, - { - "name": "operator", - "isMut": false, - "isSigner": true, - "docs": [ - "operator" - ] - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "memoProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "amountX", - "type": "u64" - }, - { - "name": "amountY", - "type": "u64" - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "initializeReward", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "rewardVault", - "isMut": true, - "isSigner": false - }, - { - "name": "rewardMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenBadge", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "admin", - "isMut": true, - "isSigner": true - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "rewardIndex", - "type": "u64" - }, - { - "name": "rewardDuration", - "type": "u64" - }, - { - "name": "funder", - "type": "publicKey" - } - ] - }, - { - "name": "fundReward", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "rewardVault", - "isMut": true, - "isSigner": false - }, - { - "name": "rewardMint", - "isMut": false, - "isSigner": false - }, - { - "name": "funderTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "funder", - "isMut": false, - "isSigner": true - }, - { - "name": "binArray", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "rewardIndex", - "type": "u64" - }, - { - "name": "amount", - "type": "u64" - }, - { - "name": "carryForward", - "type": "bool" - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "updateRewardFunder", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": false, - "isSigner": true - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "rewardIndex", - "type": "u64" - }, - { - "name": "newFunder", - "type": "publicKey" - } - ] - }, - { - "name": "updateRewardDuration", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": false, - "isSigner": true - }, - { - "name": "binArray", - "isMut": true, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "rewardIndex", - "type": "u64" - }, - { - "name": "newDuration", - "type": "u64" - } - ] - }, - { - "name": "claimReward", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "rewardVault", - "isMut": true, - "isSigner": false - }, - { - "name": "rewardMint", - "isMut": false, - "isSigner": false - }, - { - "name": "userTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "rewardIndex", - "type": "u64" - } - ] - }, - { - "name": "claimFee", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "closePosition", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "rentReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "updateBaseFeeParameters", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": false, - "isSigner": true - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "feeParameter", - "type": { - "defined": "BaseFeeParameter" - } - } - ] - }, - { - "name": "updateDynamicFeeParameters", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": false, - "isSigner": true - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "feeParameter", - "type": { - "defined": "DynamicFeeParameter" - } - } - ] - }, - { - "name": "increaseOracleLength", - "accounts": [ - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "funder", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "lengthToAdd", - "type": "u64" - } - ] - }, - { - "name": "initializePresetParameter", - "accounts": [ - { - "name": "presetParameter", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rent", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "ix", - "type": { - "defined": "InitPresetParametersIx" - } - } - ] - }, - { - "name": "closePresetParameter", - "accounts": [ - { - "name": "presetParameter", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": true, - "isSigner": true - }, - { - "name": "rentReceiver", - "isMut": true, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "closePresetParameter2", - "accounts": [ - { - "name": "presetParameter", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": true, - "isSigner": true - }, - { - "name": "rentReceiver", - "isMut": true, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "removeAllLiquidity", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "setPairStatus", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": false, - "isSigner": true - } - ], - "args": [ - { - "name": "status", - "type": "u8" - } - ] - }, - { - "name": "migratePosition", - "accounts": [ - { - "name": "positionV2", - "isMut": true, - "isSigner": true - }, - { - "name": "positionV1", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "owner", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "rentReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "migrateBinArray", - "accounts": [ - { - "name": "lbPair", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "updateFeesAndRewards", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "owner", - "isMut": false, - "isSigner": true - } - ], - "args": [] - }, - { - "name": "withdrawIneligibleReward", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "rewardVault", - "isMut": true, - "isSigner": false - }, - { - "name": "rewardMint", - "isMut": false, - "isSigner": false - }, - { - "name": "funderTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "funder", - "isMut": false, - "isSigner": true - }, - { - "name": "binArray", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "memoProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "rewardIndex", - "type": "u64" - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "setActivationPoint", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": true, - "isSigner": true - } - ], - "args": [ - { - "name": "activationPoint", - "type": "u64" - } - ] - }, - { - "name": "removeLiquidityByRange", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "fromBinId", - "type": "i32" - }, - { - "name": "toBinId", - "type": "i32" - }, - { - "name": "bpsToRemove", - "type": "u16" - } - ] - }, - { - "name": "addLiquidityOneSidePrecise", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userToken", - "isMut": true, - "isSigner": false - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenMint", - "isMut": false, - "isSigner": false - }, - { - "name": "binArrayLower", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayUpper", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "parameter", - "type": { - "defined": "AddLiquiditySingleSidePreciseParameter" - } - } - ] - }, - { - "name": "goToABin", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "fromBinArray", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "toBinArray", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "binId", - "type": "i32" - } - ] - }, - { - "name": "setPreActivationDuration", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "creator", - "isMut": false, - "isSigner": true - } - ], - "args": [ - { - "name": "preActivationDuration", - "type": "u64" - } - ] - }, - { - "name": "setPreActivationSwapAddress", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "creator", - "isMut": false, - "isSigner": true - } - ], - "args": [ - { - "name": "preActivationSwapAddress", - "type": "publicKey" - } - ] - }, - { - "name": "setPairStatusPermissionless", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "creator", - "isMut": false, - "isSigner": true - } - ], - "args": [ - { - "name": "status", - "type": "u8" - } - ] - }, - { - "name": "initializeTokenBadge", - "accounts": [ - { - "name": "tokenMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenBadge", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "createClaimProtocolFeeOperator", - "accounts": [ - { - "name": "claimFeeOperator", - "isMut": true, - "isSigner": false - }, - { - "name": "operator", - "isMut": false, - "isSigner": false - }, - { - "name": "admin", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "closeClaimProtocolFeeOperator", - "accounts": [ - { - "name": "claimFeeOperator", - "isMut": true, - "isSigner": false - }, - { - "name": "rentReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": false, - "isSigner": true - } - ], - "args": [] - }, - { - "name": "initializePresetParameter2", - "accounts": [ - { - "name": "presetParameter", - "isMut": true, - "isSigner": false - }, - { - "name": "admin", - "isMut": true, - "isSigner": true - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "ix", - "type": { - "defined": "InitPresetParameters2Ix" - } - } - ] - }, - { - "name": "initializeLbPair2", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenMintX", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenMintY", - "isMut": false, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "presetParameter", - "isMut": false, - "isSigner": false - }, - { - "name": "funder", - "isMut": true, - "isSigner": true - }, - { - "name": "tokenBadgeX", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenBadgeY", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenProgramX", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgramY", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "params", - "type": { - "defined": "InitializeLbPair2Params" - } - } - ] - }, - { - "name": "initializeCustomizablePermissionlessLbPair2", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenMintX", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenMintY", - "isMut": false, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenX", - "isMut": false, - "isSigner": false - }, - { - "name": "funder", - "isMut": true, - "isSigner": true - }, - { - "name": "tokenBadgeX", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenBadgeY", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "tokenProgramX", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgramY", - "isMut": false, - "isSigner": false - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "params", - "type": { - "defined": "CustomizableParams" - } - } - ] - }, - { - "name": "claimFee2", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgramX", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenProgramY", - "isMut": false, - "isSigner": false - }, - { - "name": "memoProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "minBinId", - "type": "i32" - }, - { - "name": "maxBinId", - "type": "i32" - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "claimReward2", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "rewardVault", - "isMut": true, - "isSigner": false - }, - { - "name": "rewardMint", - "isMut": false, - "isSigner": false - }, - { - "name": "userTokenAccount", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "memoProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "rewardIndex", - "type": "u64" - }, - { - "name": "minBinId", - "type": "i32" - }, - { - "name": "maxBinId", - "type": "i32" - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "addLiquidity2", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityParameter", - "type": { - "defined": "LiquidityParameter" - } - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "addLiquidityByStrategy2", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityParameter", - "type": { - "defined": "LiquidityParameterByStrategy" - } - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "addLiquidityOneSidePrecise2", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userToken", - "isMut": true, - "isSigner": false - }, - { - "name": "reserve", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenMint", - "isMut": false, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "liquidityParameter", - "type": { - "defined": "AddLiquiditySingleSidePreciseParameter2" - } - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "removeLiquidity2", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "memoProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "binLiquidityRemoval", - "type": { - "vec": { - "defined": "BinLiquidityReduction" - } - } - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "removeLiquidityByRange2", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "userTokenX", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenY", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "memoProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "fromBinId", - "type": "i32" - }, - { - "name": "toBinId", - "type": "i32" - }, - { - "name": "bpsToRemove", - "type": "u16" - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "swap2", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenIn", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenOut", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "hostFeeIn", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "user", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "memoProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "amountIn", - "type": "u64" - }, - { - "name": "minAmountOut", - "type": "u64" - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "swapExactOut2", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenIn", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenOut", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "hostFeeIn", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "user", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "memoProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "maxInAmount", - "type": "u64" - }, - { - "name": "outAmount", - "type": "u64" - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "swapWithPriceImpact2", - "accounts": [ - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "binArrayBitmapExtension", - "isMut": false, - "isSigner": false, - "isOptional": true - }, - { - "name": "reserveX", - "isMut": true, - "isSigner": false - }, - { - "name": "reserveY", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenIn", - "isMut": true, - "isSigner": false - }, - { - "name": "userTokenOut", - "isMut": true, - "isSigner": false - }, - { - "name": "tokenXMint", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYMint", - "isMut": false, - "isSigner": false - }, - { - "name": "oracle", - "isMut": true, - "isSigner": false - }, - { - "name": "hostFeeIn", - "isMut": true, - "isSigner": false, - "isOptional": true - }, - { - "name": "user", - "isMut": false, - "isSigner": true - }, - { - "name": "tokenXProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "tokenYProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "memoProgram", - "isMut": false, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [ - { - "name": "amountIn", - "type": "u64" - }, - { - "name": "activeId", - "type": { - "option": "i32" - } - }, - { - "name": "maxPriceImpactBps", - "type": "u16" - }, - { - "name": "remainingAccountsInfo", - "type": { - "defined": "RemainingAccountsInfo" - } - } - ] - }, - { - "name": "closePosition2", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "rentReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [] - }, - { - "name": "updateFeesAndReward2", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "lbPair", - "isMut": true, - "isSigner": false - }, - { - "name": "owner", - "isMut": false, - "isSigner": true - } - ], - "args": [ - { - "name": "minBinId", - "type": "i32" - }, - { - "name": "maxBinId", - "type": "i32" - } - ] - }, - { - "name": "closePositionIfEmpty", - "accounts": [ - { - "name": "position", - "isMut": true, - "isSigner": false - }, - { - "name": "sender", - "isMut": false, - "isSigner": true - }, - { - "name": "rentReceiver", - "isMut": true, - "isSigner": false - }, - { - "name": "eventAuthority", - "isMut": false, - "isSigner": false - }, - { - "name": "program", - "isMut": false, - "isSigner": false - } - ], - "args": [] - } - ], + "constants": [ ], + "instructions": [], "accounts": [ - { - "name": "binArrayBitmapExtension", - "type": { - "kind": "struct", - "fields": [ - { - "name": "lbPair", - "type": "publicKey" - }, - { - "name": "positiveBinArrayBitmap", - "docs": [ - "Packed initialized bin array state for start_bin_index is positive" - ], - "type": { - "array": [ - { - "array": [ - "u64", - 8 - ] - }, - 12 - ] - } - }, - { - "name": "negativeBinArrayBitmap", - "docs": [ - "Packed initialized bin array state for start_bin_index is negative" - ], - "type": { - "array": [ - { - "array": [ - "u64", - 8 - ] - }, - 12 - ] - } - } - ] - } - }, - { - "name": "binArray", - "docs": [ - "An account to contain a range of bin. For example: Bin 100 <-> 200.", - "For example:", - "BinArray index: 0 contains bin 0 <-> 599", - "index: 2 contains bin 600 <-> 1199, ..." - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "index", - "type": "i64" - }, - { - "name": "version", - "docs": [ - "Version of binArray" - ], - "type": "u8" - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 7 - ] - } - }, - { - "name": "lbPair", - "type": "publicKey" - }, - { - "name": "bins", - "type": { - "array": [ - { - "defined": "Bin" - }, - 70 - ] - } - } - ] - } - }, - { - "name": "claimFeeOperator", - "docs": [ - "Parameter that set by the protocol" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "operator", - "docs": [ - "operator" - ], - "type": "publicKey" - }, - { - "name": "padding", - "docs": [ - "Reserve" - ], - "type": { - "array": [ - "u8", - 128 - ] - } - } - ] - } - }, { "name": "lbPair", "type": { "kind": "struct", "fields": [ - { - "name": "parameters", - "type": { - "defined": "StaticParameters" - } - }, - { - "name": "vParameters", - "type": { - "defined": "VariableParameters" - } - }, - { - "name": "bumpSeed", - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "binStepSeed", - "docs": [ - "Bin step signer seed" - ], - "type": { - "array": [ - "u8", - 2 - ] - } - }, - { - "name": "pairType", - "docs": [ - "Type of the pair" - ], - "type": "u8" - }, - { - "name": "activeId", - "docs": [ - "Active bin id" - ], - "type": "i32" - }, - { - "name": "binStep", - "docs": [ - "Bin step. Represent the price increment / decrement." - ], - "type": "u16" - }, - { - "name": "status", - "docs": [ - "Status of the pair. Check PairStatus enum." - ], - "type": "u8" - }, - { - "name": "requireBaseFactorSeed", - "docs": [ - "Require base factor seed" - ], - "type": "u8" - }, - { - "name": "baseFactorSeed", - "docs": [ - "Base factor seed" - ], - "type": { - "array": [ - "u8", - 2 - ] - } - }, - { - "name": "activationType", - "docs": [ - "Activation type" - ], - "type": "u8" - }, + {"name": "parameters", "type": {"defined": "StaticParameters"}}, + {"name": "vParameters", "type": {"defined": "VariableParameters"}}, + {"name": "bumpSeed", "type": {"array": ["u8", 1]}}, + {"name": "binStepSeed", "docs": ["Bin step signer seed"], "type": {"array": ["u8", 2]}}, + {"name": "pairType", "docs": ["Type of the pair"], "type": "u8"}, + {"name": "activeId", "docs": ["Active bin id"], "type": "i32"}, + {"name": "binStep", "docs": ["Bin step. Represent the price increment / decrement."], "type": "u16"}, + {"name": "status", "docs": ["Status of the pair. Check PairStatus enum."], "type": "u8"}, + {"name": "requireBaseFactorSeed", "docs": ["Require base factor seed"], "type": "u8"}, + {"name": "baseFactorSeed", "docs": ["Base factor seed"], "type": {"array": ["u8", 2]}}, + {"name": "activationType", "docs": ["Activation type"], "type": "u8"}, { "name": "creatorPoolOnOffControl", - "docs": [ - "Allow pool creator to enable/disable pool with restricted validation. Only applicable for customizable permissionless pair type." - ], + "docs": ["Allow pool creator to enable/disable pool with restricted validation. Only applicable for customizable permissionless pair type."], "type": "u8" }, - { - "name": "tokenXMint", - "docs": [ - "Token X mint" - ], - "type": "publicKey" - }, - { - "name": "tokenYMint", - "docs": [ - "Token Y mint" - ], - "type": "publicKey" - }, - { - "name": "reserveX", - "docs": [ - "LB token X vault" - ], - "type": "publicKey" - }, - { - "name": "reserveY", - "docs": [ - "LB token Y vault" - ], - "type": "publicKey" - }, - { - "name": "protocolFee", - "docs": [ - "Uncollected protocol fee" - ], - "type": { - "defined": "ProtocolFee" - } - }, - { - "name": "padding1", - "docs": [ - "_padding_1, previous Fee owner, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!" - ], - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "rewardInfos", - "docs": [ - "Farming reward information" - ], - "type": { - "array": [ - { - "defined": "RewardInfo" - }, - 2 - ] - } - }, - { - "name": "oracle", - "docs": [ - "Oracle pubkey" - ], - "type": "publicKey" - }, - { - "name": "binArrayBitmap", - "docs": [ - "Packed initialized bin array state" - ], - "type": { - "array": [ - "u64", - 16 - ] - } - }, - { - "name": "lastUpdatedAt", - "docs": [ - "Last time the pool fee parameter was updated" - ], - "type": "i64" - }, + {"name": "tokenXMint", "docs": ["Token X mint"], "type": "publicKey"}, + {"name": "tokenYMint", "docs": ["Token Y mint"], "type": "publicKey"}, + {"name": "reserveX", "docs": ["LB token X vault"], "type": "publicKey"}, + {"name": "reserveY", "docs": ["LB token Y vault"], "type": "publicKey"}, + {"name": "protocolFee", "docs": ["Uncollected protocol fee"], "type": {"defined": "ProtocolFee"}}, + {"name": "padding1", "docs": ["_padding_1, previous Fee owner, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!"], "type": {"array": ["u8", 32]}}, + {"name": "rewardInfos", "docs": ["Farming reward information"], "type": {"array": [{"defined": "RewardInfo"}, 2]}}, + {"name": "oracle", "docs": ["Oracle pubkey"], "type": "publicKey"}, + {"name": "binArrayBitmap", "docs": ["Packed initialized bin array state"], "type": {"array": ["u64", 16]}}, + {"name": "lastUpdatedAt", "docs": ["Last time the pool fee parameter was updated"], "type": "i64"}, { "name": "padding2", - "docs": [ - "_padding_2, previous whitelisted_wallet, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!" - ], - "type": { - "array": [ - "u8", - 32 - ] - } + "docs": ["_padding_2, previous whitelisted_wallet, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!"], + "type": {"array": ["u8", 32]} }, { "name": "preActivationSwapAddress", @@ -4434,25 +47,11 @@ ], "type": "publicKey" }, - { - "name": "baseKey", - "docs": [ - "Base keypair. Only required for permission pair" - ], - "type": "publicKey" - }, - { - "name": "activationPoint", - "docs": [ - "Time point to enable the pair. Only applicable for permission pair." - ], - "type": "u64" - }, + {"name": "baseKey", "docs": ["Base keypair. Only required for permission pair"], "type": "publicKey"}, + {"name": "activationPoint", "docs": ["Time point to enable the pair. Only applicable for permission pair."], "type": "u64"}, { "name": "preActivationDuration", - "docs": [ - "Duration before activation activation_point. Used to calculate pre-activation time point for pre_activation_swap_address" - ], + "docs": ["Duration before activation activation_point. Used to calculate pre-activation time point for pre_activation_swap_address"], "type": "u64" }, { @@ -4460,1551 +59,40 @@ "docs": [ "_padding 3 is reclaimed free space from swap_cap_deactivate_point and swap_cap_amount before, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!" ], - "type": { - "array": [ - "u8", - 8 - ] - } + "type": {"array": ["u8", 8]} }, - { - "name": "padding4", - "docs": [ - "_padding_4, previous lock_duration, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!" - ], - "type": "u64" - }, - { - "name": "creator", - "docs": [ - "Pool creator" - ], - "type": "publicKey" - }, - { - "name": "tokenMintXProgramFlag", - "docs": [ - "token_mint_x_program_flag" - ], - "type": "u8" - }, - { - "name": "tokenMintYProgramFlag", - "docs": [ - "token_mint_y_program_flag" - ], - "type": "u8" - }, - { - "name": "reserved", - "docs": [ - "Reserved space for future use" - ], - "type": { - "array": [ - "u8", - 22 - ] - } - } - ] - } - }, - { - "name": "oracle", - "type": { - "kind": "struct", - "fields": [ - { - "name": "idx", - "docs": [ - "Index of latest observation" - ], - "type": "u64" - }, - { - "name": "activeSize", - "docs": [ - "Size of active sample. Active sample is initialized observation." - ], - "type": "u64" - }, - { - "name": "length", - "docs": [ - "Number of observations" - ], - "type": "u64" - } - ] - } - }, - { - "name": "position", - "type": { - "kind": "struct", - "fields": [ - { - "name": "lbPair", - "docs": [ - "The LB pair of this position" - ], - "type": "publicKey" - }, - { - "name": "owner", - "docs": [ - "Owner of the position. Client rely on this to to fetch their positions." - ], - "type": "publicKey" - }, - { - "name": "liquidityShares", - "docs": [ - "Liquidity shares of this position in bins (lower_bin_id <-> upper_bin_id). This is the same as LP concept." - ], - "type": { - "array": [ - "u64", - 70 - ] - } - }, - { - "name": "rewardInfos", - "docs": [ - "Farming reward information" - ], - "type": { - "array": [ - { - "defined": "UserRewardInfo" - }, - 70 - ] - } - }, - { - "name": "feeInfos", - "docs": [ - "Swap fee to claim information" - ], - "type": { - "array": [ - { - "defined": "FeeInfo" - }, - 70 - ] - } - }, - { - "name": "lowerBinId", - "docs": [ - "Lower bin ID" - ], - "type": "i32" - }, - { - "name": "upperBinId", - "docs": [ - "Upper bin ID" - ], - "type": "i32" - }, - { - "name": "lastUpdatedAt", - "docs": [ - "Last updated timestamp" - ], - "type": "i64" - }, - { - "name": "totalClaimedFeeXAmount", - "docs": [ - "Total claimed token fee X" - ], - "type": "u64" - }, - { - "name": "totalClaimedFeeYAmount", - "docs": [ - "Total claimed token fee Y" - ], - "type": "u64" - }, - { - "name": "totalClaimedRewards", - "docs": [ - "Total claimed rewards" - ], - "type": { - "array": [ - "u64", - 2 - ] - } - }, - { - "name": "reserved", - "docs": [ - "Reserved space for future use" - ], - "type": { - "array": [ - "u8", - 160 - ] - } - } - ] - } - }, - { - "name": "positionV2", - "type": { - "kind": "struct", - "fields": [ - { - "name": "lbPair", - "docs": [ - "The LB pair of this position" - ], - "type": "publicKey" - }, - { - "name": "owner", - "docs": [ - "Owner of the position. Client rely on this to to fetch their positions." - ], - "type": "publicKey" - }, - { - "name": "liquidityShares", - "docs": [ - "Liquidity shares of this position in bins (lower_bin_id <-> upper_bin_id). This is the same as LP concept." - ], - "type": { - "array": [ - "u128", - 70 - ] - } - }, - { - "name": "rewardInfos", - "docs": [ - "Farming reward information" - ], - "type": { - "array": [ - { - "defined": "UserRewardInfo" - }, - 70 - ] - } - }, - { - "name": "feeInfos", - "docs": [ - "Swap fee to claim information" - ], - "type": { - "array": [ - { - "defined": "FeeInfo" - }, - 70 - ] - } - }, - { - "name": "lowerBinId", - "docs": [ - "Lower bin ID" - ], - "type": "i32" - }, - { - "name": "upperBinId", - "docs": [ - "Upper bin ID" - ], - "type": "i32" - }, - { - "name": "lastUpdatedAt", - "docs": [ - "Last updated timestamp" - ], - "type": "i64" - }, - { - "name": "totalClaimedFeeXAmount", - "docs": [ - "Total claimed token fee X" - ], - "type": "u64" - }, - { - "name": "totalClaimedFeeYAmount", - "docs": [ - "Total claimed token fee Y" - ], - "type": "u64" - }, - { - "name": "totalClaimedRewards", - "docs": [ - "Total claimed rewards" - ], - "type": { - "array": [ - "u64", - 2 - ] - } - }, - { - "name": "operator", - "docs": [ - "Operator of position" - ], - "type": "publicKey" - }, - { - "name": "lockReleasePoint", - "docs": [ - "Time point which the locked liquidity can be withdraw" - ], - "type": "u64" - }, - { - "name": "padding0", - "docs": [ - "_padding_0, previous subjected_to_bootstrap_liquidity_locking, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!" - ], - "type": "u8" - }, - { - "name": "feeOwner", - "docs": [ - "Address is able to claim fee in this position, only valid for bootstrap_liquidity_position" - ], - "type": "publicKey" - }, - { - "name": "reserved", - "docs": [ - "Reserved space for future use" - ], - "type": { - "array": [ - "u8", - 87 - ] - } - } - ] - } - }, - { - "name": "presetParameter2", - "type": { - "kind": "struct", - "fields": [ - { - "name": "binStep", - "docs": [ - "Bin step. Represent the price increment / decrement." - ], - "type": "u16" - }, - { - "name": "baseFactor", - "docs": [ - "Used for base fee calculation. base_fee_rate = base_factor * bin_step * 10 * 10^base_fee_power_factor" - ], - "type": "u16" - }, - { - "name": "filterPeriod", - "docs": [ - "Filter period determine high frequency trading time window." - ], - "type": "u16" - }, - { - "name": "decayPeriod", - "docs": [ - "Decay period determine when the volatile fee start decay / decrease." - ], - "type": "u16" - }, - { - "name": "variableFeeControl", - "docs": [ - "Used to scale the variable fee component depending on the dynamic of the market" - ], - "type": "u32" - }, - { - "name": "maxVolatilityAccumulator", - "docs": [ - "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." - ], - "type": "u32" - }, - { - "name": "reductionFactor", - "docs": [ - "Reduction factor controls the volatile fee rate decrement rate." - ], - "type": "u16" - }, - { - "name": "protocolShare", - "docs": [ - "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" - ], - "type": "u16" - }, - { - "name": "index", - "docs": [ - "index" - ], - "type": "u16" - }, - { - "name": "baseFeePowerFactor", - "docs": [ - "Base fee power factor" - ], - "type": "u8" - }, - { - "name": "padding0", - "docs": [ - "Padding 0 for future use" - ], - "type": "u8" - }, - { - "name": "padding1", - "docs": [ - "Padding 1 for future use" - ], - "type": { - "array": [ - "u64", - 20 - ] - } - } - ] - } - }, - { - "name": "presetParameter", - "type": { - "kind": "struct", - "fields": [ - { - "name": "binStep", - "docs": [ - "Bin step. Represent the price increment / decrement." - ], - "type": "u16" - }, - { - "name": "baseFactor", - "docs": [ - "Used for base fee calculation. base_fee_rate = base_factor * bin_step * 10 * 10^base_fee_power_factor" - ], - "type": "u16" - }, - { - "name": "filterPeriod", - "docs": [ - "Filter period determine high frequency trading time window." - ], - "type": "u16" - }, - { - "name": "decayPeriod", - "docs": [ - "Decay period determine when the volatile fee start decay / decrease." - ], - "type": "u16" - }, - { - "name": "reductionFactor", - "docs": [ - "Reduction factor controls the volatile fee rate decrement rate." - ], - "type": "u16" - }, - { - "name": "variableFeeControl", - "docs": [ - "Used to scale the variable fee component depending on the dynamic of the market" - ], - "type": "u32" - }, - { - "name": "maxVolatilityAccumulator", - "docs": [ - "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." - ], - "type": "u32" - }, - { - "name": "minBinId", - "docs": [ - "Min bin id supported by the pool based on the configured bin step." - ], - "type": "i32" - }, - { - "name": "maxBinId", - "docs": [ - "Max bin id supported by the pool based on the configured bin step." - ], - "type": "i32" - }, - { - "name": "protocolShare", - "docs": [ - "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" - ], - "type": "u16" - } - ] - } - }, - { - "name": "tokenBadge", - "docs": [ - "Parameter that set by the protocol" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "tokenMint", - "docs": [ - "token mint" - ], - "type": "publicKey" - }, - { - "name": "padding", - "docs": [ - "Reserve" - ], - "type": { - "array": [ - "u8", - 128 - ] - } - } + {"name": "padding4", "docs": ["_padding_4, previous lock_duration, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!"], "type": "u64"}, + {"name": "creator", "docs": ["Pool creator"], "type": "publicKey"}, + {"name": "tokenMintXProgramFlag", "docs": ["token_mint_x_program_flag"], "type": "u8"}, + {"name": "tokenMintYProgramFlag", "docs": ["token_mint_y_program_flag"], "type": "u8"}, + {"name": "reserved", "docs": ["Reserved space for future use"], "type": {"array": ["u8", 22]}} ] } } ], "types": [ - { - "name": "InitPresetParameters2Ix", - "type": { - "kind": "struct", - "fields": [ - { - "name": "index", - "type": "u16" - }, - { - "name": "binStep", - "docs": [ - "Bin step. Represent the price increment / decrement." - ], - "type": "u16" - }, - { - "name": "baseFactor", - "docs": [ - "Used for base fee calculation. base_fee_rate = base_factor * bin_step * 10 * 10^base_fee_power_factor" - ], - "type": "u16" - }, - { - "name": "filterPeriod", - "docs": [ - "Filter period determine high frequency trading time window." - ], - "type": "u16" - }, - { - "name": "decayPeriod", - "docs": [ - "Decay period determine when the volatile fee start decay / decrease." - ], - "type": "u16" - }, - { - "name": "reductionFactor", - "docs": [ - "Reduction factor controls the volatile fee rate decrement rate." - ], - "type": "u16" - }, - { - "name": "variableFeeControl", - "docs": [ - "Used to scale the variable fee component depending on the dynamic of the market" - ], - "type": "u32" - }, - { - "name": "maxVolatilityAccumulator", - "docs": [ - "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." - ], - "type": "u32" - }, - { - "name": "protocolShare", - "docs": [ - "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" - ], - "type": "u16" - }, - { - "name": "baseFeePowerFactor", - "docs": [ - "Base fee power factor" - ], - "type": "u8" - } - ] - } - }, - { - "name": "InitPresetParametersIx", - "type": { - "kind": "struct", - "fields": [ - { - "name": "binStep", - "docs": [ - "Bin step. Represent the price increment / decrement." - ], - "type": "u16" - }, - { - "name": "baseFactor", - "docs": [ - "Used for base fee calculation. base_fee_rate = base_factor * bin_step * 10 * 10^base_fee_power_factor" - ], - "type": "u16" - }, - { - "name": "filterPeriod", - "docs": [ - "Filter period determine high frequency trading time window." - ], - "type": "u16" - }, - { - "name": "decayPeriod", - "docs": [ - "Decay period determine when the volatile fee start decay / decrease." - ], - "type": "u16" - }, - { - "name": "reductionFactor", - "docs": [ - "Reduction factor controls the volatile fee rate decrement rate." - ], - "type": "u16" - }, - { - "name": "variableFeeControl", - "docs": [ - "Used to scale the variable fee component depending on the dynamic of the market" - ], - "type": "u32" - }, - { - "name": "maxVolatilityAccumulator", - "docs": [ - "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." - ], - "type": "u32" - }, - { - "name": "protocolShare", - "docs": [ - "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" - ], - "type": "u16" - } - ] - } - }, - { - "name": "BaseFeeParameter", - "type": { - "kind": "struct", - "fields": [ - { - "name": "protocolShare", - "docs": [ - "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" - ], - "type": "u16" - }, - { - "name": "baseFactor", - "docs": [ - "Base factor for base fee rate" - ], - "type": "u16" - }, - { - "name": "baseFeePowerFactor", - "docs": [ - "Base fee power factor" - ], - "type": "u8" - } - ] - } - }, - { - "name": "DynamicFeeParameter", - "type": { - "kind": "struct", - "fields": [ - { - "name": "filterPeriod", - "docs": [ - "Filter period determine high frequency trading time window." - ], - "type": "u16" - }, - { - "name": "decayPeriod", - "docs": [ - "Decay period determine when the volatile fee start decay / decrease." - ], - "type": "u16" - }, - { - "name": "reductionFactor", - "docs": [ - "Reduction factor controls the volatile fee rate decrement rate." - ], - "type": "u16" - }, - { - "name": "variableFeeControl", - "docs": [ - "Used to scale the variable fee component depending on the dynamic of the market" - ], - "type": "u32" - }, - { - "name": "maxVolatilityAccumulator", - "docs": [ - "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." - ], - "type": "u32" - } - ] - } - }, - { - "name": "LiquidityParameterByStrategyOneSide", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount", - "docs": [ - "Amount of X token or Y token to deposit" - ], - "type": "u64" - }, - { - "name": "activeId", - "docs": [ - "Active bin that integrator observe off-chain" - ], - "type": "i32" - }, - { - "name": "maxActiveBinSlippage", - "docs": [ - "max active bin slippage allowed" - ], - "type": "i32" - }, - { - "name": "strategyParameters", - "docs": [ - "strategy parameters" - ], - "type": { - "defined": "StrategyParameters" - } - } - ] - } - }, - { - "name": "LiquidityParameterByStrategy", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amountX", - "docs": [ - "Amount of X token to deposit" - ], - "type": "u64" - }, - { - "name": "amountY", - "docs": [ - "Amount of Y token to deposit" - ], - "type": "u64" - }, - { - "name": "activeId", - "docs": [ - "Active bin that integrator observe off-chain" - ], - "type": "i32" - }, - { - "name": "maxActiveBinSlippage", - "docs": [ - "max active bin slippage allowed" - ], - "type": "i32" - }, - { - "name": "strategyParameters", - "docs": [ - "strategy parameters" - ], - "type": { - "defined": "StrategyParameters" - } - } - ] - } - }, - { - "name": "StrategyParameters", - "type": { - "kind": "struct", - "fields": [ - { - "name": "minBinId", - "docs": [ - "min bin id" - ], - "type": "i32" - }, - { - "name": "maxBinId", - "docs": [ - "max bin id" - ], - "type": "i32" - }, - { - "name": "strategyType", - "docs": [ - "strategy type" - ], - "type": { - "defined": "StrategyType" - } - }, - { - "name": "parameteres", - "docs": [ - "parameters" - ], - "type": { - "array": [ - "u8", - 64 - ] - } - } - ] - } - }, - { - "name": "LiquidityOneSideParameter", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amount", - "docs": [ - "Amount of X token or Y token to deposit" - ], - "type": "u64" - }, - { - "name": "activeId", - "docs": [ - "Active bin that integrator observe off-chain" - ], - "type": "i32" - }, - { - "name": "maxActiveBinSlippage", - "docs": [ - "max active bin slippage allowed" - ], - "type": "i32" - }, - { - "name": "binLiquidityDist", - "docs": [ - "Liquidity distribution to each bins" - ], - "type": { - "vec": { - "defined": "BinLiquidityDistributionByWeight" - } - } - } - ] - } - }, - { - "name": "BinLiquidityDistributionByWeight", - "type": { - "kind": "struct", - "fields": [ - { - "name": "binId", - "docs": [ - "Define the bin ID wish to deposit to." - ], - "type": "i32" - }, - { - "name": "weight", - "docs": [ - "weight of liquidity distributed for this bin id" - ], - "type": "u16" - } - ] - } - }, - { - "name": "LiquidityParameterByWeight", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amountX", - "docs": [ - "Amount of X token to deposit" - ], - "type": "u64" - }, - { - "name": "amountY", - "docs": [ - "Amount of Y token to deposit" - ], - "type": "u64" - }, - { - "name": "activeId", - "docs": [ - "Active bin that integrator observe off-chain" - ], - "type": "i32" - }, - { - "name": "maxActiveBinSlippage", - "docs": [ - "max active bin slippage allowed" - ], - "type": "i32" - }, - { - "name": "binLiquidityDist", - "docs": [ - "Liquidity distribution to each bins" - ], - "type": { - "vec": { - "defined": "BinLiquidityDistributionByWeight" - } - } - } - ] - } - }, - { - "name": "AddLiquiditySingleSidePreciseParameter", - "type": { - "kind": "struct", - "fields": [ - { - "name": "bins", - "type": { - "vec": { - "defined": "CompressedBinDepositAmount" - } - } - }, - { - "name": "decompressMultiplier", - "type": "u64" - } - ] - } - }, - { - "name": "CompressedBinDepositAmount", - "type": { - "kind": "struct", - "fields": [ - { - "name": "binId", - "type": "i32" - }, - { - "name": "amount", - "type": "u32" - } - ] - } - }, - { - "name": "BinLiquidityDistribution", - "type": { - "kind": "struct", - "fields": [ - { - "name": "binId", - "docs": [ - "Define the bin ID wish to deposit to." - ], - "type": "i32" - }, - { - "name": "distributionX", - "docs": [ - "DistributionX (or distributionY) is the percentages of amountX (or amountY) you want to add to each bin." - ], - "type": "u16" - }, - { - "name": "distributionY", - "docs": [ - "DistributionX (or distributionY) is the percentages of amountX (or amountY) you want to add to each bin." - ], - "type": "u16" - } - ] - } - }, - { - "name": "LiquidityParameter", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amountX", - "docs": [ - "Amount of X token to deposit" - ], - "type": "u64" - }, - { - "name": "amountY", - "docs": [ - "Amount of Y token to deposit" - ], - "type": "u64" - }, - { - "name": "binLiquidityDist", - "docs": [ - "Liquidity distribution to each bins" - ], - "type": { - "vec": { - "defined": "BinLiquidityDistribution" - } - } - } - ] - } - }, - { - "name": "CustomizableParams", - "type": { - "kind": "struct", - "fields": [ - { - "name": "activeId", - "docs": [ - "Pool price" - ], - "type": "i32" - }, - { - "name": "binStep", - "docs": [ - "Bin step" - ], - "type": "u16" - }, - { - "name": "baseFactor", - "docs": [ - "Base factor" - ], - "type": "u16" - }, - { - "name": "activationType", - "docs": [ - "Activation type. 0 = Slot, 1 = Time. Check ActivationType enum" - ], - "type": "u8" - }, - { - "name": "hasAlphaVault", - "docs": [ - "Whether the pool has an alpha vault" - ], - "type": "bool" - }, - { - "name": "activationPoint", - "docs": [ - "Decide when does the pool start trade. None = Now" - ], - "type": { - "option": "u64" - } - }, - { - "name": "creatorPoolOnOffControl", - "docs": [ - "Pool creator have permission to enable/disable pool with restricted program validation. Only applicable for customizable permissionless pool." - ], - "type": "bool" - }, - { - "name": "baseFeePowerFactor", - "docs": [ - "Base fee power factor" - ], - "type": "u8" - }, - { - "name": "padding", - "docs": [ - "Padding, for future use" - ], - "type": { - "array": [ - "u8", - 62 - ] - } - } - ] - } - }, - { - "name": "InitPermissionPairIx", - "type": { - "kind": "struct", - "fields": [ - { - "name": "activeId", - "type": "i32" - }, - { - "name": "binStep", - "type": "u16" - }, - { - "name": "baseFactor", - "type": "u16" - }, - { - "name": "baseFeePowerFactor", - "type": "u8" - }, - { - "name": "activationType", - "type": "u8" - }, - { - "name": "protocolShare", - "type": "u16" - } - ] - } - }, - { - "name": "AddLiquiditySingleSidePreciseParameter2", - "type": { - "kind": "struct", - "fields": [ - { - "name": "bins", - "type": { - "vec": { - "defined": "CompressedBinDepositAmount" - } - } - }, - { - "name": "decompressMultiplier", - "type": "u64" - }, - { - "name": "maxAmount", - "type": "u64" - } - ] - } - }, - { - "name": "CompressedBinDepositAmount2", - "type": { - "kind": "struct", - "fields": [ - { - "name": "binId", - "type": "i32" - }, - { - "name": "amount", - "type": "u32" - } - ] - } - }, - { - "name": "InitializeLbPair2Params", - "type": { - "kind": "struct", - "fields": [ - { - "name": "activeId", - "docs": [ - "Pool price" - ], - "type": "i32" - }, - { - "name": "padding", - "docs": [ - "Padding, for future use" - ], - "type": { - "array": [ - "u8", - 96 - ] - } - } - ] - } - }, - { - "name": "BinLiquidityReduction", - "type": { - "kind": "struct", - "fields": [ - { - "name": "binId", - "type": "i32" - }, - { - "name": "bpsToRemove", - "type": "u16" - } - ] - } - }, - { - "name": "Bin", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amountX", - "docs": [ - "Amount of token X in the bin. This already excluded protocol fees." - ], - "type": "u64" - }, - { - "name": "amountY", - "docs": [ - "Amount of token Y in the bin. This already excluded protocol fees." - ], - "type": "u64" - }, - { - "name": "price", - "docs": [ - "Bin price" - ], - "type": "u128" - }, - { - "name": "liquiditySupply", - "docs": [ - "Liquidities of the bin. This is the same as LP mint supply. q-number" - ], - "type": "u128" - }, - { - "name": "rewardPerTokenStored", - "docs": [ - "reward_a_per_token_stored" - ], - "type": { - "array": [ - "u128", - 2 - ] - } - }, - { - "name": "feeAmountXPerTokenStored", - "docs": [ - "Swap fee amount of token X per liquidity deposited." - ], - "type": "u128" - }, - { - "name": "feeAmountYPerTokenStored", - "docs": [ - "Swap fee amount of token Y per liquidity deposited." - ], - "type": "u128" - }, - { - "name": "amountXIn", - "docs": [ - "Total token X swap into the bin. Only used for tracking purpose." - ], - "type": "u128" - }, - { - "name": "amountYIn", - "docs": [ - "Total token Y swap into he bin. Only used for tracking purpose." - ], - "type": "u128" - } - ] - } - }, - { - "name": "ProtocolFee", - "type": { - "kind": "struct", - "fields": [ - { - "name": "amountX", - "type": "u64" - }, - { - "name": "amountY", - "type": "u64" - } - ] - } - }, - { - "name": "RewardInfo", - "docs": [ - "Stores the state relevant for tracking liquidity mining rewards" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "mint", - "docs": [ - "Reward token mint." - ], - "type": "publicKey" - }, - { - "name": "vault", - "docs": [ - "Reward vault token account." - ], - "type": "publicKey" - }, - { - "name": "funder", - "docs": [ - "Authority account that allows to fund rewards" - ], - "type": "publicKey" - }, - { - "name": "rewardDuration", - "docs": [ - "TODO check whether we need to store it in pool" - ], - "type": "u64" - }, - { - "name": "rewardDurationEnd", - "docs": [ - "TODO check whether we need to store it in pool" - ], - "type": "u64" - }, - { - "name": "rewardRate", - "docs": [ - "TODO check whether we need to store it in pool" - ], - "type": "u128" - }, - { - "name": "lastUpdateTime", - "docs": [ - "The last time reward states were updated." - ], - "type": "u64" - }, - { - "name": "cumulativeSecondsWithEmptyLiquidityReward", - "docs": [ - "Accumulated seconds where when farm distribute rewards, but the bin is empty. The reward will be accumulated for next reward time window." - ], - "type": "u64" - } - ] - } - }, - { - "name": "Observation", - "type": { - "kind": "struct", - "fields": [ - { - "name": "cumulativeActiveBinId", - "docs": [ - "Cumulative active bin ID" - ], - "type": "i128" - }, - { - "name": "createdAt", - "docs": [ - "Observation sample created timestamp" - ], - "type": "i64" - }, - { - "name": "lastUpdatedAt", - "docs": [ - "Observation sample last updated timestamp" - ], - "type": "i64" - } - ] - } - }, { "name": "StaticParameters", - "docs": [ - "Parameter that set by the protocol" - ], + "docs": ["Parameter that set by the protocol"], "type": { "kind": "struct", "fields": [ { "name": "baseFactor", - "docs": [ - "Used for base fee calculation. base_fee_rate = base_factor * bin_step * 10 * 10^base_fee_power_factor" - ], + "docs": ["Used for base fee calculation. base_fee_rate = base_factor * bin_step * 10 * 10^base_fee_power_factor"], "type": "u16" }, - { - "name": "filterPeriod", - "docs": [ - "Filter period determine high frequency trading time window." - ], - "type": "u16" - }, - { - "name": "decayPeriod", - "docs": [ - "Decay period determine when the volatile fee start decay / decrease." - ], - "type": "u16" - }, - { - "name": "reductionFactor", - "docs": [ - "Reduction factor controls the volatile fee rate decrement rate." - ], - "type": "u16" - }, - { - "name": "variableFeeControl", - "docs": [ - "Used to scale the variable fee component depending on the dynamic of the market" - ], - "type": "u32" - }, + {"name": "filterPeriod", "docs": ["Filter period determine high frequency trading time window."], "type": "u16"}, + {"name": "decayPeriod", "docs": ["Decay period determine when the volatile fee start decay / decrease."], "type": "u16"}, + {"name": "reductionFactor", "docs": ["Reduction factor controls the volatile fee rate decrement rate."], "type": "u16"}, + {"name": "variableFeeControl", "docs": ["Used to scale the variable fee component depending on the dynamic of the market"], "type": "u32"}, { "name": "maxVolatilityAccumulator", - "docs": [ - "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." - ], + "docs": ["Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate."], "type": "u32" }, - { - "name": "minBinId", - "docs": [ - "Min bin id supported by the pool based on the configured bin step." - ], - "type": "i32" - }, - { - "name": "maxBinId", - "docs": [ - "Max bin id supported by the pool based on the configured bin step." - ], - "type": "i32" - }, + {"name": "minBinId", "docs": ["Min bin id supported by the pool based on the configured bin step."], "type": "i32"}, + {"name": "maxBinId", "docs": ["Max bin id supported by the pool based on the configured bin step."], "type": "i32"}, { "name": "protocolShare", "docs": [ @@ -6012,33 +100,14 @@ ], "type": "u16" }, - { - "name": "baseFeePowerFactor", - "docs": [ - "Base fee power factor" - ], - "type": "u8" - }, - { - "name": "padding", - "docs": [ - "Padding for bytemuck safe alignment" - ], - "type": { - "array": [ - "u8", - 5 - ] - } - } + {"name": "baseFeePowerFactor", "docs": ["Base fee power factor"], "type": "u8"}, + {"name": "padding", "docs": ["Padding for bytemuck safe alignment"], "type": {"array": ["u8", 5]}} ] } }, { "name": "VariableParameters", - "docs": [ - "Parameters that changes based on dynamic of the market" - ], + "docs": ["Parameters that changes based on dynamic of the market"], "type": { "kind": "struct", "fields": [ @@ -6052,1318 +121,41 @@ }, { "name": "volatilityReference", - "docs": [ - "Volatility reference is decayed volatility accumulator. It is always <= volatility_accumulator" - ], + "docs": ["Volatility reference is decayed volatility accumulator. It is always <= volatility_accumulator"], "type": "u32" }, - { - "name": "indexReference", - "docs": [ - "Active bin id of last swap." - ], - "type": "i32" - }, - { - "name": "padding", - "docs": [ - "Padding for bytemuck safe alignment" - ], - "type": { - "array": [ - "u8", - 4 - ] - } - }, - { - "name": "lastUpdateTimestamp", - "docs": [ - "Last timestamp the variable parameters was updated" - ], - "type": "i64" - }, - { - "name": "padding1", - "docs": [ - "Padding for bytemuck safe alignment" - ], - "type": { - "array": [ - "u8", - 8 - ] - } - } + {"name": "indexReference", "docs": ["Active bin id of last swap."], "type": "i32"}, + {"name": "padding", "docs": ["Padding for bytemuck safe alignment"], "type": {"array": ["u8", 4]}}, + {"name": "lastUpdateTimestamp", "docs": ["Last timestamp the variable parameters was updated"], "type": "i64"}, + {"name": "padding1", "docs": ["Padding for bytemuck safe alignment"], "type": {"array": ["u8", 8]}} ] } }, + {"name": "ProtocolFee", "type": {"kind": "struct", "fields": [{"name": "amountX", "type": "u64"}, {"name": "amountY", "type": "u64"}]}}, { - "name": "FeeInfo", + "name": "RewardInfo", + "docs": ["Stores the state relevant for tracking liquidity mining rewards"], "type": { "kind": "struct", "fields": [ + {"name": "mint", "docs": ["Reward token mint."], "type": "publicKey"}, + {"name": "vault", "docs": ["Reward vault token account."], "type": "publicKey"}, + {"name": "funder", "docs": ["Authority account that allows to fund rewards"], "type": "publicKey"}, + {"name": "rewardDuration", "docs": ["TODO check whether we need to store it in pool"], "type": "u64"}, + {"name": "rewardDurationEnd", "docs": ["TODO check whether we need to store it in pool"], "type": "u64"}, + {"name": "rewardRate", "docs": ["TODO check whether we need to store it in pool"], "type": "u128"}, + {"name": "lastUpdateTime", "docs": ["The last time reward states were updated."], "type": "u64"}, { - "name": "feeXPerTokenComplete", - "type": "u128" - }, - { - "name": "feeYPerTokenComplete", - "type": "u128" - }, - { - "name": "feeXPending", + "name": "cumulativeSecondsWithEmptyLiquidityReward", + "docs": [ + "Accumulated seconds where when farm distribute rewards, but the bin is empty. The reward will be accumulated for next reward time window." + ], "type": "u64" - }, - { - "name": "feeYPending", - "type": "u64" - } - ] - } - }, - { - "name": "UserRewardInfo", - "type": { - "kind": "struct", - "fields": [ - { - "name": "rewardPerTokenCompletes", - "type": { - "array": [ - "u128", - 2 - ] - } - }, - { - "name": "rewardPendings", - "type": { - "array": [ - "u64", - 2 - ] - } - } - ] - } - }, - { - "name": "RemainingAccountsSlice", - "type": { - "kind": "struct", - "fields": [ - { - "name": "accountsType", - "type": { - "defined": "AccountsType" - } - }, - { - "name": "length", - "type": "u8" - } - ] - } - }, - { - "name": "RemainingAccountsInfo", - "type": { - "kind": "struct", - "fields": [ - { - "name": "slices", - "type": { - "vec": { - "defined": "RemainingAccountsSlice" - } - } - } - ] - } - }, - { - "name": "StrategyType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "SpotOneSide" - }, - { - "name": "CurveOneSide" - }, - { - "name": "BidAskOneSide" - }, - { - "name": "SpotBalanced" - }, - { - "name": "CurveBalanced" - }, - { - "name": "BidAskBalanced" - }, - { - "name": "SpotImBalanced" - }, - { - "name": "CurveImBalanced" - }, - { - "name": "BidAskImBalanced" - } - ] - } - }, - { - "name": "Rounding", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Up" - }, - { - "name": "Down" - } - ] - } - }, - { - "name": "ActivationType", - "docs": [ - "Type of the activation" - ], - "type": { - "kind": "enum", - "variants": [ - { - "name": "Slot" - }, - { - "name": "Timestamp" - } - ] - } - }, - { - "name": "LayoutVersion", - "docs": [ - "Layout version" - ], - "type": { - "kind": "enum", - "variants": [ - { - "name": "V0" - }, - { - "name": "V1" - } - ] - } - }, - { - "name": "PairType", - "docs": [ - "Type of the Pair. 0 = Permissionless, 1 = Permission, 2 = CustomizablePermissionless. Putting 0 as permissionless for backward compatibility." - ], - "type": { - "kind": "enum", - "variants": [ - { - "name": "Permissionless" - }, - { - "name": "Permission" - }, - { - "name": "CustomizablePermissionless" - }, - { - "name": "PermissionlessV2" - } - ] - } - }, - { - "name": "PairStatus", - "docs": [ - "Pair status. 0 = Enabled, 1 = Disabled. Putting 0 as enabled for backward compatibility." - ], - "type": { - "kind": "enum", - "variants": [ - { - "name": "Enabled" - }, - { - "name": "Disabled" - } - ] - } - }, - { - "name": "TokenProgramFlags", - "type": { - "kind": "enum", - "variants": [ - { - "name": "TokenProgram" - }, - { - "name": "TokenProgram2022" - } - ] - } - }, - { - "name": "AccountsType", - "type": { - "kind": "enum", - "variants": [ - { - "name": "TransferHookX" - }, - { - "name": "TransferHookY" - }, - { - "name": "TransferHookReward" } ] } } ], - "events": [ - { - "name": "CompositionFee", - "fields": [ - { - "name": "from", - "type": "publicKey", - "index": false - }, - { - "name": "binId", - "type": "i16", - "index": false - }, - { - "name": "tokenXFeeAmount", - "type": "u64", - "index": false - }, - { - "name": "tokenYFeeAmount", - "type": "u64", - "index": false - }, - { - "name": "protocolTokenXFeeAmount", - "type": "u64", - "index": false - }, - { - "name": "protocolTokenYFeeAmount", - "type": "u64", - "index": false - } - ] - }, - { - "name": "AddLiquidity", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "from", - "type": "publicKey", - "index": false - }, - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "amounts", - "type": { - "array": [ - "u64", - 2 - ] - }, - "index": false - }, - { - "name": "activeBinId", - "type": "i32", - "index": false - } - ] - }, - { - "name": "RemoveLiquidity", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "from", - "type": "publicKey", - "index": false - }, - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "amounts", - "type": { - "array": [ - "u64", - 2 - ] - }, - "index": false - }, - { - "name": "activeBinId", - "type": "i32", - "index": false - } - ] - }, - { - "name": "Swap", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "from", - "type": "publicKey", - "index": false - }, - { - "name": "startBinId", - "type": "i32", - "index": false - }, - { - "name": "endBinId", - "type": "i32", - "index": false - }, - { - "name": "amountIn", - "type": "u64", - "index": false - }, - { - "name": "amountOut", - "type": "u64", - "index": false - }, - { - "name": "swapForY", - "type": "bool", - "index": false - }, - { - "name": "fee", - "type": "u64", - "index": false - }, - { - "name": "protocolFee", - "type": "u64", - "index": false - }, - { - "name": "feeBps", - "type": "u128", - "index": false - }, - { - "name": "hostFee", - "type": "u64", - "index": false - } - ] - }, - { - "name": "ClaimReward", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "owner", - "type": "publicKey", - "index": false - }, - { - "name": "rewardIndex", - "type": "u64", - "index": false - }, - { - "name": "totalReward", - "type": "u64", - "index": false - } - ] - }, - { - "name": "FundReward", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "funder", - "type": "publicKey", - "index": false - }, - { - "name": "rewardIndex", - "type": "u64", - "index": false - }, - { - "name": "amount", - "type": "u64", - "index": false - } - ] - }, - { - "name": "InitializeReward", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "rewardMint", - "type": "publicKey", - "index": false - }, - { - "name": "funder", - "type": "publicKey", - "index": false - }, - { - "name": "rewardIndex", - "type": "u64", - "index": false - }, - { - "name": "rewardDuration", - "type": "u64", - "index": false - } - ] - }, - { - "name": "UpdateRewardDuration", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "rewardIndex", - "type": "u64", - "index": false - }, - { - "name": "oldRewardDuration", - "type": "u64", - "index": false - }, - { - "name": "newRewardDuration", - "type": "u64", - "index": false - } - ] - }, - { - "name": "UpdateRewardFunder", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "rewardIndex", - "type": "u64", - "index": false - }, - { - "name": "oldFunder", - "type": "publicKey", - "index": false - }, - { - "name": "newFunder", - "type": "publicKey", - "index": false - } - ] - }, - { - "name": "PositionClose", - "fields": [ - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "owner", - "type": "publicKey", - "index": false - } - ] - }, - { - "name": "ClaimFee", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "owner", - "type": "publicKey", - "index": false - }, - { - "name": "feeX", - "type": "u64", - "index": false - }, - { - "name": "feeY", - "type": "u64", - "index": false - } - ] - }, - { - "name": "LbPairCreate", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "binStep", - "type": "u16", - "index": false - }, - { - "name": "tokenX", - "type": "publicKey", - "index": false - }, - { - "name": "tokenY", - "type": "publicKey", - "index": false - } - ] - }, - { - "name": "PositionCreate", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "owner", - "type": "publicKey", - "index": false - } - ] - }, - { - "name": "IncreasePositionLength", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "owner", - "type": "publicKey", - "index": false - }, - { - "name": "lengthToAdd", - "type": "u16", - "index": false - }, - { - "name": "side", - "type": "u8", - "index": false - } - ] - }, - { - "name": "DecreasePositionLength", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "owner", - "type": "publicKey", - "index": false - }, - { - "name": "lengthToRemove", - "type": "u16", - "index": false - }, - { - "name": "side", - "type": "u8", - "index": false - } - ] - }, - { - "name": "FeeParameterUpdate", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "protocolShare", - "type": "u16", - "index": false - }, - { - "name": "baseFactor", - "type": "u16", - "index": false - } - ] - }, - { - "name": "DynamicFeeParameterUpdate", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "filterPeriod", - "type": "u16", - "index": false - }, - { - "name": "decayPeriod", - "type": "u16", - "index": false - }, - { - "name": "reductionFactor", - "type": "u16", - "index": false - }, - { - "name": "variableFeeControl", - "type": "u32", - "index": false - }, - { - "name": "maxVolatilityAccumulator", - "type": "u32", - "index": false - } - ] - }, - { - "name": "IncreaseObservation", - "fields": [ - { - "name": "oracle", - "type": "publicKey", - "index": false - }, - { - "name": "newObservationLength", - "type": "u64", - "index": false - } - ] - }, - { - "name": "WithdrawIneligibleReward", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "rewardMint", - "type": "publicKey", - "index": false - }, - { - "name": "amount", - "type": "u64", - "index": false - } - ] - }, - { - "name": "UpdatePositionOperator", - "fields": [ - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "oldOperator", - "type": "publicKey", - "index": false - }, - { - "name": "newOperator", - "type": "publicKey", - "index": false - } - ] - }, - { - "name": "UpdatePositionLockReleasePoint", - "fields": [ - { - "name": "position", - "type": "publicKey", - "index": false - }, - { - "name": "currentPoint", - "type": "u64", - "index": false - }, - { - "name": "newLockReleasePoint", - "type": "u64", - "index": false - }, - { - "name": "oldLockReleasePoint", - "type": "u64", - "index": false - }, - { - "name": "sender", - "type": "publicKey", - "index": false - } - ] - }, - { - "name": "GoToABin", - "fields": [ - { - "name": "lbPair", - "type": "publicKey", - "index": false - }, - { - "name": "fromBinId", - "type": "i32", - "index": false - }, - { - "name": "toBinId", - "type": "i32", - "index": false - } - ] - } - ], - "errors": [ - { - "code": 6000, - "name": "InvalidStartBinIndex", - "msg": "Invalid start bin index" - }, - { - "code": 6001, - "name": "InvalidBinId", - "msg": "Invalid bin id" - }, - { - "code": 6002, - "name": "InvalidInput", - "msg": "Invalid input data" - }, - { - "code": 6003, - "name": "ExceededAmountSlippageTolerance", - "msg": "Exceeded amount slippage tolerance" - }, - { - "code": 6004, - "name": "ExceededBinSlippageTolerance", - "msg": "Exceeded bin slippage tolerance" - }, - { - "code": 6005, - "name": "CompositionFactorFlawed", - "msg": "Composition factor flawed" - }, - { - "code": 6006, - "name": "NonPresetBinStep", - "msg": "Non preset bin step" - }, - { - "code": 6007, - "name": "ZeroLiquidity", - "msg": "Zero liquidity" - }, - { - "code": 6008, - "name": "InvalidPosition", - "msg": "Invalid position" - }, - { - "code": 6009, - "name": "BinArrayNotFound", - "msg": "Bin array not found" - }, - { - "code": 6010, - "name": "InvalidTokenMint", - "msg": "Invalid token mint" - }, - { - "code": 6011, - "name": "InvalidAccountForSingleDeposit", - "msg": "Invalid account for single deposit" - }, - { - "code": 6012, - "name": "PairInsufficientLiquidity", - "msg": "Pair insufficient liquidity" - }, - { - "code": 6013, - "name": "InvalidFeeOwner", - "msg": "Invalid fee owner" - }, - { - "code": 6014, - "name": "InvalidFeeWithdrawAmount", - "msg": "Invalid fee withdraw amount" - }, - { - "code": 6015, - "name": "InvalidAdmin", - "msg": "Invalid admin" - }, - { - "code": 6016, - "name": "IdenticalFeeOwner", - "msg": "Identical fee owner" - }, - { - "code": 6017, - "name": "InvalidBps", - "msg": "Invalid basis point" - }, - { - "code": 6018, - "name": "MathOverflow", - "msg": "Math operation overflow" - }, - { - "code": 6019, - "name": "TypeCastFailed", - "msg": "Type cast error" - }, - { - "code": 6020, - "name": "InvalidRewardIndex", - "msg": "Invalid reward index" - }, - { - "code": 6021, - "name": "InvalidRewardDuration", - "msg": "Invalid reward duration" - }, - { - "code": 6022, - "name": "RewardInitialized", - "msg": "Reward already initialized" - }, - { - "code": 6023, - "name": "RewardUninitialized", - "msg": "Reward not initialized" - }, - { - "code": 6024, - "name": "IdenticalFunder", - "msg": "Identical funder" - }, - { - "code": 6025, - "name": "RewardCampaignInProgress", - "msg": "Reward campaign in progress" - }, - { - "code": 6026, - "name": "IdenticalRewardDuration", - "msg": "Reward duration is the same" - }, - { - "code": 6027, - "name": "InvalidBinArray", - "msg": "Invalid bin array" - }, - { - "code": 6028, - "name": "NonContinuousBinArrays", - "msg": "Bin arrays must be continuous" - }, - { - "code": 6029, - "name": "InvalidRewardVault", - "msg": "Invalid reward vault" - }, - { - "code": 6030, - "name": "NonEmptyPosition", - "msg": "Position is not empty" - }, - { - "code": 6031, - "name": "UnauthorizedAccess", - "msg": "Unauthorized access" - }, - { - "code": 6032, - "name": "InvalidFeeParameter", - "msg": "Invalid fee parameter" - }, - { - "code": 6033, - "name": "MissingOracle", - "msg": "Missing oracle account" - }, - { - "code": 6034, - "name": "InsufficientSample", - "msg": "Insufficient observation sample" - }, - { - "code": 6035, - "name": "InvalidLookupTimestamp", - "msg": "Invalid lookup timestamp" - }, - { - "code": 6036, - "name": "BitmapExtensionAccountIsNotProvided", - "msg": "Bitmap extension account is not provided" - }, - { - "code": 6037, - "name": "CannotFindNonZeroLiquidityBinArrayId", - "msg": "Cannot find non-zero liquidity binArrayId" - }, - { - "code": 6038, - "name": "BinIdOutOfBound", - "msg": "Bin id out of bound" - }, - { - "code": 6039, - "name": "InsufficientOutAmount", - "msg": "Insufficient amount in for minimum out" - }, - { - "code": 6040, - "name": "InvalidPositionWidth", - "msg": "Invalid position width" - }, - { - "code": 6041, - "name": "ExcessiveFeeUpdate", - "msg": "Excessive fee update" - }, - { - "code": 6042, - "name": "PoolDisabled", - "msg": "Pool disabled" - }, - { - "code": 6043, - "name": "InvalidPoolType", - "msg": "Invalid pool type" - }, - { - "code": 6044, - "name": "ExceedMaxWhitelist", - "msg": "Whitelist for wallet is full" - }, - { - "code": 6045, - "name": "InvalidIndex", - "msg": "Invalid index" - }, - { - "code": 6046, - "name": "RewardNotEnded", - "msg": "Reward not ended" - }, - { - "code": 6047, - "name": "MustWithdrawnIneligibleReward", - "msg": "Must withdraw ineligible reward" - }, - { - "code": 6048, - "name": "UnauthorizedAddress", - "msg": "Unauthorized address" - }, - { - "code": 6049, - "name": "OperatorsAreTheSame", - "msg": "Cannot update because operators are the same" - }, - { - "code": 6050, - "name": "WithdrawToWrongTokenAccount", - "msg": "Withdraw to wrong token account" - }, - { - "code": 6051, - "name": "WrongRentReceiver", - "msg": "Wrong rent receiver" - }, - { - "code": 6052, - "name": "AlreadyPassActivationPoint", - "msg": "Already activated" - }, - { - "code": 6053, - "name": "ExceedMaxSwappedAmount", - "msg": "Swapped amount is exceeded max swapped amount" - }, - { - "code": 6054, - "name": "InvalidStrategyParameters", - "msg": "Invalid strategy parameters" - }, - { - "code": 6055, - "name": "LiquidityLocked", - "msg": "Liquidity locked" - }, - { - "code": 6056, - "name": "BinRangeIsNotEmpty", - "msg": "Bin range is not empty" - }, - { - "code": 6057, - "name": "NotExactAmountOut", - "msg": "Amount out is not matched with exact amount out" - }, - { - "code": 6058, - "name": "InvalidActivationType", - "msg": "Invalid activation type" - }, - { - "code": 6059, - "name": "InvalidActivationDuration", - "msg": "Invalid activation duration" - }, - { - "code": 6060, - "name": "MissingTokenAmountAsTokenLaunchProof", - "msg": "Missing token amount as token launch owner proof" - }, - { - "code": 6061, - "name": "InvalidQuoteToken", - "msg": "Quote token must be SOL or USDC" - }, - { - "code": 6062, - "name": "InvalidBinStep", - "msg": "Invalid bin step" - }, - { - "code": 6063, - "name": "InvalidBaseFee", - "msg": "Invalid base fee" - }, - { - "code": 6064, - "name": "InvalidPreActivationDuration", - "msg": "Invalid pre-activation duration" - }, - { - "code": 6065, - "name": "AlreadyPassPreActivationSwapPoint", - "msg": "Already pass pre-activation swap point" - }, - { - "code": 6066, - "name": "InvalidStatus", - "msg": "Invalid status" - }, - { - "code": 6067, - "name": "ExceededMaxOracleLength", - "msg": "Exceed max oracle length" - }, - { - "code": 6068, - "name": "InvalidMinimumLiquidity", - "msg": "Invalid minimum liquidity" - }, - { - "code": 6069, - "name": "NotSupportMint", - "msg": "Not support token_2022 mint extension" - }, - { - "code": 6070, - "name": "UnsupportedMintExtension", - "msg": "Unsupported mint extension" - }, - { - "code": 6071, - "name": "UnsupportNativeMintToken2022", - "msg": "Unsupported native mint token2022" - }, - { - "code": 6072, - "name": "UnmatchTokenMint", - "msg": "Unmatch token mint" - }, - { - "code": 6073, - "name": "UnsupportedTokenMint", - "msg": "Unsupported token mint" - }, - { - "code": 6074, - "name": "InsufficientRemainingAccounts", - "msg": "Insufficient remaining accounts" - }, - { - "code": 6075, - "name": "InvalidRemainingAccountSlice", - "msg": "Invalid remaining account slice" - }, - { - "code": 6076, - "name": "DuplicatedRemainingAccountTypes", - "msg": "Duplicated remaining account types" - }, - { - "code": 6077, - "name": "MissingRemainingAccountForTransferHook", - "msg": "Missing remaining account for transfer hook" - }, - { - "code": 6078, - "name": "NoTransferHookProgram", - "msg": "Remaining account was passed for transfer hook but there's no hook program" - }, - { - "code": 6079, - "name": "ZeroFundedAmount", - "msg": "Zero funded amount" - }, - { - "code": 6080, - "name": "InvalidSide", - "msg": "Invalid side" - }, - { - "code": 6081, - "name": "InvalidResizeLength", - "msg": "Invalid resize length" - }, - { - "code": 6082, - "name": "NotSupportAtTheMoment", - "msg": "Not support at the moment" - } - ] + "events": [], + "errors": [] } \ No newline at end of file diff --git a/projects/umbra/idls/amm_v3.json b/projects/umbra/idls/amm_v3.json index 54e795a0e..a61f6b5d9 100644 --- a/projects/umbra/idls/amm_v3.json +++ b/projects/umbra/idls/amm_v3.json @@ -6,4916 +6,35 @@ "spec": "0.1.0", "description": "Anchor client and source for Umbra concentrated liquidity market maker" }, - "instructions": [ - { - "name": "close_position", - "docs": [ - "Close the user's position and NFT account. If the NFT mint belongs to token2022, it will also be closed and the funds returned to the NFT owner.", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "" - ], - "discriminator": [ - 123, - 134, - 81, - 0, - 49, - 68, - 98, - 98 - ], - "accounts": [ - { - "name": "nft_owner", - "docs": [ - "The position nft owner" - ], - "writable": true, - "signer": true - }, - { - "name": "position_nft_mint", - "docs": [ - "Mint address bound to the personal position." - ], - "writable": true - }, - { - "name": "position_nft_account", - "docs": [ - "User token account where position NFT be minted to" - ], - "writable": true - }, - { - "name": "personal_position", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "position_nft_mint" - } - ] - } - }, - { - "name": "system_program", - "docs": [ - "System program to close the position state account" - ], - "address": "11111111111111111111111111111111" - }, - { - "name": "token_program", - "docs": [ - "Token/Token2022 program to close token/mint account" - ] - } - ], - "args": [] - }, - { - "name": "collect_fund_fee", - "docs": [ - "Collect the fund fee accrued to the pool", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1", - "* `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0", - "" - ], - "discriminator": [ - 167, - 138, - 78, - 149, - 223, - 194, - 6, - 126 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Only admin or fund_owner can collect fee now" - ], - "signer": true - }, - { - "name": "pool_state", - "docs": [ - "Pool state stores accumulated protocol fee amount" - ], - "writable": true - }, - { - "name": "amm_config", - "docs": [ - "Amm config account stores fund_owner" - ] - }, - { - "name": "token_vault_0", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_vault_1", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token vault 0" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token vault 1" - ] - }, - { - "name": "recipient_token_account_0", - "docs": [ - "The address that receives the collected token_0 protocol fees" - ], - "writable": true - }, - { - "name": "recipient_token_account_1", - "docs": [ - "The address that receives the collected token_1 protocol fees" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "The SPL program to perform token transfers" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "The SPL program 2022 to perform token transfers" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - } - ], - "args": [ - { - "name": "amount_0_requested", - "type": "u64" - }, - { - "name": "amount_1_requested", - "type": "u64" - } - ] - }, - { - "name": "collect_protocol_fee", - "docs": [ - "Collect the protocol fee accrued to the pool", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1", - "* `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0", - "" - ], - "discriminator": [ - 136, - 136, - 252, - 221, - 194, - 66, - 126, - 89 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Only admin or config owner can collect fee now" - ], - "signer": true - }, - { - "name": "pool_state", - "docs": [ - "Pool state stores accumulated protocol fee amount" - ], - "writable": true - }, - { - "name": "amm_config", - "docs": [ - "Amm config account stores owner" - ] - }, - { - "name": "token_vault_0", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_vault_1", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token vault 0" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token vault 1" - ] - }, - { - "name": "recipient_token_account_0", - "docs": [ - "The address that receives the collected token_0 protocol fees" - ], - "writable": true - }, - { - "name": "recipient_token_account_1", - "docs": [ - "The address that receives the collected token_1 protocol fees" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "The SPL program to perform token transfers" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "The SPL program 2022 to perform token transfers" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - } - ], - "args": [ - { - "name": "amount_0_requested", - "type": "u64" - }, - { - "name": "amount_1_requested", - "type": "u64" - } - ] - }, - { - "name": "collect_remaining_rewards", - "docs": [ - "Collect remaining reward token for reward founder", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `reward_index` - the index to reward info", - "" - ], - "discriminator": [ - 18, - 237, - 166, - 197, - 34, - 16, - 213, - 144 - ], - "accounts": [ - { - "name": "reward_funder", - "docs": [ - "The founder who init reward info in berfore" - ], - "signer": true - }, - { - "name": "funder_token_account", - "docs": [ - "The funder's reward token account" - ], - "writable": true - }, - { - "name": "pool_state", - "docs": [ - "Set reward for this pool" - ], - "writable": true - }, - { - "name": "reward_token_vault", - "docs": [ - "Reward vault transfer remaining token to founder token account" - ] - }, - { - "name": "reward_vault_mint", - "docs": [ - "The mint of reward token vault" - ] - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "Token program 2022" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "memo_program", - "docs": [ - "memo program" - ], - "address": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr" - } - ], - "args": [ - { - "name": "reward_index", - "type": "u8" - } - ] - }, - { - "name": "create_amm_config", - "docs": [ - "# Arguments", - "", - "* `ctx`- The accounts needed by instruction.", - "* `index` - The index of amm config, there may be multiple config.", - "* `tick_spacing` - The tickspacing binding with config, cannot be changed.", - "* `trade_fee_rate` - Trade fee rate, can be changed.", - "* `protocol_fee_rate` - The rate of protocol fee within tarde fee.", - "* `fund_fee_rate` - The rate of fund fee within tarde fee.", - "" - ], - "discriminator": [ - 137, - 52, - 237, - 212, - 215, - 117, - 108, - 104 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Address to be set as protocol owner." - ], - "writable": true, - "signer": true, - "address": "8FeijbkxxXJEB1f14feTryJH5B57s8Jrx26nE1VuaTDA" - }, - { - "name": "amm_config", - "docs": [ - "Initialize config state account to store protocol owner address and fee rates." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 97, - 109, - 109, - 95, - 99, - 111, - 110, - 102, - 105, - 103 - ] - }, - { - "kind": "arg", - "path": "index" - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "index", - "type": "u16" - }, - { - "name": "tick_spacing", - "type": "u16" - }, - { - "name": "trade_fee_rate", - "type": "u32" - }, - { - "name": "protocol_fee_rate", - "type": "u32" - }, - { - "name": "fund_fee_rate", - "type": "u32" - } - ] - }, - { - "name": "create_operation_account", - "docs": [ - "Creates an operation account for the program", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "" - ], - "discriminator": [ - 63, - 87, - 148, - 33, - 109, - 35, - 8, - 104 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Address to be set as operation account owner." - ], - "writable": true, - "signer": true, - "address": "8FeijbkxxXJEB1f14feTryJH5B57s8Jrx26nE1VuaTDA" - }, - { - "name": "operation_state", - "docs": [ - "Initialize operation state account to store operation owner address and white list mint." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 111, - 112, - 101, - 114, - 97, - 116, - 105, - 111, - 110 - ] - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [] - }, - { - "name": "create_pool", - "docs": [ - "Creates a pool for the given token pair and the initial price", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `sqrt_price_x64` - the initial sqrt price (amount_token_1 / amount_token_0) of the pool as a Q64.64", - "Note: The open_time must be smaller than the current block_timestamp on chain." - ], - "discriminator": [ - 233, - 146, - 209, - 142, - 207, - 104, - 64, - 188 - ], - "accounts": [ - { - "name": "pool_creator", - "docs": [ - "Address paying to create the pool. Can be anyone" - ], - "writable": true, - "signer": true - }, - { - "name": "amm_config", - "docs": [ - "Which config the pool belongs to." - ] - }, - { - "name": "pool_state", - "docs": [ - "Initialize an account to store the pool state" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 111, - 108 - ] - }, - { - "kind": "account", - "path": "amm_config" - }, - { - "kind": "account", - "path": "token_mint_0" - }, - { - "kind": "account", - "path": "token_mint_1" - } - ] - } - }, - { - "name": "token_mint_0", - "docs": [ - "Token_0 mint, the key must be smaller then token_1 mint." - ] - }, - { - "name": "token_mint_1", - "docs": [ - "Token_1 mint" - ] - }, - { - "name": "token_vault_0", - "docs": [ - "Token_0 vault for the pool" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 111, - 108, - 95, - 118, - 97, - 117, - 108, - 116 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "account", - "path": "token_mint_0" - } - ] - } - }, - { - "name": "token_vault_1", - "docs": [ - "Token_1 vault for the pool" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 111, - 108, - 95, - 118, - 97, - 117, - 108, - 116 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "account", - "path": "token_mint_1" - } - ] - } - }, - { - "name": "observation_state", - "docs": [ - "Initialize an account to store oracle observations" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 111, - 98, - 115, - 101, - 114, - 118, - 97, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - } - ] - } - }, - { - "name": "tick_array_bitmap", - "docs": [ - "Initialize an account to store if a tick array is initialized." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 111, - 108, - 95, - 116, - 105, - 99, - 107, - 95, - 97, - 114, - 114, - 97, - 121, - 95, - 98, - 105, - 116, - 109, - 97, - 112, - 95, - 101, - 120, - 116, - 101, - 110, - 115, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - } - ] - } - }, - { - "name": "token_program_0", - "docs": [ - "Spl token program or token program 2022" - ] - }, - { - "name": "token_program_1", - "docs": [ - "Spl token program or token program 2022" - ] - }, - { - "name": "system_program", - "docs": [ - "To create a new program account" - ], - "address": "11111111111111111111111111111111" - }, - { - "name": "rent", - "docs": [ - "Sysvar for program account" - ], - "address": "SysvarRent111111111111111111111111111111111" - } - ], - "args": [ - { - "name": "sqrt_price_x64", - "type": "u128" - }, - { - "name": "open_time", - "type": "u64" - } - ] - }, - { - "name": "decrease_liquidity", - "docs": [ - "#[deprecated(note = \"Use `decrease_liquidity_v2` instead.\")]", - "Decreases liquidity with a exist position", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `liquidity` - The amount by which liquidity will be decreased", - "* `amount_0_min` - The minimum amount of token_0 that should be accounted for the burned liquidity", - "* `amount_1_min` - The minimum amount of token_1 that should be accounted for the burned liquidity", - "" - ], - "discriminator": [ - 160, - 38, - 208, - 111, - 104, - 91, - 44, - 1 - ], - "accounts": [ - { - "name": "nft_owner", - "docs": [ - "The position owner or delegated authority" - ], - "signer": true - }, - { - "name": "nft_account", - "docs": [ - "The token account for the tokenized position" - ] - }, - { - "name": "personal_position", - "docs": [ - "Decrease liquidity for this position" - ], - "writable": true - }, - { - "name": "pool_state", - "writable": true - }, - { - "name": "protocol_position", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "account", - "path": "personal_position.tick_lower_index", - "account": "PersonalPositionState" - }, - { - "kind": "account", - "path": "personal_position.tick_upper_index", - "account": "PersonalPositionState" - } - ] - } - }, - { - "name": "token_vault_0", - "docs": [ - "Token_0 vault" - ], - "writable": true - }, - { - "name": "token_vault_1", - "docs": [ - "Token_1 vault" - ], - "writable": true - }, - { - "name": "tick_array_lower", - "docs": [ - "Stores init state for the lower tick" - ], - "writable": true - }, - { - "name": "tick_array_upper", - "docs": [ - "Stores init state for the upper tick" - ], - "writable": true - }, - { - "name": "recipient_token_account_0", - "docs": [ - "The destination token account for receive amount_0" - ], - "writable": true - }, - { - "name": "recipient_token_account_1", - "docs": [ - "The destination token account for receive amount_1" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "SPL program to transfer out tokens" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - } - ], - "args": [ - { - "name": "liquidity", - "type": "u128" - }, - { - "name": "amount_0_min", - "type": "u64" - }, - { - "name": "amount_1_min", - "type": "u64" - } - ] - }, - { - "name": "decrease_liquidity_v2", - "docs": [ - "Decreases liquidity with a exist position, support Token2022", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `liquidity` - The amount by which liquidity will be decreased", - "* `amount_0_min` - The minimum amount of token_0 that should be accounted for the burned liquidity", - "* `amount_1_min` - The minimum amount of token_1 that should be accounted for the burned liquidity", - "" - ], - "discriminator": [ - 58, - 127, - 188, - 62, - 79, - 82, - 196, - 96 - ], - "accounts": [ - { - "name": "nft_owner", - "docs": [ - "The position owner or delegated authority" - ], - "signer": true - }, - { - "name": "nft_account", - "docs": [ - "The token account for the tokenized position" - ] - }, - { - "name": "personal_position", - "docs": [ - "Decrease liquidity for this position" - ], - "writable": true - }, - { - "name": "pool_state", - "writable": true - }, - { - "name": "protocol_position", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "account", - "path": "personal_position.tick_lower_index", - "account": "PersonalPositionState" - }, - { - "kind": "account", - "path": "personal_position.tick_upper_index", - "account": "PersonalPositionState" - } - ] - } - }, - { - "name": "token_vault_0", - "docs": [ - "Token_0 vault" - ], - "writable": true - }, - { - "name": "token_vault_1", - "docs": [ - "Token_1 vault" - ], - "writable": true - }, - { - "name": "tick_array_lower", - "docs": [ - "Stores init state for the lower tick" - ], - "writable": true - }, - { - "name": "tick_array_upper", - "docs": [ - "Stores init state for the upper tick" - ], - "writable": true - }, - { - "name": "recipient_token_account_0", - "docs": [ - "The destination token account for receive amount_0" - ], - "writable": true - }, - { - "name": "recipient_token_account_1", - "docs": [ - "The destination token account for receive amount_1" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "SPL program to transfer out tokens" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "Token program 2022" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "memo_program", - "docs": [ - "memo program" - ], - "address": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr" - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token vault 0" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token vault 1" - ] - } - ], - "args": [ - { - "name": "liquidity", - "type": "u128" - }, - { - "name": "amount_0_min", - "type": "u64" - }, - { - "name": "amount_1_min", - "type": "u64" - } - ] - }, - { - "name": "increase_liquidity", - "docs": [ - "#[deprecated(note = \"Use `increase_liquidity_v2` instead.\")]", - "Increases liquidity with a exist position, with amount paid by `payer`", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `liquidity` - The desired liquidity to be added, can't be zero", - "* `amount_0_max` - The max amount of token_0 to spend, which serves as a slippage check", - "* `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check", - "" - ], - "discriminator": [ - 46, - 156, - 243, - 118, - 13, - 205, - 251, - 178 - ], - "accounts": [ - { - "name": "nft_owner", - "docs": [ - "Pays to mint the position" - ], - "signer": true - }, - { - "name": "nft_account", - "docs": [ - "The token account for nft" - ] - }, - { - "name": "pool_state", - "writable": true - }, - { - "name": "protocol_position", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "account", - "path": "personal_position.tick_lower_index", - "account": "PersonalPositionState" - }, - { - "kind": "account", - "path": "personal_position.tick_upper_index", - "account": "PersonalPositionState" - } - ] - } - }, - { - "name": "personal_position", - "docs": [ - "Increase liquidity for this position" - ], - "writable": true - }, - { - "name": "tick_array_lower", - "docs": [ - "Stores init state for the lower tick" - ], - "writable": true - }, - { - "name": "tick_array_upper", - "docs": [ - "Stores init state for the upper tick" - ], - "writable": true - }, - { - "name": "token_account_0", - "docs": [ - "The payer's token account for token_0" - ], - "writable": true - }, - { - "name": "token_account_1", - "docs": [ - "The token account spending token_1 to mint the position" - ], - "writable": true - }, - { - "name": "token_vault_0", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_vault_1", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "Program to create mint account and mint tokens" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - } - ], - "args": [ - { - "name": "liquidity", - "type": "u128" - }, - { - "name": "amount_0_max", - "type": "u64" - }, - { - "name": "amount_1_max", - "type": "u64" - } - ] - }, - { - "name": "increase_liquidity_v2", - "docs": [ - "Increases liquidity with a exist position, with amount paid by `payer`, support Token2022", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `liquidity` - The desired liquidity to be added, if zero, calculate liquidity base amount_0 or amount_1 according base_flag", - "* `amount_0_max` - The max amount of token_0 to spend, which serves as a slippage check", - "* `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check", - "* `base_flag` - must be specified if liquidity is zero, true: calculate liquidity base amount_0_max otherwise base amount_1_max", - "" - ], - "discriminator": [ - 133, - 29, - 89, - 223, - 69, - 238, - 176, - 10 - ], - "accounts": [ - { - "name": "nft_owner", - "docs": [ - "Pays to mint the position" - ], - "signer": true - }, - { - "name": "nft_account", - "docs": [ - "The token account for nft" - ] - }, - { - "name": "pool_state", - "writable": true - }, - { - "name": "protocol_position", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "account", - "path": "personal_position.tick_lower_index", - "account": "PersonalPositionState" - }, - { - "kind": "account", - "path": "personal_position.tick_upper_index", - "account": "PersonalPositionState" - } - ] - } - }, - { - "name": "personal_position", - "docs": [ - "Increase liquidity for this position" - ], - "writable": true - }, - { - "name": "tick_array_lower", - "docs": [ - "Stores init state for the lower tick" - ], - "writable": true - }, - { - "name": "tick_array_upper", - "docs": [ - "Stores init state for the upper tick" - ], - "writable": true - }, - { - "name": "token_account_0", - "docs": [ - "The payer's token account for token_0" - ], - "writable": true - }, - { - "name": "token_account_1", - "docs": [ - "The token account spending token_1 to mint the position" - ], - "writable": true - }, - { - "name": "token_vault_0", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_vault_1", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "Program to create mint account and mint tokens" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "Token program 2022" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token vault 0" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token vault 1" - ] - } - ], - "args": [ - { - "name": "liquidity", - "type": "u128" - }, - { - "name": "amount_0_max", - "type": "u64" - }, - { - "name": "amount_1_max", - "type": "u64" - }, - { - "name": "base_flag", - "type": { - "option": "bool" - } - } - ] - }, - { - "name": "initialize_reward", - "docs": [ - "Initialize a reward info for a given pool and reward index", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `reward_index` - the index to reward info", - "* `open_time` - reward open timestamp", - "* `end_time` - reward end timestamp", - "* `emissions_per_second_x64` - Token reward per second are earned per unit of liquidity.", - "" - ], - "discriminator": [ - 95, - 135, - 192, - 196, - 242, - 129, - 230, - 68 - ], - "accounts": [ - { - "name": "reward_funder", - "docs": [ - "The founder deposit reward token to vault" - ], - "writable": true, - "signer": true - }, - { - "name": "funder_token_account", - "writable": true - }, - { - "name": "amm_config", - "docs": [ - "For check the reward_funder authority" - ] - }, - { - "name": "pool_state", - "docs": [ - "Set reward for this pool" - ], - "writable": true - }, - { - "name": "operation_state", - "docs": [ - "load info from the account to judge reward permission" - ], - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 111, - 112, - 101, - 114, - 97, - 116, - 105, - 111, - 110 - ] - } - ] - } - }, - { - "name": "reward_token_mint", - "docs": [ - "Reward mint" - ] - }, - { - "name": "reward_token_vault", - "docs": [ - "A pda, reward vault" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 111, - 108, - 95, - 114, - 101, - 119, - 97, - 114, - 100, - 95, - 118, - 97, - 117, - 108, - 116 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "account", - "path": "reward_token_mint" - } - ] - } - }, - { - "name": "reward_token_program" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "rent", - "address": "SysvarRent111111111111111111111111111111111" - } - ], - "args": [ - { - "name": "param", - "type": { - "defined": { - "name": "InitializeRewardParam" - } - } - } - ] - }, - { - "name": "open_position", - "docs": [ - "#[deprecated(note = \"Use `open_position_with_token22_nft` instead.\")]", - "Creates a new position wrapped in a NFT", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `tick_lower_index` - The low boundary of market", - "* `tick_upper_index` - The upper boundary of market", - "* `tick_array_lower_start_index` - The start index of tick array which include tick low", - "* `tick_array_upper_start_index` - The start index of tick array which include tick upper", - "* `liquidity` - The liquidity to be added", - "* `amount_0_max` - The max amount of token_0 to spend, which serves as a slippage check", - "* `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check", - "" - ], - "discriminator": [ - 135, - 128, - 47, - 77, - 15, - 152, - 240, - 49 - ], - "accounts": [ - { - "name": "payer", - "docs": [ - "Pays to mint the position" - ], - "writable": true, - "signer": true - }, - { - "name": "position_nft_owner" - }, - { - "name": "position_nft_mint", - "docs": [ - "Unique token mint address" - ], - "writable": true, - "signer": true - }, - { - "name": "position_nft_account", - "docs": [ - "Token account where position NFT will be minted", - "This account created in the contract by cpi to avoid large stack variables" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "position_nft_owner" - }, - { - "kind": "const", - "value": [ - 6, - 221, - 246, - 225, - 215, - 101, - 161, - 147, - 217, - 203, - 225, - 70, - 206, - 235, - 121, - 172, - 28, - 180, - 133, - 237, - 95, - 91, - 55, - 145, - 58, - 140, - 245, - 133, - 126, - 255, - 0, - 169 - ] - }, - { - "kind": "account", - "path": "position_nft_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "metadata_account", - "docs": [ - "To store metaplex metadata" - ], - "writable": true - }, - { - "name": "pool_state", - "docs": [ - "Add liquidity for this pool" - ], - "writable": true - }, - { - "name": "protocol_position", - "docs": [ - "Store the information of market marking in range" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "arg", - "path": "tick_lower_index" - }, - { - "kind": "arg", - "path": "tick_upper_index" - } - ] - } - }, - { - "name": "tick_array_lower", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 116, - 105, - 99, - 107, - 95, - 97, - 114, - 114, - 97, - 121 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "arg", - "path": "tick_array_lower_start_index" - } - ] - } - }, - { - "name": "tick_array_upper", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 116, - 105, - 99, - 107, - 95, - 97, - 114, - 114, - 97, - 121 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "arg", - "path": "tick_array_upper_start_index" - } - ] - } - }, - { - "name": "personal_position", - "docs": [ - "personal position state" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "position_nft_mint" - } - ] - } - }, - { - "name": "token_account_0", - "docs": [ - "The token_0 account deposit token to the pool" - ], - "writable": true - }, - { - "name": "token_account_1", - "docs": [ - "The token_1 account deposit token to the pool" - ], - "writable": true - }, - { - "name": "token_vault_0", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_vault_1", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "rent", - "docs": [ - "Sysvar for token mint and ATA creation" - ], - "address": "SysvarRent111111111111111111111111111111111" - }, - { - "name": "system_program", - "docs": [ - "Program to create the position manager state account" - ], - "address": "11111111111111111111111111111111" - }, - { - "name": "token_program", - "docs": [ - "Program to create mint account and mint tokens" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "associated_token_program", - "docs": [ - "Program to create an ATA for receiving position NFT" - ], - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "metadata_program", - "docs": [ - "Program to create NFT metadata" - ], - "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" - } - ], - "args": [ - { - "name": "tick_lower_index", - "type": "i32" - }, - { - "name": "tick_upper_index", - "type": "i32" - }, - { - "name": "tick_array_lower_start_index", - "type": "i32" - }, - { - "name": "tick_array_upper_start_index", - "type": "i32" - }, - { - "name": "liquidity", - "type": "u128" - }, - { - "name": "amount_0_max", - "type": "u64" - }, - { - "name": "amount_1_max", - "type": "u64" - } - ] - }, - { - "name": "open_position_v2", - "docs": [ - "#[deprecated(note = \"Use `open_position_with_token22_nft` instead.\")]", - "Creates a new position wrapped in a NFT, support Token2022", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `tick_lower_index` - The low boundary of market", - "* `tick_upper_index` - The upper boundary of market", - "* `tick_array_lower_start_index` - The start index of tick array which include tick low", - "* `tick_array_upper_start_index` - The start index of tick array which include tick upper", - "* `liquidity` - The liquidity to be added, if zero, and the base_flage is specified, calculate liquidity base amount_0_max or amount_1_max according base_flag, otherwise open position with zero liquidity", - "* `amount_0_max` - The max amount of token_0 to spend, which serves as a slippage check", - "* `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check", - "* `with_metadata` - The flag indicating whether to create NFT mint metadata", - "* `base_flag` - if the liquidity specified as zero, true: calculate liquidity base amount_0_max otherwise base amount_1_max", - "" - ], - "discriminator": [ - 77, - 184, - 74, - 214, - 112, - 86, - 241, - 199 - ], - "accounts": [ - { - "name": "payer", - "docs": [ - "Pays to mint the position" - ], - "writable": true, - "signer": true - }, - { - "name": "position_nft_owner" - }, - { - "name": "position_nft_mint", - "docs": [ - "Unique token mint address" - ], - "writable": true, - "signer": true - }, - { - "name": "position_nft_account", - "docs": [ - "Token account where position NFT will be minted" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "position_nft_owner" - }, - { - "kind": "const", - "value": [ - 6, - 221, - 246, - 225, - 215, - 101, - 161, - 147, - 217, - 203, - 225, - 70, - 206, - 235, - 121, - 172, - 28, - 180, - 133, - 237, - 95, - 91, - 55, - 145, - 58, - 140, - 245, - 133, - 126, - 255, - 0, - 169 - ] - }, - { - "kind": "account", - "path": "position_nft_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "metadata_account", - "docs": [ - "To store metaplex metadata" - ], - "writable": true - }, - { - "name": "pool_state", - "docs": [ - "Add liquidity for this pool" - ], - "writable": true - }, - { - "name": "protocol_position", - "docs": [ - "Store the information of market marking in range" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "arg", - "path": "tick_lower_index" - }, - { - "kind": "arg", - "path": "tick_upper_index" - } - ] - } - }, - { - "name": "tick_array_lower", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 116, - 105, - 99, - 107, - 95, - 97, - 114, - 114, - 97, - 121 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "arg", - "path": "tick_array_lower_start_index" - } - ] - } - }, - { - "name": "tick_array_upper", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 116, - 105, - 99, - 107, - 95, - 97, - 114, - 114, - 97, - 121 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "arg", - "path": "tick_array_upper_start_index" - } - ] - } - }, - { - "name": "personal_position", - "docs": [ - "personal position state" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "position_nft_mint" - } - ] - } - }, - { - "name": "token_account_0", - "docs": [ - "The token_0 account deposit token to the pool" - ], - "writable": true - }, - { - "name": "token_account_1", - "docs": [ - "The token_1 account deposit token to the pool" - ], - "writable": true - }, - { - "name": "token_vault_0", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_vault_1", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "rent", - "docs": [ - "Sysvar for token mint and ATA creation" - ], - "address": "SysvarRent111111111111111111111111111111111" - }, - { - "name": "system_program", - "docs": [ - "Program to create the position manager state account" - ], - "address": "11111111111111111111111111111111" - }, - { - "name": "token_program", - "docs": [ - "Program to create mint account and mint tokens" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "associated_token_program", - "docs": [ - "Program to create an ATA for receiving position NFT" - ], - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "metadata_program", - "docs": [ - "Program to create NFT metadata" - ], - "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" - }, - { - "name": "token_program_2022", - "docs": [ - "Program to create mint account and mint tokens" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token vault 0" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token vault 1" - ] - } - ], - "args": [ - { - "name": "tick_lower_index", - "type": "i32" - }, - { - "name": "tick_upper_index", - "type": "i32" - }, - { - "name": "tick_array_lower_start_index", - "type": "i32" - }, - { - "name": "tick_array_upper_start_index", - "type": "i32" - }, - { - "name": "liquidity", - "type": "u128" - }, - { - "name": "amount_0_max", - "type": "u64" - }, - { - "name": "amount_1_max", - "type": "u64" - }, - { - "name": "with_metadata", - "type": "bool" - }, - { - "name": "base_flag", - "type": { - "option": "bool" - } - } - ] - }, - { - "name": "open_position_with_token22_nft", - "docs": [ - "Creates a new position wrapped in a Token2022 NFT without relying on metadata_program and metadata_account, reduce the cost for user to create a personal position.", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `tick_lower_index` - The low boundary of market", - "* `tick_upper_index` - The upper boundary of market", - "* `tick_array_lower_start_index` - The start index of tick array which include tick low", - "* `tick_array_upper_start_index` - The start index of tick array which include tick upper", - "* `liquidity` - The liquidity to be added, if zero, and the base_flage is specified, calculate liquidity base amount_0_max or amount_1_max according base_flag, otherwise open position with zero liquidity", - "* `amount_0_max` - The max amount of token_0 to spend, which serves as a slippage check", - "* `amount_1_max` - The max amount of token_1 to spend, which serves as a slippage check", - "* `with_metadata` - The flag indicating whether to create NFT mint metadata", - "* `base_flag` - if the liquidity specified as zero, true: calculate liquidity base amount_0_max otherwise base amount_1_max", - "" - ], - "discriminator": [ - 77, - 255, - 174, - 82, - 125, - 29, - 201, - 46 - ], - "accounts": [ - { - "name": "payer", - "docs": [ - "Pays to mint the position" - ], - "writable": true, - "signer": true - }, - { - "name": "position_nft_owner" - }, - { - "name": "position_nft_mint", - "docs": [ - "Unique token mint address, initialize in constract" - ], - "writable": true, - "signer": true - }, - { - "name": "position_nft_account", - "writable": true - }, - { - "name": "pool_state", - "docs": [ - "Add liquidity for this pool" - ], - "writable": true - }, - { - "name": "protocol_position", - "docs": [ - "Store the information of market marking in range" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "arg", - "path": "tick_lower_index" - }, - { - "kind": "arg", - "path": "tick_upper_index" - } - ] - } - }, - { - "name": "tick_array_lower", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 116, - 105, - 99, - 107, - 95, - 97, - 114, - 114, - 97, - 121 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "arg", - "path": "tick_array_lower_start_index" - } - ] - } - }, - { - "name": "tick_array_upper", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 116, - 105, - 99, - 107, - 95, - 97, - 114, - 114, - 97, - 121 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "arg", - "path": "tick_array_upper_start_index" - } - ] - } - }, - { - "name": "personal_position", - "docs": [ - "personal position state" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "position_nft_mint" - } - ] - } - }, - { - "name": "token_account_0", - "docs": [ - "The token_0 account deposit token to the pool" - ], - "writable": true - }, - { - "name": "token_account_1", - "docs": [ - "The token_1 account deposit token to the pool" - ], - "writable": true - }, - { - "name": "token_vault_0", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_vault_1", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "rent", - "docs": [ - "Sysvar for token mint and ATA creation" - ], - "address": "SysvarRent111111111111111111111111111111111" - }, - { - "name": "system_program", - "docs": [ - "Program to create the position manager state account" - ], - "address": "11111111111111111111111111111111" - }, - { - "name": "token_program", - "docs": [ - "Program to transfer for token account" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "associated_token_program", - "docs": [ - "Program to create an ATA for receiving position NFT" - ], - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "token_program_2022", - "docs": [ - "Program to create NFT mint/token account and transfer for token22 account" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token vault 0" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token vault 1" - ] - } - ], - "args": [ - { - "name": "tick_lower_index", - "type": "i32" - }, - { - "name": "tick_upper_index", - "type": "i32" - }, - { - "name": "tick_array_lower_start_index", - "type": "i32" - }, - { - "name": "tick_array_upper_start_index", - "type": "i32" - }, - { - "name": "liquidity", - "type": "u128" - }, - { - "name": "amount_0_max", - "type": "u64" - }, - { - "name": "amount_1_max", - "type": "u64" - }, - { - "name": "with_metadata", - "type": "bool" - }, - { - "name": "base_flag", - "type": { - "option": "bool" - } - } - ] - }, - { - "name": "set_reward_params", - "docs": [ - "Restset reward param, start a new reward cycle or extend the current cycle.", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `reward_index` - The index of reward token in the pool.", - "* `emissions_per_second_x64` - The per second emission reward, when extend the current cycle,", - "new value can't be less than old value", - "* `open_time` - reward open timestamp, must be set when state a new cycle", - "* `end_time` - reward end timestamp", - "" - ], - "discriminator": [ - 112, - 52, - 167, - 75, - 32, - 201, - 211, - 137 - ], - "accounts": [ - { - "name": "authority", - "docs": [ - "Address to be set as protocol owner. It pays to create factory state account." - ], - "signer": true - }, - { - "name": "amm_config" - }, - { - "name": "pool_state", - "writable": true - }, - { - "name": "operation_state", - "docs": [ - "load info from the account to judge reward permission" - ], - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 111, - 112, - 101, - 114, - 97, - 116, - 105, - 111, - 110 - ] - } - ] - } - }, - { - "name": "token_program", - "docs": [ - "Token program" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "Token program 2022" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - } - ], - "args": [ - { - "name": "reward_index", - "type": "u8" - }, - { - "name": "emissions_per_second_x64", - "type": "u128" - }, - { - "name": "open_time", - "type": "u64" - }, - { - "name": "end_time", - "type": "u64" - } - ] - }, - { - "name": "swap", - "docs": [ - "#[deprecated(note = \"Use `swap_v2` instead.\")]", - "Swaps one token for as much as possible of another token across a single pool", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `amount` - Arranged in pairs with other_amount_threshold. (amount_in, amount_out_minimum) or (amount_out, amount_in_maximum)", - "* `other_amount_threshold` - For slippage check", - "* `sqrt_price_limit` - The Q64.64 sqrt price √P limit. If zero for one, the price cannot", - "* `is_base_input` - swap base input or swap base output", - "" - ], - "discriminator": [ - 248, - 198, - 158, - 145, - 225, - 117, - 135, - 200 - ], - "accounts": [ - { - "name": "payer", - "docs": [ - "The user performing the swap" - ], - "signer": true - }, - { - "name": "amm_config", - "docs": [ - "The factory state to read protocol fees" - ] - }, - { - "name": "pool_state", - "docs": [ - "The program account of the pool in which the swap will be performed" - ], - "writable": true - }, - { - "name": "input_token_account", - "docs": [ - "The user token account for input token" - ], - "writable": true - }, - { - "name": "output_token_account", - "docs": [ - "The user token account for output token" - ], - "writable": true - }, - { - "name": "input_vault", - "docs": [ - "The vault token account for input token" - ], - "writable": true - }, - { - "name": "output_vault", - "docs": [ - "The vault token account for output token" - ], - "writable": true - }, - { - "name": "observation_state", - "docs": [ - "The program account for the most recent oracle observation" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "SPL program for token transfers" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "tick_array", - "writable": true - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "other_amount_threshold", - "type": "u64" - }, - { - "name": "sqrt_price_limit_x64", - "type": "u128" - }, - { - "name": "is_base_input", - "type": "bool" - } - ] - }, - { - "name": "swap_router_base_in", - "docs": [ - "Swap token for as much as possible of another token across the path provided, base input", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `amount_in` - Token amount to be swapped in", - "* `amount_out_minimum` - Panic if output amount is below minimum amount. For slippage.", - "" - ], - "discriminator": [ - 69, - 125, - 115, - 218, - 245, - 186, - 242, - 196 - ], - "accounts": [ - { - "name": "payer", - "docs": [ - "The user performing the swap" - ], - "signer": true - }, - { - "name": "input_token_account", - "docs": [ - "The token account that pays input tokens for the swap" - ], - "writable": true - }, - { - "name": "input_token_mint", - "docs": [ - "The mint of input token" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "SPL program for token transfers" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "SPL program 2022 for token transfers" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "memo_program" - } - ], - "args": [ - { - "name": "amount_in", - "type": "u64" - }, - { - "name": "amount_out_minimum", - "type": "u64" - } - ] - }, - { - "name": "swap_v2", - "docs": [ - "Swaps one token for as much as possible of another token across a single pool, support token program 2022", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `amount` - Arranged in pairs with other_amount_threshold. (amount_in, amount_out_minimum) or (amount_out, amount_in_maximum)", - "* `other_amount_threshold` - For slippage check", - "* `sqrt_price_limit` - The Q64.64 sqrt price √P limit. If zero for one, the price cannot", - "* `is_base_input` - swap base input or swap base output", - "" - ], - "discriminator": [ - 43, - 4, - 237, - 11, - 26, - 201, - 30, - 98 - ], - "accounts": [ - { - "name": "payer", - "docs": [ - "The user performing the swap" - ], - "signer": true - }, - { - "name": "amm_config", - "docs": [ - "The factory state to read protocol fees" - ] - }, - { - "name": "pool_state", - "docs": [ - "The program account of the pool in which the swap will be performed" - ], - "writable": true - }, - { - "name": "input_token_account", - "docs": [ - "The user token account for input token" - ], - "writable": true - }, - { - "name": "output_token_account", - "docs": [ - "The user token account for output token" - ], - "writable": true - }, - { - "name": "input_vault", - "docs": [ - "The vault token account for input token" - ], - "writable": true - }, - { - "name": "output_vault", - "docs": [ - "The vault token account for output token" - ], - "writable": true - }, - { - "name": "observation_state", - "docs": [ - "The program account for the most recent oracle observation" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "SPL program for token transfers" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "SPL program 2022 for token transfers" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "memo_program", - "address": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr" - }, - { - "name": "input_vault_mint", - "docs": [ - "The mint of token vault 0" - ] - }, - { - "name": "output_vault_mint", - "docs": [ - "The mint of token vault 1" - ] - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "other_amount_threshold", - "type": "u64" - }, - { - "name": "sqrt_price_limit_x64", - "type": "u128" - }, - { - "name": "is_base_input", - "type": "bool" - } - ] - }, - { - "name": "transfer_reward_owner", - "docs": [ - "Transfer reward owner", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `new_owner`- new owner pubkey", - "" - ], - "discriminator": [ - 7, - 22, - 12, - 83, - 242, - 43, - 48, - 121 - ], - "accounts": [ - { - "name": "authority", - "docs": [ - "Address to be set as operation account owner." - ], - "signer": true, - "address": "8FeijbkxxXJEB1f14feTryJH5B57s8Jrx26nE1VuaTDA" - }, - { - "name": "pool_state", - "writable": true - } - ], - "args": [ - { - "name": "new_owner", - "type": "pubkey" - } - ] - }, - { - "name": "update_amm_config", - "docs": [ - "Updates the owner of the amm config", - "Must be called by the current owner or admin", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `trade_fee_rate`- The new trade fee rate of amm config, be set when `param` is 0", - "* `protocol_fee_rate`- The new protocol fee rate of amm config, be set when `param` is 1", - "* `fund_fee_rate`- The new fund fee rate of amm config, be set when `param` is 2", - "* `new_owner`- The config's new owner, be set when `param` is 3", - "* `new_fund_owner`- The config's new fund owner, be set when `param` is 4", - "* `param`- The vaule can be 0 | 1 | 2 | 3 | 4, otherwise will report a error", - "" - ], - "discriminator": [ - 49, - 60, - 174, - 136, - 154, - 28, - 116, - 200 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "The amm config owner or admin" - ], - "signer": true, - "address": "8FeijbkxxXJEB1f14feTryJH5B57s8Jrx26nE1VuaTDA" - }, - { - "name": "amm_config", - "docs": [ - "Amm config account to be changed" - ], - "writable": true - } - ], - "args": [ - { - "name": "param", - "type": "u8" - }, - { - "name": "value", - "type": "u32" - } - ] - }, - { - "name": "update_operation_account", - "docs": [ - "Update the operation account", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `param`- The vaule can be 0 | 1 | 2 | 3, otherwise will report a error", - "* `keys`- update operation owner when the `param` is 0", - "remove operation owner when the `param` is 1", - "update whitelist mint when the `param` is 2", - "remove whitelist mint when the `param` is 3", - "" - ], - "discriminator": [ - 127, - 70, - 119, - 40, - 188, - 227, - 61, - 7 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Address to be set as operation account owner." - ], - "signer": true, - "address": "8FeijbkxxXJEB1f14feTryJH5B57s8Jrx26nE1VuaTDA" - }, - { - "name": "operation_state", - "docs": [ - "Initialize operation state account to store operation owner address and white list mint." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 111, - 112, - 101, - 114, - 97, - 116, - 105, - 111, - 110 - ] - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "param", - "type": "u8" - }, - { - "name": "keys", - "type": { - "vec": "pubkey" - } - } - ] - }, - { - "name": "update_pool_status", - "docs": [ - "Update pool status for given vaule", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `status` - The vaule of status", - "" - ], - "discriminator": [ - 130, - 87, - 108, - 6, - 46, - 224, - 117, - 123 - ], - "accounts": [ - { - "name": "authority", - "signer": true, - "address": "8FeijbkxxXJEB1f14feTryJH5B57s8Jrx26nE1VuaTDA" - }, - { - "name": "pool_state", - "writable": true - } - ], - "args": [ - { - "name": "status", - "type": "u8" - } - ] - }, - { - "name": "update_reward_infos", - "docs": [ - "Update rewards info of the given pool, can be called for everyone", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "" - ], - "discriminator": [ - 163, - 172, - 224, - 52, - 11, - 154, - 106, - 223 - ], - "accounts": [ - { - "name": "pool_state", - "docs": [ - "The liquidity pool for which reward info to update" - ], - "writable": true - } - ], - "args": [] - } - ], - "accounts": [ - { - "name": "AmmConfig", - "discriminator": [ - 218, - 244, - 33, - 104, - 203, - 203, - 43, - 111 - ] - }, - { - "name": "ObservationState", - "discriminator": [ - 122, - 174, - 197, - 53, - 129, - 9, - 165, - 132 - ] - }, - { - "name": "OperationState", - "discriminator": [ - 19, - 236, - 58, - 237, - 81, - 222, - 183, - 252 - ] - }, - { - "name": "PersonalPositionState", - "discriminator": [ - 70, - 111, - 150, - 126, - 230, - 15, - 25, - 117 - ] - }, - { - "name": "PoolState", - "discriminator": [ - 247, - 237, - 227, - 245, - 215, - 195, - 222, - 70 - ] - }, - { - "name": "ProtocolPositionState", - "discriminator": [ - 100, - 226, - 145, - 99, - 146, - 218, - 160, - 106 - ] - }, - { - "name": "TickArrayBitmapExtension", - "discriminator": [ - 60, - 150, - 36, - 219, - 97, - 128, - 139, - 153 - ] - }, - { - "name": "TickArrayState", - "discriminator": [ - 192, - 155, - 85, - 205, - 49, - 249, - 129, - 42 - ] - } - ], - "events": [ - { - "name": "ClosePersonalPositionEvent", - "discriminator": [ - 21, - 87, - 99, - 82, - 156, - 11, - 215, - 108 - ] - }, - { - "name": "CollectPersonalFeeEvent", - "discriminator": [ - 166, - 174, - 105, - 192, - 81, - 161, - 83, - 105 - ] - }, - { - "name": "CollectProtocolFeeEvent", - "discriminator": [ - 206, - 87, - 17, - 79, - 45, - 41, - 213, - 61 - ] - }, - { - "name": "ConfigChangeEvent", - "discriminator": [ - 247, - 189, - 7, - 119, - 106, - 112, - 95, - 151 - ] - }, - { - "name": "CreatePersonalPositionEvent", - "discriminator": [ - 100, - 30, - 87, - 249, - 196, - 223, - 154, - 206 - ] - }, - { - "name": "DecreaseLiquidityEvent", - "discriminator": [ - 58, - 222, - 86, - 58, - 68, - 50, - 85, - 56 - ] - }, - { - "name": "IncreaseLiquidityEvent", - "discriminator": [ - 49, - 79, - 105, - 212, - 32, - 34, - 30, - 84 - ] - }, - { - "name": "LiquidityCalculateEvent", - "discriminator": [ - 237, - 112, - 148, - 230, - 57, - 84, - 180, - 162 - ] - }, - { - "name": "LiquidityChangeEvent", - "discriminator": [ - 126, - 240, - 175, - 206, - 158, - 88, - 153, - 107 - ] - }, - { - "name": "PoolCreatedEvent", - "discriminator": [ - 25, - 94, - 75, - 47, - 112, - 99, - 53, - 63 - ] - }, - { - "name": "SwapEvent", - "discriminator": [ - 64, - 198, - 205, - 232, - 38, - 8, - 113, - 226 - ] - }, - { - "name": "UpdateRewardInfosEvent", - "discriminator": [ - 109, - 127, - 186, - 78, - 114, - 65, - 37, - 236 - ] - } - ], - "errors": [ - { - "code": 6000, - "name": "LOK", - "msg": "LOK" - }, - { - "code": 6001, - "name": "NotApproved", - "msg": "Not approved" - }, - { - "code": 6002, - "name": "InvalidUpdateConfigFlag", - "msg": "invalid update amm config flag" - }, - { - "code": 6003, - "name": "AccountLack", - "msg": "Account lack" - }, - { - "code": 6004, - "name": "ClosePositionErr", - "msg": "Remove liquitity, collect fees owed and reward then you can close position account" - }, - { - "code": 6005, - "name": "ZeroMintAmount", - "msg": "Minting amount should be greater than 0" - }, - { - "code": 6006, - "name": "InvaildTickIndex", - "msg": "Tick out of range" - }, - { - "code": 6007, - "name": "TickInvaildOrder", - "msg": "The lower tick must be below the upper tick" - }, - { - "code": 6008, - "name": "TickLowerOverflow", - "msg": "The tick must be greater, or equal to the minimum tick(-443636)" - }, - { - "code": 6009, - "name": "TickUpperOverflow", - "msg": "The tick must be lesser than, or equal to the maximum tick(443636)" - }, - { - "code": 6010, - "name": "TickAndSpacingNotMatch", - "msg": "tick % tick_spacing must be zero" - }, - { - "code": 6011, - "name": "InvalidTickArray", - "msg": "Invaild tick array account" - }, - { - "code": 6012, - "name": "InvalidTickArrayBoundary", - "msg": "Invaild tick array boundary" - }, - { - "code": 6013, - "name": "SqrtPriceLimitOverflow", - "msg": "Square root price limit overflow" - }, - { - "code": 6014, - "name": "SqrtPriceX64", - "msg": "sqrt_price_x64 out of range" - }, - { - "code": 6015, - "name": "LiquiditySubValueErr", - "msg": "Liquidity sub delta L must be smaller than before" - }, - { - "code": 6016, - "name": "LiquidityAddValueErr", - "msg": "Liquidity add delta L must be greater, or equal to before" - }, - { - "code": 6017, - "name": "InvaildLiquidity", - "msg": "Invaild liquidity when update position" - }, - { - "code": 6018, - "name": "ForbidBothZeroForSupplyLiquidity", - "msg": "Both token amount must not be zero while supply liquidity" - }, - { - "code": 6019, - "name": "LiquidityInsufficient", - "msg": "Liquidity insufficient" - }, - { - "code": 6020, - "name": "TransactionTooOld", - "msg": "Transaction too old" - }, - { - "code": 6021, - "name": "PriceSlippageCheck", - "msg": "Price slippage check" - }, - { - "code": 6022, - "name": "TooLittleOutputReceived", - "msg": "Too little output received" - }, - { - "code": 6023, - "name": "TooMuchInputPaid", - "msg": "Too much input paid" - }, - { - "code": 6024, - "name": "ZeroAmountSpecified", - "msg": "Swap special amount can not be zero" - }, - { - "code": 6025, - "name": "InvalidInputPoolVault", - "msg": "Input pool vault is invalid" - }, - { - "code": 6026, - "name": "TooSmallInputOrOutputAmount", - "msg": "Swap input or output amount is too small" - }, - { - "code": 6027, - "name": "NotEnoughTickArrayAccount", - "msg": "Not enought tick array account" - }, - { - "code": 6028, - "name": "InvalidFirstTickArrayAccount", - "msg": "Invaild first tick array account" - }, - { - "code": 6029, - "name": "InvalidRewardIndex", - "msg": "Invalid reward index" - }, - { - "code": 6030, - "name": "FullRewardInfo", - "msg": "The init reward token reach to the max" - }, - { - "code": 6031, - "name": "RewardTokenAlreadyInUse", - "msg": "The init reward token already in use" - }, - { - "code": 6032, - "name": "ExceptPoolVaultMint", - "msg": "The reward tokens must contain one of pool vault mint except the last reward" - }, - { - "code": 6033, - "name": "InvalidRewardInitParam", - "msg": "Invalid reward init param" - }, - { - "code": 6034, - "name": "InvalidRewardDesiredAmount", - "msg": "Invalid collect reward desired amount" - }, - { - "code": 6035, - "name": "InvalidRewardInputAccountNumber", - "msg": "Invalid collect reward input account number" - }, - { - "code": 6036, - "name": "InvalidRewardPeriod", - "msg": "Invalid reward period" - }, - { - "code": 6037, - "name": "NotApproveUpdateRewardEmissiones", - "msg": "Modification of emissiones is allowed within 72 hours from the end of the previous cycle" - }, - { - "code": 6038, - "name": "UnInitializedRewardInfo", - "msg": "uninitialized reward info" - }, - { - "code": 6039, - "name": "NotSupportMint", - "msg": "Not support token_2022 mint extension" - }, - { - "code": 6040, - "name": "MissingTickArrayBitmapExtensionAccount", - "msg": "Missing tickarray bitmap extension account" - }, - { - "code": 6041, - "name": "InsufficientLiquidityForDirection", - "msg": "Insufficient liquidity for this direction" - }, - { - "code": 6042, - "name": "MaxTokenOverflow", - "msg": "Max token overflow" - }, - { - "code": 6043, - "name": "CalculateOverflow", - "msg": "calculate overflow" - } - ], + "instructions": [], + "accounts": [{"name": "PoolState", "discriminator": [247, 237, 227, 245, 215, 195, 222, 70]}], + "events": [], + "errors": [], "types": [ - { - "name": "AmmConfig", - "docs": [ - "Holds the current owner of the factory" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "bump", - "docs": [ - "Bump to identify PDA" - ], - "type": "u8" - }, - { - "name": "index", - "type": "u16" - }, - { - "name": "owner", - "docs": [ - "Address of the protocol owner" - ], - "type": "pubkey" - }, - { - "name": "protocol_fee_rate", - "docs": [ - "The protocol fee" - ], - "type": "u32" - }, - { - "name": "trade_fee_rate", - "docs": [ - "The trade fee, denominated in hundredths of a bip (10^-6)" - ], - "type": "u32" - }, - { - "name": "tick_spacing", - "docs": [ - "The tick spacing" - ], - "type": "u16" - }, - { - "name": "fund_fee_rate", - "docs": [ - "The fund fee, denominated in hundredths of a bip (10^-6)" - ], - "type": "u32" - }, - { - "name": "padding_u32", - "type": "u32" - }, - { - "name": "fund_owner", - "type": "pubkey" - }, - { - "name": "padding", - "type": { - "array": [ - "u64", - 3 - ] - } - } - ] - } - }, - { - "name": "ClosePersonalPositionEvent", - "docs": [ - "Emitted when close a position" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_state", - "docs": [ - "The pool for which liquidity was added" - ], - "type": "pubkey" - }, - { - "name": "closer", - "docs": [ - "The address that close the position" - ], - "type": "pubkey" - }, - { - "name": "nft_owner", - "docs": [ - "The owner of the position and recipient of any minted liquidity" - ], - "type": "pubkey" - }, - { - "name": "tick_lower_index", - "docs": [ - "The lower tick of the position" - ], - "type": "i32" - }, - { - "name": "tick_upper_index", - "docs": [ - "The upper tick of the position" - ], - "type": "i32" - }, - { - "name": "liquidity", - "docs": [ - "The amount of liquidity minted to the position range" - ], - "type": "u128" - }, - { - "name": "position_nft_mint", - "docs": [ - "The mint address of the position NFT" - ], - "type": "pubkey" - } - ] - } - }, - { - "name": "CollectPersonalFeeEvent", - "docs": [ - "Emitted when tokens are collected for a position" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "position_nft_mint", - "docs": [ - "The ID of the token for which underlying tokens were collected" - ], - "type": "pubkey" - }, - { - "name": "recipient_token_account_0", - "docs": [ - "The token account that received the collected token_0 tokens" - ], - "type": "pubkey" - }, - { - "name": "recipient_token_account_1", - "docs": [ - "The token account that received the collected token_1 tokens" - ], - "type": "pubkey" - }, - { - "name": "amount_0", - "docs": [ - "The amount of token_0 owed to the position that was collected" - ], - "type": "u64" - }, - { - "name": "amount_1", - "docs": [ - "The amount of token_1 owed to the position that was collected" - ], - "type": "u64" - } - ] - } - }, - { - "name": "CollectProtocolFeeEvent", - "docs": [ - "Emitted when the collected protocol fees are withdrawn by the factory owner" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_state", - "docs": [ - "The pool whose protocol fee is collected" - ], - "type": "pubkey" - }, - { - "name": "recipient_token_account_0", - "docs": [ - "The address that receives the collected token_0 protocol fees" - ], - "type": "pubkey" - }, - { - "name": "recipient_token_account_1", - "docs": [ - "The address that receives the collected token_1 protocol fees" - ], - "type": "pubkey" - }, - { - "name": "amount_0", - "docs": [ - "The amount of token_0 protocol fees that is withdrawn" - ], - "type": "u64" - }, - { - "name": "amount_1", - "docs": [ - "The amount of token_0 protocol fees that is withdrawn" - ], - "type": "u64" - } - ] - } - }, - { - "name": "ConfigChangeEvent", - "docs": [ - "Emitted when create or update a config" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "index", - "type": "u16" - }, - { - "name": "owner", - "type": "pubkey" - }, - { - "name": "protocol_fee_rate", - "type": "u32" - }, - { - "name": "trade_fee_rate", - "type": "u32" - }, - { - "name": "tick_spacing", - "type": "u16" - }, - { - "name": "fund_fee_rate", - "type": "u32" - }, - { - "name": "fund_owner", - "type": "pubkey" - } - ] - } - }, - { - "name": "CreatePersonalPositionEvent", - "docs": [ - "Emitted when create a new position" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_state", - "docs": [ - "The pool for which liquidity was added" - ], - "type": "pubkey" - }, - { - "name": "minter", - "docs": [ - "The address that create the position" - ], - "type": "pubkey" - }, - { - "name": "nft_owner", - "docs": [ - "The owner of the position and recipient of any minted liquidity" - ], - "type": "pubkey" - }, - { - "name": "tick_lower_index", - "docs": [ - "The lower tick of the position" - ], - "type": "i32" - }, - { - "name": "tick_upper_index", - "docs": [ - "The upper tick of the position" - ], - "type": "i32" - }, - { - "name": "liquidity", - "docs": [ - "The amount of liquidity minted to the position range" - ], - "type": "u128" - }, - { - "name": "deposit_amount_0", - "docs": [ - "The amount of token_0 was deposit for the liquidity" - ], - "type": "u64" - }, - { - "name": "deposit_amount_1", - "docs": [ - "The amount of token_1 was deposit for the liquidity" - ], - "type": "u64" - }, - { - "name": "deposit_amount_0_transfer_fee", - "docs": [ - "The token transfer fee for deposit_amount_0" - ], - "type": "u64" - }, - { - "name": "deposit_amount_1_transfer_fee", - "docs": [ - "The token transfer fee for deposit_amount_1" - ], - "type": "u64" - }, - { - "name": "position_nft_mint", - "docs": [ - "The mint address of the position NFT" - ], - "type": "pubkey" - } - ] - } - }, - { - "name": "DecreaseLiquidityEvent", - "docs": [ - "Emitted when liquidity is decreased." - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "position_nft_mint", - "docs": [ - "The ID of the token for which liquidity was decreased" - ], - "type": "pubkey" - }, - { - "name": "liquidity", - "docs": [ - "The amount by which liquidity for the position was decreased" - ], - "type": "u128" - }, - { - "name": "decrease_amount_0", - "docs": [ - "The amount of token_0 that was paid for the decrease in liquidity" - ], - "type": "u64" - }, - { - "name": "decrease_amount_1", - "docs": [ - "The amount of token_1 that was paid for the decrease in liquidity" - ], - "type": "u64" - }, - { - "name": "fee_amount_0", - "type": "u64" - }, - { - "name": "fee_amount_1", - "docs": [ - "The amount of token_1 fee" - ], - "type": "u64" - }, - { - "name": "reward_amounts", - "docs": [ - "The amount of rewards" - ], - "type": { - "array": [ - "u64", - 3 - ] - } - }, - { - "name": "transfer_fee_0", - "docs": [ - "The amount of token_0 transfer fee" - ], - "type": "u64" - }, - { - "name": "transfer_fee_1", - "docs": [ - "The amount of token_1 transfer fee" - ], - "type": "u64" - } - ] - } - }, - { - "name": "IncreaseLiquidityEvent", - "docs": [ - "Emitted when liquidity is increased." - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "position_nft_mint", - "docs": [ - "The ID of the token for which liquidity was increased" - ], - "type": "pubkey" - }, - { - "name": "liquidity", - "docs": [ - "The amount by which liquidity for the NFT position was increased" - ], - "type": "u128" - }, - { - "name": "amount_0", - "docs": [ - "The amount of token_0 that was paid for the increase in liquidity" - ], - "type": "u64" - }, - { - "name": "amount_1", - "docs": [ - "The amount of token_1 that was paid for the increase in liquidity" - ], - "type": "u64" - }, - { - "name": "amount_0_transfer_fee", - "docs": [ - "The token transfer fee for amount_0" - ], - "type": "u64" - }, - { - "name": "amount_1_transfer_fee", - "docs": [ - "The token transfer fee for amount_1" - ], - "type": "u64" - } - ] - } - }, - { - "name": "InitializeRewardParam", - "type": { - "kind": "struct", - "fields": [ - { - "name": "open_time", - "docs": [ - "Reward open time" - ], - "type": "u64" - }, - { - "name": "end_time", - "docs": [ - "Reward end time" - ], - "type": "u64" - }, - { - "name": "emissions_per_second_x64", - "docs": [ - "Token reward per second are earned per unit of liquidity" - ], - "type": "u128" - } - ] - } - }, - { - "name": "LiquidityCalculateEvent", - "docs": [ - "Emitted when liquidity decreased or increase." - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_liquidity", - "docs": [ - "The pool liquidity before decrease or increase" - ], - "type": "u128" - }, - { - "name": "pool_sqrt_price_x64", - "docs": [ - "The pool price when decrease or increase in liquidity" - ], - "type": "u128" - }, - { - "name": "pool_tick", - "docs": [ - "The pool tick when decrease or increase in liquidity" - ], - "type": "i32" - }, - { - "name": "calc_amount_0", - "docs": [ - "The amount of token_0 that was calculated for the decrease or increase in liquidity" - ], - "type": "u64" - }, - { - "name": "calc_amount_1", - "docs": [ - "The amount of token_1 that was calculated for the decrease or increase in liquidity" - ], - "type": "u64" - }, - { - "name": "trade_fee_owed_0", - "type": "u64" - }, - { - "name": "trade_fee_owed_1", - "docs": [ - "The amount of token_1 fee" - ], - "type": "u64" - }, - { - "name": "transfer_fee_0", - "docs": [ - "The amount of token_0 transfer fee without trade_fee_amount_0" - ], - "type": "u64" - }, - { - "name": "transfer_fee_1", - "docs": [ - "The amount of token_1 transfer fee without trade_fee_amount_0" - ], - "type": "u64" - } - ] - } - }, - { - "name": "LiquidityChangeEvent", - "docs": [ - "Emitted pool liquidity change when increase and decrease liquidity" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_state", - "docs": [ - "The pool for swap" - ], - "type": "pubkey" - }, - { - "name": "tick", - "docs": [ - "The tick of the pool" - ], - "type": "i32" - }, - { - "name": "tick_lower", - "docs": [ - "The tick lower of position" - ], - "type": "i32" - }, - { - "name": "tick_upper", - "docs": [ - "The tick lower of position" - ], - "type": "i32" - }, - { - "name": "liquidity_before", - "docs": [ - "The liquidity of the pool before liquidity change" - ], - "type": "u128" - }, - { - "name": "liquidity_after", - "docs": [ - "The liquidity of the pool after liquidity change" - ], - "type": "u128" - } - ] - } - }, - { - "name": "Observation", - "docs": [ - "The element of observations in ObservationState" - ], - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "block_timestamp", - "docs": [ - "The block timestamp of the observation" - ], - "type": "u32" - }, - { - "name": "tick_cumulative", - "docs": [ - "the cumulative of tick during the duration time" - ], - "type": "i64" - }, - { - "name": "padding", - "docs": [ - "padding for feature update" - ], - "type": { - "array": [ - "u64", - 4 - ] - } - } - ] - } - }, - { - "name": "ObservationState", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "initialized", - "docs": [ - "Whether the ObservationState is initialized" - ], - "type": "bool" - }, - { - "name": "recent_epoch", - "docs": [ - "recent update epoch" - ], - "type": "u64" - }, - { - "name": "observation_index", - "docs": [ - "the most-recently updated index of the observations array" - ], - "type": "u16" - }, - { - "name": "pool_id", - "docs": [ - "belongs to which pool" - ], - "type": "pubkey" - }, - { - "name": "observations", - "docs": [ - "observation array" - ], - "type": { - "array": [ - { - "defined": { - "name": "Observation" - } - }, - 100 - ] - } - }, - { - "name": "padding", - "docs": [ - "padding for feature update" - ], - "type": { - "array": [ - "u64", - 4 - ] - } - } - ] - } - }, - { - "name": "OperationState", - "docs": [ - "Holds the current owner of the factory" - ], - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "bump", - "docs": [ - "Bump to identify PDA" - ], - "type": "u8" - }, - { - "name": "operation_owners", - "docs": [ - "Address of the operation owner" - ], - "type": { - "array": [ - "pubkey", - 10 - ] - } - }, - { - "name": "whitelist_mints", - "docs": [ - "The mint address of whitelist to emmit reward" - ], - "type": { - "array": [ - "pubkey", - 100 - ] - } - } - ] - } - }, - { - "name": "PersonalPositionState", - "type": { - "kind": "struct", - "fields": [ - { - "name": "bump", - "docs": [ - "Bump to identify PDA" - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "nft_mint", - "docs": [ - "Mint address of the tokenized position" - ], - "type": "pubkey" - }, - { - "name": "pool_id", - "docs": [ - "The ID of the pool with which this token is connected" - ], - "type": "pubkey" - }, - { - "name": "tick_lower_index", - "docs": [ - "The lower bound tick of the position" - ], - "type": "i32" - }, - { - "name": "tick_upper_index", - "docs": [ - "The upper bound tick of the position" - ], - "type": "i32" - }, - { - "name": "liquidity", - "docs": [ - "The amount of liquidity owned by this position" - ], - "type": "u128" - }, - { - "name": "fee_growth_inside_0_last_x64", - "docs": [ - "The token_0 fee growth of the aggregate position as of the last action on the individual position" - ], - "type": "u128" - }, - { - "name": "fee_growth_inside_1_last_x64", - "docs": [ - "The token_1 fee growth of the aggregate position as of the last action on the individual position" - ], - "type": "u128" - }, - { - "name": "token_fees_owed_0", - "docs": [ - "The fees owed to the position owner in token_0, as of the last computation" - ], - "type": "u64" - }, - { - "name": "token_fees_owed_1", - "docs": [ - "The fees owed to the position owner in token_1, as of the last computation" - ], - "type": "u64" - }, - { - "name": "reward_infos", - "type": { - "array": [ - { - "defined": { - "name": "PositionRewardInfo" - } - }, - 3 - ] - } - }, - { - "name": "recent_epoch", - "type": "u64" - }, - { - "name": "padding", - "type": { - "array": [ - "u64", - 7 - ] - } - } - ] - } - }, - { - "name": "PoolCreatedEvent", - "docs": [ - "Emitted when a pool is created and initialized with a starting price", - "" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "token_mint_0", - "docs": [ - "The first token of the pool by address sort order" - ], - "type": "pubkey" - }, - { - "name": "token_mint_1", - "docs": [ - "The second token of the pool by address sort order" - ], - "type": "pubkey" - }, - { - "name": "tick_spacing", - "docs": [ - "The minimum number of ticks between initialized ticks" - ], - "type": "u16" - }, - { - "name": "pool_state", - "docs": [ - "The address of the created pool" - ], - "type": "pubkey" - }, - { - "name": "sqrt_price_x64", - "docs": [ - "The initial sqrt price of the pool, as a Q64.64" - ], - "type": "u128" - }, - { - "name": "tick", - "docs": [ - "The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool" - ], - "type": "i32" - }, - { - "name": "token_vault_0", - "docs": [ - "Vault of token_0" - ], - "type": "pubkey" - }, - { - "name": "token_vault_1", - "docs": [ - "Vault of token_1" - ], - "type": "pubkey" - } - ] - } - }, { "name": "PoolState", - "docs": [ - "The pool state", - "", - "PDA of `[POOL_SEED, config, token_mint_0, token_mint_1]`", - "" - ], + "docs": ["The pool state", "", "PDA of `[POOL_SEED, config, token_mint_0, token_mint_1]`", ""], "serialization": "bytemuckunsafe", - "repr": { - "kind": "c", - "packed": true - }, + "repr": {"kind": "c", "packed": true}, "type": { "kind": "struct", "fields": [ - { - "name": "bump", - "docs": [ - "Bump to identify PDA" - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "amm_config", - "type": "pubkey" - }, - { - "name": "owner", - "type": "pubkey" - }, - { - "name": "token_mint_0", - "docs": [ - "Token pair of the pool, where token_mint_0 address < token_mint_1 address" - ], - "type": "pubkey" - }, - { - "name": "token_mint_1", - "type": "pubkey" - }, - { - "name": "token_vault_0", - "docs": [ - "Token pair vault" - ], - "type": "pubkey" - }, - { - "name": "token_vault_1", - "type": "pubkey" - }, - { - "name": "observation_key", - "docs": [ - "observation account key" - ], - "type": "pubkey" - }, - { - "name": "mint_decimals_0", - "docs": [ - "mint0 and mint1 decimals" - ], - "type": "u8" - }, - { - "name": "mint_decimals_1", - "type": "u8" - }, - { - "name": "tick_spacing", - "docs": [ - "The minimum number of ticks between initialized ticks" - ], - "type": "u16" - }, - { - "name": "liquidity", - "docs": [ - "The currently in range liquidity available to the pool." - ], - "type": "u128" - }, - { - "name": "sqrt_price_x64", - "docs": [ - "The current price of the pool as a sqrt(token_1/token_0) Q64.64 value" - ], - "type": "u128" - }, - { - "name": "tick_current", - "docs": [ - "The current tick of the pool, i.e. according to the last tick transition that was run." - ], - "type": "i32" - }, - { - "name": "padding3", - "type": "u16" - }, - { - "name": "padding4", - "type": "u16" - }, + {"name": "bump", "docs": ["Bump to identify PDA"], "type": {"array": ["u8", 1]}}, + {"name": "amm_config", "type": "pubkey"}, + {"name": "owner", "type": "pubkey"}, + {"name": "token_mint_0", "docs": ["Token pair of the pool, where token_mint_0 address < token_mint_1 address"], "type": "pubkey"}, + {"name": "token_mint_1", "type": "pubkey"}, + {"name": "token_vault_0", "docs": ["Token pair vault"], "type": "pubkey"}, + {"name": "token_vault_1", "type": "pubkey"}, + {"name": "observation_key", "docs": ["observation account key"], "type": "pubkey"}, + {"name": "mint_decimals_0", "docs": ["mint0 and mint1 decimals"], "type": "u8"}, + {"name": "mint_decimals_1", "type": "u8"}, + {"name": "tick_spacing", "docs": ["The minimum number of ticks between initialized ticks"], "type": "u16"}, + {"name": "liquidity", "docs": ["The currently in range liquidity available to the pool."], "type": "u128"}, + {"name": "sqrt_price_x64", "docs": ["The current price of the pool as a sqrt(token_1/token_0) Q64.64 value"], "type": "u128"}, + {"name": "tick_current", "docs": ["The current tick of the pool, i.e. according to the last tick transition that was run."], "type": "i32"}, + {"name": "padding3", "type": "u16"}, + {"name": "padding4", "type": "u16"}, { "name": "fee_growth_global_0_x64", "docs": [ @@ -4924,40 +43,13 @@ ], "type": "u128" }, - { - "name": "fee_growth_global_1_x64", - "type": "u128" - }, - { - "name": "protocol_fees_token_0", - "docs": [ - "The amounts of token_0 and token_1 that are owed to the protocol." - ], - "type": "u64" - }, - { - "name": "protocol_fees_token_1", - "type": "u64" - }, - { - "name": "swap_in_amount_token_0", - "docs": [ - "The amounts in and out of swap token_0 and token_1" - ], - "type": "u128" - }, - { - "name": "swap_out_amount_token_1", - "type": "u128" - }, - { - "name": "swap_in_amount_token_1", - "type": "u128" - }, - { - "name": "swap_out_amount_token_0", - "type": "u128" - }, + {"name": "fee_growth_global_1_x64", "type": "u128"}, + {"name": "protocol_fees_token_0", "docs": ["The amounts of token_0 and token_1 that are owed to the protocol."], "type": "u64"}, + {"name": "protocol_fees_token_1", "type": "u64"}, + {"name": "swap_in_amount_token_0", "docs": ["The amounts in and out of swap token_0 and token_1"], "type": "u128"}, + {"name": "swap_out_amount_token_1", "type": "u128"}, + {"name": "swap_in_amount_token_1", "type": "u128"}, + {"name": "swap_out_amount_token_0", "type": "u128"}, { "name": "status", "docs": [ @@ -4970,590 +62,50 @@ ], "type": "u8" }, - { - "name": "padding", - "docs": [ - "Leave blank for future use" - ], - "type": { - "array": [ - "u8", - 7 - ] - } - }, - { - "name": "reward_infos", - "type": { - "array": [ - { - "defined": { - "name": "RewardInfo" - } - }, - 3 - ] - } - }, - { - "name": "tick_array_bitmap", - "docs": [ - "Packed initialized tick array state" - ], - "type": { - "array": [ - "u64", - 16 - ] - } - }, - { - "name": "total_fees_token_0", - "docs": [ - "except protocol_fee and fund_fee" - ], - "type": "u64" - }, - { - "name": "total_fees_claimed_token_0", - "docs": [ - "except protocol_fee and fund_fee" - ], - "type": "u64" - }, - { - "name": "total_fees_token_1", - "type": "u64" - }, - { - "name": "total_fees_claimed_token_1", - "type": "u64" - }, - { - "name": "fund_fees_token_0", - "type": "u64" - }, - { - "name": "fund_fees_token_1", - "type": "u64" - }, - { - "name": "open_time", - "type": "u64" - }, - { - "name": "recent_epoch", - "type": "u64" - }, - { - "name": "padding1", - "type": { - "array": [ - "u64", - 24 - ] - } - }, - { - "name": "padding2", - "type": { - "array": [ - "u64", - 32 - ] - } - } - ] - } - }, - { - "name": "PositionRewardInfo", - "type": { - "kind": "struct", - "fields": [ - { - "name": "growth_inside_last_x64", - "type": "u128" - }, - { - "name": "reward_amount_owed", - "type": "u64" - } - ] - } - }, - { - "name": "ProtocolPositionState", - "docs": [ - "Info stored for each user's position" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "bump", - "docs": [ - "Bump to identify PDA" - ], - "type": "u8" - }, - { - "name": "pool_id", - "docs": [ - "The ID of the pool with which this token is connected" - ], - "type": "pubkey" - }, - { - "name": "tick_lower_index", - "docs": [ - "The lower bound tick of the position" - ], - "type": "i32" - }, - { - "name": "tick_upper_index", - "docs": [ - "The upper bound tick of the position" - ], - "type": "i32" - }, - { - "name": "liquidity", - "docs": [ - "The amount of liquidity owned by this position" - ], - "type": "u128" - }, - { - "name": "fee_growth_inside_0_last_x64", - "docs": [ - "The token_0 fee growth per unit of liquidity as of the last update to liquidity or fees owed" - ], - "type": "u128" - }, - { - "name": "fee_growth_inside_1_last_x64", - "docs": [ - "The token_1 fee growth per unit of liquidity as of the last update to liquidity or fees owed" - ], - "type": "u128" - }, - { - "name": "token_fees_owed_0", - "docs": [ - "The fees owed to the position owner in token_0" - ], - "type": "u64" - }, - { - "name": "token_fees_owed_1", - "docs": [ - "The fees owed to the position owner in token_1" - ], - "type": "u64" - }, - { - "name": "reward_growth_inside", - "docs": [ - "The reward growth per unit of liquidity as of the last update to liquidity" - ], - "type": { - "array": [ - "u128", - 3 - ] - } - }, - { - "name": "recent_epoch", - "type": "u64" - }, - { - "name": "padding", - "type": { - "array": [ - "u64", - 7 - ] - } - } + {"name": "padding", "docs": ["Leave blank for future use"], "type": {"array": ["u8", 7]}}, + {"name": "reward_infos", "type": {"array": [{"defined": {"name": "RewardInfo"}}, 3]}}, + {"name": "tick_array_bitmap", "docs": ["Packed initialized tick array state"], "type": {"array": ["u64", 16]}}, + {"name": "total_fees_token_0", "docs": ["except protocol_fee and fund_fee"], "type": "u64"}, + {"name": "total_fees_claimed_token_0", "docs": ["except protocol_fee and fund_fee"], "type": "u64"}, + {"name": "total_fees_token_1", "type": "u64"}, + {"name": "total_fees_claimed_token_1", "type": "u64"}, + {"name": "fund_fees_token_0", "type": "u64"}, + {"name": "fund_fees_token_1", "type": "u64"}, + {"name": "open_time", "type": "u64"}, + {"name": "recent_epoch", "type": "u64"}, + {"name": "padding1", "type": {"array": ["u64", 24]}}, + {"name": "padding2", "type": {"array": ["u64", 32]}} ] } }, { "name": "RewardInfo", "serialization": "bytemuckunsafe", - "repr": { - "kind": "c", - "packed": true - }, + "repr": {"kind": "c", "packed": true}, "type": { "kind": "struct", "fields": [ - { - "name": "reward_state", - "docs": [ - "Reward state" - ], - "type": "u8" - }, - { - "name": "open_time", - "docs": [ - "Reward open time" - ], - "type": "u64" - }, - { - "name": "end_time", - "docs": [ - "Reward end time" - ], - "type": "u64" - }, - { - "name": "last_update_time", - "docs": [ - "Reward last update time" - ], - "type": "u64" - }, + {"name": "reward_state", "docs": ["Reward state"], "type": "u8"}, + {"name": "open_time", "docs": ["Reward open time"], "type": "u64"}, + {"name": "end_time", "docs": ["Reward end time"], "type": "u64"}, + {"name": "last_update_time", "docs": ["Reward last update time"], "type": "u64"}, { "name": "emissions_per_second_x64", - "docs": [ - "Q64.64 number indicates how many tokens per second are earned per unit of liquidity." - ], + "docs": ["Q64.64 number indicates how many tokens per second are earned per unit of liquidity."], "type": "u128" }, - { - "name": "reward_total_emissioned", - "docs": [ - "The total amount of reward emissioned" - ], - "type": "u64" - }, - { - "name": "reward_claimed", - "docs": [ - "The total amount of claimed reward" - ], - "type": "u64" - }, - { - "name": "token_mint", - "docs": [ - "Reward token mint." - ], - "type": "pubkey" - }, - { - "name": "token_vault", - "docs": [ - "Reward vault token account." - ], - "type": "pubkey" - }, - { - "name": "authority", - "docs": [ - "The owner that has permission to set reward param" - ], - "type": "pubkey" - }, + {"name": "reward_total_emissioned", "docs": ["The total amount of reward emissioned"], "type": "u64"}, + {"name": "reward_claimed", "docs": ["The total amount of claimed reward"], "type": "u64"}, + {"name": "token_mint", "docs": ["Reward token mint."], "type": "pubkey"}, + {"name": "token_vault", "docs": ["Reward vault token account."], "type": "pubkey"}, + {"name": "authority", "docs": ["The owner that has permission to set reward param"], "type": "pubkey"}, { "name": "reward_growth_global_x64", - "docs": [ - "Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward", - "emissions were turned on." - ], + "docs": ["Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward", "emissions were turned on."], "type": "u128" } ] } - }, - { - "name": "SwapEvent", - "docs": [ - "Emitted by when a swap is performed for a pool" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_state", - "docs": [ - "The pool for which token_0 and token_1 were swapped" - ], - "type": "pubkey" - }, - { - "name": "sender", - "docs": [ - "The address that initiated the swap call, and that received the callback" - ], - "type": "pubkey" - }, - { - "name": "token_account_0", - "docs": [ - "The payer token account in zero for one swaps, or the recipient token account", - "in one for zero swaps" - ], - "type": "pubkey" - }, - { - "name": "token_account_1", - "docs": [ - "The payer token account in one for zero swaps, or the recipient token account", - "in zero for one swaps" - ], - "type": "pubkey" - }, - { - "name": "amount_0", - "docs": [ - "The real delta amount of the token_0 of the pool or user" - ], - "type": "u64" - }, - { - "name": "transfer_fee_0", - "docs": [ - "The transfer fee charged by the withheld_amount of the token_0" - ], - "type": "u64" - }, - { - "name": "amount_1", - "docs": [ - "The real delta of the token_1 of the pool or user" - ], - "type": "u64" - }, - { - "name": "transfer_fee_1", - "docs": [ - "The transfer fee charged by the withheld_amount of the token_1" - ], - "type": "u64" - }, - { - "name": "zero_for_one", - "docs": [ - "if true, amount_0 is negtive and amount_1 is positive" - ], - "type": "bool" - }, - { - "name": "sqrt_price_x64", - "docs": [ - "The sqrt(price) of the pool after the swap, as a Q64.64" - ], - "type": "u128" - }, - { - "name": "liquidity", - "docs": [ - "The liquidity of the pool after the swap" - ], - "type": "u128" - }, - { - "name": "tick", - "docs": [ - "The log base 1.0001 of price of the pool after the swap" - ], - "type": "i32" - } - ] - } - }, - { - "name": "TickArrayBitmapExtension", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_id", - "type": "pubkey" - }, - { - "name": "positive_tick_array_bitmap", - "docs": [ - "Packed initialized tick array state for start_tick_index is positive" - ], - "type": { - "array": [ - { - "array": [ - "u64", - 8 - ] - }, - 14 - ] - } - }, - { - "name": "negative_tick_array_bitmap", - "docs": [ - "Packed initialized tick array state for start_tick_index is negitive" - ], - "type": { - "array": [ - { - "array": [ - "u64", - 8 - ] - }, - 14 - ] - } - } - ] - } - }, - { - "name": "TickArrayState", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_id", - "type": "pubkey" - }, - { - "name": "start_tick_index", - "type": "i32" - }, - { - "name": "ticks", - "type": { - "array": [ - { - "defined": { - "name": "TickState" - } - }, - 60 - ] - } - }, - { - "name": "initialized_tick_count", - "type": "u8" - }, - { - "name": "recent_epoch", - "type": "u64" - }, - { - "name": "padding", - "type": { - "array": [ - "u8", - 107 - ] - } - } - ] - } - }, - { - "name": "TickState", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "tick", - "type": "i32" - }, - { - "name": "liquidity_net", - "docs": [ - "Amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left)" - ], - "type": "i128" - }, - { - "name": "liquidity_gross", - "docs": [ - "The total position liquidity that references this tick" - ], - "type": "u128" - }, - { - "name": "fee_growth_outside_0_x64", - "docs": [ - "Fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)", - "only has relative meaning, not absolute — the value depends on when the tick is initialized" - ], - "type": "u128" - }, - { - "name": "fee_growth_outside_1_x64", - "type": "u128" - }, - { - "name": "reward_growths_outside_x64", - "type": { - "array": [ - "u128", - 3 - ] - } - }, - { - "name": "padding", - "type": { - "array": [ - "u32", - 13 - ] - } - } - ] - } - }, - { - "name": "UpdateRewardInfosEvent", - "docs": [ - "Emitted when Reward are updated for a pool" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "reward_growth_global_x64", - "docs": [ - "Reward info" - ], - "type": { - "array": [ - "u128", - 3 - ] - } - } - ] - } } ] } \ No newline at end of file diff --git a/projects/umbra/idls/umbra_amm.json b/projects/umbra/idls/umbra_amm.json index 2d40b6ee9..10207b68c 100644 --- a/projects/umbra/idls/umbra_amm.json +++ b/projects/umbra/idls/umbra_amm.json @@ -1,1981 +1,33 @@ { "address": "CPMMQoayoCZGUq4wQRxrPBNrrExU6PLg1eEAXC83KDzv", - "metadata": { - "name": "umbra_amm", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "collect_fund_fee", - "docs": [ - "Collect the fund fee accrued to the pool", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1", - "* `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0", - "" - ], - "discriminator": [ - 167, - 138, - 78, - 149, - 223, - 194, - 6, - 126 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Only admin or fund_owner can collect fee now" - ], - "signer": true - }, - { - "name": "authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 110, - 100, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 95, - 115, - 101, - 101, - 100 - ] - } - ] - } - }, - { - "name": "pool_state", - "docs": [ - "Pool state stores accumulated protocol fee amount" - ], - "writable": true - }, - { - "name": "amm_config", - "docs": [ - "Amm config account stores fund_owner" - ] - }, - { - "name": "token_0_vault", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_1_vault", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token_0 vault" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token_1 vault" - ] - }, - { - "name": "recipient_token_0_account", - "docs": [ - "The address that receives the collected token_0 fund fees" - ], - "writable": true - }, - { - "name": "recipient_token_1_account", - "docs": [ - "The address that receives the collected token_1 fund fees" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "The SPL program to perform token transfers" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "The SPL program 2022 to perform token transfers" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - } - ], - "args": [ - { - "name": "amount_0_requested", - "type": "u64" - }, - { - "name": "amount_1_requested", - "type": "u64" - } - ] - }, - { - "name": "collect_protocol_fee", - "docs": [ - "Collect the protocol fee accrued to the pool", - "", - "# Arguments", - "", - "* `ctx` - The context of accounts", - "* `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1", - "* `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0", - "" - ], - "discriminator": [ - 136, - 136, - 252, - 221, - 194, - 66, - 126, - 89 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Only admin or owner can collect fee now" - ], - "signer": true - }, - { - "name": "authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 110, - 100, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 95, - 115, - 101, - 101, - 100 - ] - } - ] - } - }, - { - "name": "pool_state", - "docs": [ - "Pool state stores accumulated protocol fee amount" - ], - "writable": true - }, - { - "name": "amm_config", - "docs": [ - "Amm config account stores owner" - ] - }, - { - "name": "token_0_vault", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_1_vault", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token_0 vault" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token_1 vault" - ] - }, - { - "name": "recipient_token_0_account", - "docs": [ - "The address that receives the collected token_0 protocol fees" - ], - "writable": true - }, - { - "name": "recipient_token_1_account", - "docs": [ - "The address that receives the collected token_1 protocol fees" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "The SPL program to perform token transfers" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "The SPL program 2022 to perform token transfers" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - } - ], - "args": [ - { - "name": "amount_0_requested", - "type": "u64" - }, - { - "name": "amount_1_requested", - "type": "u64" - } - ] - }, - { - "name": "create_amm_config", - "docs": [ - "# Arguments", - "", - "* `ctx`- The accounts needed by instruction.", - "* `index` - The index of amm config, there may be multiple config.", - "* `trade_fee_rate` - Trade fee rate, can be changed.", - "* `protocol_fee_rate` - The rate of protocol fee within tarde fee.", - "* `fund_fee_rate` - The rate of fund fee within tarde fee.", - "" - ], - "discriminator": [ - 137, - 52, - 237, - 212, - 215, - 117, - 108, - 104 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Address to be set as protocol owner." - ], - "writable": true, - "signer": true, - "address": "8FeijbkxxXJEB1f14feTryJH5B57s8Jrx26nE1VuaTDA" - }, - { - "name": "amm_config", - "docs": [ - "Initialize config state account to store protocol owner address and fee rates." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 97, - 109, - 109, - 95, - 99, - 111, - 110, - 102, - 105, - 103 - ] - }, - { - "kind": "arg", - "path": "index" - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "index", - "type": "u16" - }, - { - "name": "trade_fee_rate", - "type": "u64" - }, - { - "name": "protocol_fee_rate", - "type": "u64" - }, - { - "name": "fund_fee_rate", - "type": "u64" - }, - { - "name": "create_pool_fee", - "type": "u64" - } - ] - }, - { - "name": "deposit", - "docs": [ - "Creates a pool for the given token pair and the initial price", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `lp_token_amount` - Pool token amount to transfer. token_a and token_b amount are set by the current exchange rate and size of the pool", - "* `maximum_token_0_amount` - Maximum token 0 amount to deposit, prevents excessive slippage", - "* `maximum_token_1_amount` - Maximum token 1 amount to deposit, prevents excessive slippage", - "" - ], - "discriminator": [ - 242, - 35, - 198, - 137, - 82, - 225, - 242, - 182 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Pays to mint the position" - ], - "signer": true - }, - { - "name": "authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 110, - 100, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 95, - 115, - 101, - 101, - 100 - ] - } - ] - } - }, - { - "name": "pool_state", - "writable": true - }, - { - "name": "owner_lp_token", - "docs": [ - "Owner lp tokan account" - ], - "writable": true - }, - { - "name": "token_0_account", - "docs": [ - "The payer's token account for token_0" - ], - "writable": true - }, - { - "name": "token_1_account", - "docs": [ - "The payer's token account for token_1" - ], - "writable": true - }, - { - "name": "token_0_vault", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_1_vault", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "token Program" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "Token program 2022" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token_0 vault" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token_1 vault" - ] - }, - { - "name": "lp_mint", - "docs": [ - "Lp token mint" - ], - "writable": true - } - ], - "args": [ - { - "name": "lp_token_amount", - "type": "u64" - }, - { - "name": "maximum_token_0_amount", - "type": "u64" - }, - { - "name": "maximum_token_1_amount", - "type": "u64" - } - ] - }, - { - "name": "initialize", - "docs": [ - "Creates a pool for the given token pair and the initial price", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `init_amount_0` - the initial amount_0 to deposit", - "* `init_amount_1` - the initial amount_1 to deposit", - "* `open_time` - the timestamp allowed for swap", - "" - ], - "discriminator": [ - 175, - 175, - 109, - 31, - 13, - 152, - 155, - 237 - ], - "accounts": [ - { - "name": "creator", - "docs": [ - "Address paying to create the pool. Can be anyone" - ], - "writable": true, - "signer": true - }, - { - "name": "amm_config", - "docs": [ - "Which config the pool belongs to." - ] - }, - { - "name": "authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 110, - 100, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 95, - 115, - 101, - 101, - 100 - ] - } - ] - } - }, - { - "name": "pool_state", - "docs": [ - "PDA account:", - "seeds = [", - "POOL_SEED.as_bytes(),", - "amm_config.key().as_ref(),", - "token_0_mint.key().as_ref(),", - "token_1_mint.key().as_ref(),", - "],", - "", - "Or random account: must be signed by cli" - ], - "writable": true - }, - { - "name": "token_0_mint", - "docs": [ - "Token_0 mint, the key must smaller then token_1 mint." - ] - }, - { - "name": "token_1_mint", - "docs": [ - "Token_1 mint, the key must grater then token_0 mint." - ] - }, - { - "name": "lp_mint", - "docs": [ - "pool lp mint" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 111, - 108, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "pool_state" - } - ] - } - }, - { - "name": "creator_token_0", - "docs": [ - "payer token0 account" - ], - "writable": true - }, - { - "name": "creator_token_1", - "docs": [ - "creator token1 account" - ], - "writable": true - }, - { - "name": "creator_lp_token", - "docs": [ - "creator lp token account" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "creator" - }, - { - "kind": "const", - "value": [ - 6, - 221, - 246, - 225, - 215, - 101, - 161, - 147, - 217, - 203, - 225, - 70, - 206, - 235, - 121, - 172, - 28, - 180, - 133, - 237, - 95, - 91, - 55, - 145, - 58, - 140, - 245, - 133, - 126, - 255, - 0, - 169 - ] - }, - { - "kind": "account", - "path": "lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "token_0_vault", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 111, - 108, - 95, - 118, - 97, - 117, - 108, - 116 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "account", - "path": "token_0_mint" - } - ] - } - }, - { - "name": "token_1_vault", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 111, - 111, - 108, - 95, - 118, - 97, - 117, - 108, - 116 - ] - }, - { - "kind": "account", - "path": "pool_state" - }, - { - "kind": "account", - "path": "token_1_mint" - } - ] - } - }, - { - "name": "create_pool_fee", - "docs": [ - "create pool fee account" - ], - "writable": true, - "address": "Bzsi8fW9x4ahRgC8xNdxrr5NNWm8DBSrQnE322vi1YWH" - }, - { - "name": "observation_state", - "docs": [ - "an account to store oracle observations" - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 111, - 98, - 115, - 101, - 114, - 118, - 97, - 116, - 105, - 111, - 110 - ] - }, - { - "kind": "account", - "path": "pool_state" - } - ] - } - }, - { - "name": "token_program", - "docs": [ - "Program to create mint account and mint tokens" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_0_program", - "docs": [ - "Spl token program or token program 2022" - ] - }, - { - "name": "token_1_program", - "docs": [ - "Spl token program or token program 2022" - ] - }, - { - "name": "associated_token_program", - "docs": [ - "Program to create an ATA for receiving position NFT" - ], - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "system_program", - "docs": [ - "To create a new program account" - ], - "address": "11111111111111111111111111111111" - }, - { - "name": "rent", - "docs": [ - "Sysvar for program account" - ], - "address": "SysvarRent111111111111111111111111111111111" - } - ], - "args": [ - { - "name": "init_amount_0", - "type": "u64" - }, - { - "name": "init_amount_1", - "type": "u64" - }, - { - "name": "open_time", - "type": "u64" - } - ] - }, - { - "name": "swap_base_input", - "docs": [ - "Swap the tokens in the pool base input amount", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `amount_in` - input amount to transfer, output to DESTINATION is based on the exchange rate", - "* `minimum_amount_out` - Minimum amount of output token, prevents excessive slippage", - "" - ], - "discriminator": [ - 143, - 190, - 90, - 218, - 196, - 30, - 51, - 222 - ], - "accounts": [ - { - "name": "payer", - "docs": [ - "The user performing the swap" - ], - "signer": true - }, - { - "name": "authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 110, - 100, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 95, - 115, - 101, - 101, - 100 - ] - } - ] - } - }, - { - "name": "amm_config", - "docs": [ - "The factory state to read protocol fees" - ] - }, - { - "name": "pool_state", - "docs": [ - "The program account of the pool in which the swap will be performed" - ], - "writable": true - }, - { - "name": "input_token_account", - "docs": [ - "The user token account for input token" - ], - "writable": true - }, - { - "name": "output_token_account", - "docs": [ - "The user token account for output token" - ], - "writable": true - }, - { - "name": "input_vault", - "docs": [ - "The vault token account for input token" - ], - "writable": true - }, - { - "name": "output_vault", - "docs": [ - "The vault token account for output token" - ], - "writable": true - }, - { - "name": "input_token_program", - "docs": [ - "SPL program for input token transfers" - ] - }, - { - "name": "output_token_program", - "docs": [ - "SPL program for output token transfers" - ] - }, - { - "name": "input_token_mint", - "docs": [ - "The mint of input token" - ] - }, - { - "name": "output_token_mint", - "docs": [ - "The mint of output token" - ] - }, - { - "name": "observation_state", - "docs": [ - "The program account for the most recent oracle observation" - ], - "writable": true - } - ], - "args": [ - { - "name": "amount_in", - "type": "u64" - }, - { - "name": "minimum_amount_out", - "type": "u64" - } - ] - }, - { - "name": "swap_base_output", - "docs": [ - "Swap the tokens in the pool base output amount", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `max_amount_in` - input amount prevents excessive slippage", - "* `amount_out` - amount of output token", - "" - ], - "discriminator": [ - 55, - 217, - 98, - 86, - 163, - 74, - 180, - 173 - ], - "accounts": [ - { - "name": "payer", - "docs": [ - "The user performing the swap" - ], - "signer": true - }, - { - "name": "authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 110, - 100, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 95, - 115, - 101, - 101, - 100 - ] - } - ] - } - }, - { - "name": "amm_config", - "docs": [ - "The factory state to read protocol fees" - ] - }, - { - "name": "pool_state", - "docs": [ - "The program account of the pool in which the swap will be performed" - ], - "writable": true - }, - { - "name": "input_token_account", - "docs": [ - "The user token account for input token" - ], - "writable": true - }, - { - "name": "output_token_account", - "docs": [ - "The user token account for output token" - ], - "writable": true - }, - { - "name": "input_vault", - "docs": [ - "The vault token account for input token" - ], - "writable": true - }, - { - "name": "output_vault", - "docs": [ - "The vault token account for output token" - ], - "writable": true - }, - { - "name": "input_token_program", - "docs": [ - "SPL program for input token transfers" - ] - }, - { - "name": "output_token_program", - "docs": [ - "SPL program for output token transfers" - ] - }, - { - "name": "input_token_mint", - "docs": [ - "The mint of input token" - ] - }, - { - "name": "output_token_mint", - "docs": [ - "The mint of output token" - ] - }, - { - "name": "observation_state", - "docs": [ - "The program account for the most recent oracle observation" - ], - "writable": true - } - ], - "args": [ - { - "name": "max_amount_in", - "type": "u64" - }, - { - "name": "amount_out", - "type": "u64" - } - ] - }, - { - "name": "update_amm_config", - "docs": [ - "Updates the owner of the amm config", - "Must be called by the current owner or admin", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `trade_fee_rate`- The new trade fee rate of amm config, be set when `param` is 0", - "* `protocol_fee_rate`- The new protocol fee rate of amm config, be set when `param` is 1", - "* `fund_fee_rate`- The new fund fee rate of amm config, be set when `param` is 2", - "* `new_owner`- The config's new owner, be set when `param` is 3", - "* `new_fund_owner`- The config's new fund owner, be set when `param` is 4", - "* `param`- The vaule can be 0 | 1 | 2 | 3 | 4, otherwise will report a error", - "" - ], - "discriminator": [ - 49, - 60, - 174, - 136, - 154, - 28, - 116, - 200 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "The amm config owner or admin" - ], - "signer": true, - "address": "8FeijbkxxXJEB1f14feTryJH5B57s8Jrx26nE1VuaTDA" - }, - { - "name": "amm_config", - "docs": [ - "Amm config account to be changed" - ], - "writable": true - } - ], - "args": [ - { - "name": "param", - "type": "u8" - }, - { - "name": "value", - "type": "u64" - } - ] - }, - { - "name": "update_pool_status", - "docs": [ - "Update pool status for given vaule", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `status` - The vaule of status", - "" - ], - "discriminator": [ - 130, - 87, - 108, - 6, - 46, - 224, - 117, - 123 - ], - "accounts": [ - { - "name": "authority", - "signer": true, - "address": "8FeijbkxxXJEB1f14feTryJH5B57s8Jrx26nE1VuaTDA" - }, - { - "name": "pool_state", - "writable": true - } - ], - "args": [ - { - "name": "status", - "type": "u8" - } - ] - }, - { - "name": "withdraw", - "docs": [ - "Withdraw lp for token0 ande token1", - "", - "# Arguments", - "", - "* `ctx`- The context of accounts", - "* `lp_token_amount` - Amount of pool tokens to burn. User receives an output of token a and b based on the percentage of the pool tokens that are returned.", - "* `minimum_token_0_amount` - Minimum amount of token 0 to receive, prevents excessive slippage", - "* `minimum_token_1_amount` - Minimum amount of token 1 to receive, prevents excessive slippage", - "" - ], - "discriminator": [ - 183, - 18, - 70, - 156, - 148, - 109, - 161, - 34 - ], - "accounts": [ - { - "name": "owner", - "docs": [ - "Pays to mint the position" - ], - "signer": true - }, - { - "name": "authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 110, - 100, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 95, - 115, - 101, - 101, - 100 - ] - } - ] - } - }, - { - "name": "pool_state", - "docs": [ - "Pool state account" - ], - "writable": true - }, - { - "name": "owner_lp_token", - "docs": [ - "Owner lp token account" - ], - "writable": true - }, - { - "name": "token_0_account", - "docs": [ - "The token account for receive token_0," - ], - "writable": true - }, - { - "name": "token_1_account", - "docs": [ - "The token account for receive token_1" - ], - "writable": true - }, - { - "name": "token_0_vault", - "docs": [ - "The address that holds pool tokens for token_0" - ], - "writable": true - }, - { - "name": "token_1_vault", - "docs": [ - "The address that holds pool tokens for token_1" - ], - "writable": true - }, - { - "name": "token_program", - "docs": [ - "token Program" - ], - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_program_2022", - "docs": [ - "Token program 2022" - ], - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "vault_0_mint", - "docs": [ - "The mint of token_0 vault" - ] - }, - { - "name": "vault_1_mint", - "docs": [ - "The mint of token_1 vault" - ] - }, - { - "name": "lp_mint", - "docs": [ - "Pool lp token mint" - ], - "writable": true - }, - { - "name": "memo_program", - "docs": [ - "memo program" - ], - "address": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr" - } - ], - "args": [ - { - "name": "lp_token_amount", - "type": "u64" - }, - { - "name": "minimum_token_0_amount", - "type": "u64" - }, - { - "name": "minimum_token_1_amount", - "type": "u64" - } - ] - } - ], - "accounts": [ - { - "name": "ammConfig", - "discriminator": [ - 218, - 244, - 33, - 104, - 203, - 203, - 43, - 111 - ] - }, - { - "name": "observationState", - "discriminator": [ - 122, - 174, - 197, - 53, - 129, - 9, - 165, - 132 - ] - }, - { - "name": "poolState", - "discriminator": [ - 247, - 237, - 227, - 245, - 215, - 195, - 222, - 70 - ] - } - ], - "events": [ - { - "name": "LpChangeEvent", - "discriminator": [ - 121, - 163, - 205, - 201, - 57, - 218, - 117, - 60 - ] - }, - { - "name": "SwapEvent", - "discriminator": [ - 64, - 198, - 205, - 232, - 38, - 8, - 113, - 226 - ] - } - ], - "errors": [ - { - "code": 6000, - "name": "NotApproved", - "msg": "Not approved" - }, - { - "code": 6001, - "name": "InvalidOwner", - "msg": "Input account owner is not the program address" - }, - { - "code": 6002, - "name": "EmptySupply", - "msg": "Input token account empty" - }, - { - "code": 6003, - "name": "InvalidInput", - "msg": "InvalidInput" - }, - { - "code": 6004, - "name": "IncorrectLpMint", - "msg": "Address of the provided lp token mint is incorrect" - }, - { - "code": 6005, - "name": "ExceededSlippage", - "msg": "Exceeds desired slippage limit" - }, - { - "code": 6006, - "name": "ZeroTradingTokens", - "msg": "Given pool token amount results in zero trading tokens" - }, - { - "code": 6007, - "name": "NotSupportMint", - "msg": "Not support token_2022 mint extension" - }, - { - "code": 6008, - "name": "InvalidVault", - "msg": "invaild vault" - }, - { - "code": 6009, - "name": "InitLpAmountTooLess", - "msg": "Init lp amount is too less(Because 100 amount lp will be locked)" - } - ], + "metadata": {"name": "umbra_amm", "version": "0.1.0", "spec": "0.1.0", "description": "Created with Anchor"}, + "instructions": [], + "accounts": [{"name": "poolState", "discriminator": [247, 237, 227, 245, 215, 195, 222, 70]}], + "events": [], + "errors": [], "types": [ - { - "name": "ammConfig", - "docs": [ - "Holds the current owner of the factory" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "bump", - "docs": [ - "Bump to identify PDA" - ], - "type": "u8" - }, - { - "name": "disable_create_pool", - "docs": [ - "Status to control if new pool can be create" - ], - "type": "bool" - }, - { - "name": "index", - "docs": [ - "Config index" - ], - "type": "u16" - }, - { - "name": "trade_fee_rate", - "docs": [ - "The trade fee, denominated in hundredths of a bip (10^-6)" - ], - "type": "u64" - }, - { - "name": "protocol_fee_rate", - "docs": [ - "The protocol fee" - ], - "type": "u64" - }, - { - "name": "fund_fee_rate", - "docs": [ - "The fund fee, denominated in hundredths of a bip (10^-6)" - ], - "type": "u64" - }, - { - "name": "create_pool_fee", - "docs": [ - "Fee for create a new pool" - ], - "type": "u64" - }, - { - "name": "protocol_owner", - "docs": [ - "Address of the protocol fee owner" - ], - "type": "pubkey" - }, - { - "name": "fund_owner", - "docs": [ - "Address of the fund fee owner" - ], - "type": "pubkey" - }, - { - "name": "padding", - "docs": [ - "padding" - ], - "type": { - "array": [ - "u64", - 16 - ] - } - } - ] - } - }, - { - "name": "LpChangeEvent", - "docs": [ - "Emitted when deposit and withdraw" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_id", - "type": "pubkey" - }, - { - "name": "lp_amount_before", - "type": "u64" - }, - { - "name": "token_0_vault_before", - "docs": [ - "pool vault sub trade fees" - ], - "type": "u64" - }, - { - "name": "token_1_vault_before", - "docs": [ - "pool vault sub trade fees" - ], - "type": "u64" - }, - { - "name": "token_0_amount", - "docs": [ - "cacluate result without transfer fee" - ], - "type": "u64" - }, - { - "name": "token_1_amount", - "docs": [ - "cacluate result without transfer fee" - ], - "type": "u64" - }, - { - "name": "token_0_transfer_fee", - "type": "u64" - }, - { - "name": "token_1_transfer_fee", - "type": "u64" - }, - { - "name": "change_type", - "type": "u8" - }, - { - "name": "lp_change_amount", - "type": "u64" - }, - { - "name": "payer", - "type": "pubkey" - } - ] - } - }, - { - "name": "Observation", - "docs": [ - "The element of observations in ObservationState" - ], - "serialization": "bytemuckunsafe", - "repr": { - "kind": "rust", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "block_timestamp", - "docs": [ - "The block timestamp of the observation" - ], - "type": "u64" - }, - { - "name": "cumulative_token_0_price_x32", - "docs": [ - "the cumulative of token0 price during the duration time, Q32.32, the remaining 64 bit for overflow" - ], - "type": "u128" - }, - { - "name": "cumulative_token_1_price_x32", - "docs": [ - "the cumulative of token1 price during the duration time, Q32.32, the remaining 64 bit for overflow" - ], - "type": "u128" - } - ] - } - }, - { - "name": "observationState", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "rust", - "packed": true - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "initialized", - "docs": [ - "Whether the ObservationState is initialized" - ], - "type": "bool" - }, - { - "name": "observation_index", - "docs": [ - "the most-recently updated index of the observations array" - ], - "type": "u16" - }, - { - "name": "pool_id", - "type": "pubkey" - }, - { - "name": "observations", - "docs": [ - "observation array" - ], - "type": { - "array": [ - { - "defined": { - "name": "Observation" - } - }, - 100 - ] - } - }, - { - "name": "padding", - "docs": [ - "padding for feature update" - ], - "type": { - "array": [ - "u64", - 4 - ] - } - } - ] - } - }, { "name": "poolState", "serialization": "bytemuckunsafe", - "repr": { - "kind": "rust", - "packed": true - }, + "repr": {"kind": "rust", "packed": true}, "type": { "kind": "struct", "fields": [ - { - "name": "amm_config", - "docs": [ - "Which config the pool belongs" - ], - "type": "pubkey" - }, - { - "name": "pool_creator", - "docs": [ - "pool creator" - ], - "type": "pubkey" - }, - { - "name": "token_0_vault", - "docs": [ - "Token A" - ], - "type": "pubkey" - }, - { - "name": "token_1_vault", - "docs": [ - "Token B" - ], - "type": "pubkey" - }, + {"name": "amm_config", "docs": ["Which config the pool belongs"], "type": "pubkey"}, + {"name": "pool_creator", "docs": ["pool creator"], "type": "pubkey"}, + {"name": "token_0_vault", "docs": ["Token A"], "type": "pubkey"}, + {"name": "token_1_vault", "docs": ["Token B"], "type": "pubkey"}, { "name": "lp_mint", - "docs": [ - "Pool tokens are issued when A or B tokens are deposited.", - "Pool tokens can be withdrawn back to the original A or B token." - ], + "docs": ["Pool tokens are issued when A or B tokens are deposited.", "Pool tokens can be withdrawn back to the original A or B token."], "type": "pubkey" }, - { - "name": "token_0_mint", - "docs": [ - "Mint information for token A" - ], - "type": "pubkey" - }, - { - "name": "token_1_mint", - "docs": [ - "Mint information for token B" - ], - "type": "pubkey" - }, - { - "name": "token_0_program", - "docs": [ - "token_0 program" - ], - "type": "pubkey" - }, - { - "name": "token_1_program", - "docs": [ - "token_1 program" - ], - "type": "pubkey" - }, - { - "name": "observation_key", - "docs": [ - "observation account to store oracle data" - ], - "type": "pubkey" - }, - { - "name": "auth_bump", - "type": "u8" - }, + {"name": "token_0_mint", "docs": ["Mint information for token A"], "type": "pubkey"}, + {"name": "token_1_mint", "docs": ["Mint information for token B"], "type": "pubkey"}, + {"name": "token_0_program", "docs": ["token_0 program"], "type": "pubkey"}, + {"name": "token_1_program", "docs": ["token_1 program"], "type": "pubkey"}, + {"name": "observation_key", "docs": ["observation account to store oracle data"], "type": "pubkey"}, + {"name": "auth_bump", "type": "u8"}, { "name": "status", "docs": [ @@ -1986,140 +38,17 @@ ], "type": "u8" }, - { - "name": "lp_mint_decimals", - "type": "u8" - }, - { - "name": "mint_0_decimals", - "docs": [ - "mint0 and mint1 decimals" - ], - "type": "u8" - }, - { - "name": "mint_1_decimals", - "type": "u8" - }, - { - "name": "lp_supply", - "docs": [ - "True circulating supply without burns and lock ups" - ], - "type": "u64" - }, - { - "name": "protocol_fees_token_0", - "docs": [ - "The amounts of token_0 and token_1 that are owed to the liquidity provider." - ], - "type": "u64" - }, - { - "name": "protocol_fees_token_1", - "type": "u64" - }, - { - "name": "fund_fees_token_0", - "type": "u64" - }, - { - "name": "fund_fees_token_1", - "type": "u64" - }, - { - "name": "open_time", - "docs": [ - "The timestamp allowed for swap in the pool." - ], - "type": "u64" - }, - { - "name": "recent_epoch", - "docs": [ - "recent epoch" - ], - "type": "u64" - }, - { - "name": "padding", - "docs": [ - "padding for future updates" - ], - "type": { - "array": [ - "u64", - 31 - ] - } - } - ] - } - }, - { - "name": "SwapEvent", - "docs": [ - "Emitted when swap" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_id", - "type": "pubkey" - }, - { - "name": "input_vault_before", - "docs": [ - "pool vault sub trade fees" - ], - "type": "u64" - }, - { - "name": "output_vault_before", - "docs": [ - "pool vault sub trade fees" - ], - "type": "u64" - }, - { - "name": "input_amount", - "docs": [ - "cacluate result without transfer fee" - ], - "type": "u64" - }, - { - "name": "output_amount", - "docs": [ - "cacluate result without transfer fee" - ], - "type": "u64" - }, - { - "name": "input_transfer_fee", - "type": "u64" - }, - { - "name": "output_transfer_fee", - "type": "u64" - }, - { - "name": "base_input", - "type": "bool" - }, - { - "name": "input_token_id", - "type": "pubkey" - }, - { - "name": "output_token_id", - "type": "pubkey" - }, - { - "name": "payer", - "type": "pubkey" - } + {"name": "lp_mint_decimals", "type": "u8"}, + {"name": "mint_0_decimals", "docs": ["mint0 and mint1 decimals"], "type": "u8"}, + {"name": "mint_1_decimals", "type": "u8"}, + {"name": "lp_supply", "docs": ["True circulating supply without burns and lock ups"], "type": "u64"}, + {"name": "protocol_fees_token_0", "docs": ["The amounts of token_0 and token_1 that are owed to the liquidity provider."], "type": "u64"}, + {"name": "protocol_fees_token_1", "type": "u64"}, + {"name": "fund_fees_token_0", "type": "u64"}, + {"name": "fund_fees_token_1", "type": "u64"}, + {"name": "open_time", "docs": ["The timestamp allowed for swap in the pool."], "type": "u64"}, + {"name": "recent_epoch", "docs": ["recent epoch"], "type": "u64"}, + {"name": "padding", "docs": ["padding for future updates"], "type": {"array": ["u64", 31]}} ] } } diff --git a/projects/vectis/voltr-idl.js b/projects/vectis/voltr-idl.js index 7d8b29846..887f87bb4 100644 --- a/projects/vectis/voltr-idl.js +++ b/projects/vectis/voltr-idl.js @@ -1,5982 +1,150 @@ -module.exports = { - "address": "vVoLTRjQmtFpiYoegx285Ze4gsLJ8ZxgFKVcuvmG1a8", - "metadata": { - "name": "voltr_vault", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" +module.exports ={ + "address": "vVoLTRjQmtFpiYoegx285Ze4gsLJ8ZxgFKVcuvmG1a8", + "metadata": {"name": "voltr_vault", "version": "0.1.0", "spec": "0.1.0", "description": "Created with Anchor"}, + "instructions": [], + "accounts": [{"name": "Vault", "discriminator": [211, 8, 232, 43, 2, 152, 117, 119]}], + "events": [], + "errors": [], + "types": [ + { + "name": "Vault", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "name", "docs": ["The vault's name."], "type": {"array": ["u8", 32]}}, + {"name": "description", "docs": ["A description or summary for this vault."], "type": {"array": ["u8", 64]}}, + {"name": "asset", "docs": ["The vault’s main asset configuration (inline nested struct)."], "type": {"defined": {"name": "VaultAsset"}}}, + {"name": "lp", "docs": ["The vault’s LP (share) configuration (inline nested struct)."], "type": {"defined": {"name": "VaultLp"}}}, + {"name": "manager", "docs": ["The manager of this vault (has certain permissions)."], "type": "pubkey"}, + {"name": "admin", "docs": ["The admin of this vault (broader or fallback permissions)."], "type": "pubkey"}, + { + "name": "vault_configuration", + "docs": ["The vault fee, cap, and locked profit degradation duration configuration (inline nested struct)."], + "type": {"defined": {"name": "VaultConfiguration"}} + }, + { + "name": "fee_configuration", + "docs": ["The vault fee and cap configuration (inline nested struct)."], + "type": {"defined": {"name": "FeeConfiguration"}} + }, + {"name": "fee_update", "docs": ["The fee update state of the vault."], "type": {"defined": {"name": "FeeUpdate"}}}, + {"name": "fee_state", "docs": ["The fee state of the vault."], "type": {"defined": {"name": "FeeState"}}}, + {"name": "high_water_mark", "type": {"defined": {"name": "HighWaterMark"}}}, + {"name": "last_updated_ts", "docs": ["The last time (Unix timestamp) this vault data was updated."], "type": "u64"}, + {"name": "version", "docs": ["The version of the vault."], "type": "u8"}, + {"name": "_padding0", "docs": ["padding to align future 8-byte fields on 8-byte boundaries."], "type": {"array": ["u8", 7]}}, + {"name": "locked_profit_state", "docs": ["The locked profit state of the vault."], "type": {"defined": {"name": "LockedProfitState"}}}, + {"name": "reserved", "docs": ["Reserved bytes for future use."], "type": {"array": ["u8", 240]}} + ] + } }, - "instructions": [ - { - "name": "add_adaptor", - "discriminator": [ - 161, - 145, - 203, - 248, - 211, - 202, - 203, - 67 - ], - "accounts": [ - { - "name": "payer", - "writable": true, - "signer": true - }, - { - "name": "admin", - "signer": true, - "relations": [ - "vault" - ] - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "adaptor_add_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 97, - 100, - 97, - 112, - 116, - 111, - 114, - 95, - 97, - 100, - 100, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "adaptor_program" - } - ] - } - }, - { - "name": "adaptor_program" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [] - }, - { - "name": "cancel_request_withdraw_vault", - "discriminator": [ - 231, - 54, - 14, - 6, - 223, - 124, - 127, - 238 - ], - "accounts": [ - { - "name": "user_transfer_authority", - "docs": [ - "The authority that owns the LP tokens and wants to redeem them" - ], - "writable": true, - "signer": true - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "vault_lp_mint", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "user_lp_ata", - "docs": [ - "The user's LP token account from which LP tokens will be burned." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "user_transfer_authority" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "request_withdraw_lp_ata", - "docs": [ - "The request's associated token account for LP." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "request_withdraw_vault_receipt" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "request_withdraw_vault_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 114, - 101, - 113, - 117, - 101, - 115, - 116, - 95, - 119, - 105, - 116, - 104, - 100, - 114, - 97, - 119, - 95, - 118, - 97, - 117, - 108, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "user_transfer_authority" - } - ] - } - }, - { - "name": "lp_token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [] - }, - { - "name": "close_strategy", - "discriminator": [ - 56, - 247, - 170, - 246, - 89, - 221, - 134, - 200 - ], - "accounts": [ - { - "name": "payer", - "writable": true, - "signer": true - }, - { - "name": "manager", - "signer": true - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault" - }, - { - "name": "strategy" - }, - { - "name": "strategy_init_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 105, - 110, - 105, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [] - }, - { - "name": "create_lp_metadata", - "discriminator": [ - 148, - 193, - 160, - 116, - 87, - 25, - 123, - 103 - ], - "accounts": [ - { - "name": "payer", - "writable": true, - "signer": true - }, - { - "name": "admin", - "signer": true, - "relations": [ - "vault" - ] - }, - { - "name": "vault" - }, - { - "name": "vault_lp_mint", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "vault_lp_mint_auth", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "metadata_account", - "writable": true - }, - { - "name": "metadata_program", - "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" - }, - { - "name": "rent", - "address": "SysvarRent111111111111111111111111111111111" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "name", - "type": "string" - }, - { - "name": "symbol", - "type": "string" - }, - { - "name": "uri", - "type": "string" - } - ] - }, - { - "name": "deposit_strategy", - "discriminator": [ - 246, - 82, - 57, - 226, - 131, - 222, - 253, - 249 - ], - "accounts": [ - { - "name": "manager", - "signer": true - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "strategy" - }, - { - "name": "adaptor_add_receipt", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 97, - 100, - 97, - 112, - 116, - 111, - 114, - 95, - 97, - 100, - 100, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "adaptor_program" - } - ] - } - }, - { - "name": "strategy_init_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 105, - 110, - 105, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "vault_asset_idle_auth", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 115, - 115, - 101, - 116, - 95, - 105, - 100, - 108, - 101, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "vault_strategy_auth", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "vault_asset_mint", - "writable": true - }, - { - "name": "vault_lp_mint", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "vault_asset_idle_ata", - "docs": [ - "The vault's associated token account for asset." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "vault_asset_idle_auth" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_strategy_asset_ata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "vault_strategy_auth" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "asset_token_program" - }, - { - "name": "adaptor_program" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "instruction_discriminator", - "type": { - "option": "bytes" - } - }, - { - "name": "additional_args", - "type": { - "option": "bytes" - } - } - ] - }, - { - "name": "deposit_vault", - "discriminator": [ - 126, - 224, - 21, - 255, - 228, - 53, - 117, - 33 - ], - "accounts": [ - { - "name": "user_transfer_authority", - "signer": true - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "vault_asset_mint" - }, - { - "name": "vault_lp_mint", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "user_asset_ata", - "docs": [ - "The user's asset ATA from which they are depositing tokens." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "user_transfer_authority" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_asset_idle_ata", - "docs": [ - "The vault's associated token account for asset." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "vault_asset_idle_auth" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_asset_idle_auth", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 115, - 115, - 101, - 116, - 95, - 105, - 100, - 108, - 101, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "user_lp_ata", - "docs": [ - "The user's LP ATA where we will mint LP tokens." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "user_transfer_authority" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_lp_mint_auth", - "docs": [ - "The PDA authority used to sign mint instructions for LP tokens." - ], - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "asset_token_program" - }, - { - "name": "lp_token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - } - ] - }, - { - "name": "direct_withdraw_strategy", - "discriminator": [ - 119, - 33, - 54, - 52, - 194, - 8, - 211, - 239 - ], - "accounts": [ - { - "name": "user_transfer_authority", - "docs": [ - "The authority that owns the LP tokens and wants to redeem them" - ], - "writable": true, - "signer": true - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "adaptor_add_receipt", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 97, - 100, - 97, - 112, - 116, - 111, - 114, - 95, - 97, - 100, - 100, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "adaptor_program" - } - ] - } - }, - { - "name": "strategy_init_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 105, - 110, - 105, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "direct_withdraw_init_receipt", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 100, - 105, - 114, - 101, - 99, - 116, - 95, - 119, - 105, - 116, - 104, - 100, - 114, - 97, - 119, - 95, - 105, - 110, - 105, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "strategy" - }, - { - "name": "vault_asset_mint", - "writable": true - }, - { - "name": "vault_lp_mint", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "request_withdraw_lp_ata", - "docs": [ - "The request's LP token account from which LP tokens will be burned." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "request_withdraw_vault_receipt" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_strategy_auth", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "user_asset_ata", - "docs": [ - "The user's asset ATA to which asset tokens will be sent." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "user_transfer_authority" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_strategy_asset_ata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "vault_strategy_auth" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "request_withdraw_vault_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 114, - 101, - 113, - 117, - 101, - 115, - 116, - 95, - 119, - 105, - 116, - 104, - 100, - 114, - 97, - 119, - 95, - 118, - 97, - 117, - 108, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "user_transfer_authority" - } - ] - } - }, - { - "name": "adaptor_program" - }, - { - "name": "asset_token_program" - }, - { - "name": "lp_token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "user_args", - "type": { - "option": "bytes" - } - } - ] - }, - { - "name": "harvest_fee", - "discriminator": [ - 32, - 59, - 42, - 128, - 246, - 73, - 255, - 47 - ], - "accounts": [ - { - "name": "harvester", - "signer": true - }, - { - "name": "vault_manager" - }, - { - "name": "vault_admin" - }, - { - "name": "protocol_admin" - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "vault_lp_mint", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "vault_lp_mint_auth", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "vault_manager_lp_ata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "vault_manager" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_admin_lp_ata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "vault_admin" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "protocol_admin_lp_ata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "protocol_admin" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "lp_token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - } - ], - "args": [] - }, - { - "name": "init_or_update_protocol", - "discriminator": [ - 149, - 56, - 57, - 46, - 105, - 182, - 61, - 208 - ], - "accounts": [ - { - "name": "payer", - "writable": true, - "signer": true - }, - { - "name": "current_admin", - "signer": true - }, - { - "name": "new_admin" - }, - { - "name": "protocol", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "operational_state", - "type": "u16" - }, - { - "name": "fee", - "type": "u16" - } - ] - }, - { - "name": "initialize_direct_withdraw_strategy", - "discriminator": [ - 248, - 207, - 228, - 15, - 13, - 191, - 43, - 58 - ], - "accounts": [ - { - "name": "payer", - "writable": true, - "signer": true - }, - { - "name": "admin", - "signer": true, - "relations": [ - "vault" - ] - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "strategy" - }, - { - "name": "strategy_init_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 105, - 110, - 105, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "adaptor_add_receipt", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 97, - 100, - 97, - 112, - 116, - 111, - 114, - 95, - 97, - 100, - 100, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "adaptor_program" - } - ] - } - }, - { - "name": "direct_withdraw_init_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 100, - 105, - 114, - 101, - 99, - 116, - 95, - 119, - 105, - 116, - 104, - 100, - 114, - 97, - 119, - 95, - 105, - 110, - 105, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "adaptor_program" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "instruction_discriminator", - "type": { - "option": "bytes" - } - }, - { - "name": "additional_args", - "type": { - "option": "bytes" - } - }, - { - "name": "allow_user_args", - "type": "bool" - } - ] - }, - { - "name": "initialize_strategy", - "discriminator": [ - 208, - 119, - 144, - 145, - 178, - 57, - 105, - 252 - ], - "accounts": [ - { - "name": "payer", - "writable": true, - "signer": true - }, - { - "name": "manager", - "signer": true - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault" - }, - { - "name": "strategy" - }, - { - "name": "adaptor_add_receipt", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 97, - 100, - 97, - 112, - 116, - 111, - 114, - 95, - 97, - 100, - 100, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "adaptor_program" - } - ] - } - }, - { - "name": "strategy_init_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 105, - 110, - 105, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "vault_strategy_auth", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "adaptor_program" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "instruction_discriminator", - "type": { - "option": "bytes" - } - }, - { - "name": "additional_args", - "type": { - "option": "bytes" - } - } - ] - }, - { - "name": "initialize_vault", - "discriminator": [ - 48, - 191, - 163, - 44, - 71, - 129, - 63, - 164 - ], - "accounts": [ - { - "name": "payer", - "writable": true, - "signer": true - }, - { - "name": "manager" - }, - { - "name": "admin" - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true, - "signer": true - }, - { - "name": "vault_lp_mint", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "vault_asset_mint" - }, - { - "name": "vault_asset_idle_ata", - "writable": true - }, - { - "name": "vault_lp_mint_auth", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "vault_asset_idle_auth", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 115, - 115, - 101, - 116, - 95, - 105, - 100, - 108, - 101, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "clock", - "address": "SysvarC1ock11111111111111111111111111111111" - }, - { - "name": "rent", - "address": "SysvarRent111111111111111111111111111111111" - }, - { - "name": "associated_token_program", - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "asset_token_program" - }, - { - "name": "lp_token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "config", - "type": { - "defined": { - "name": "VaultInitializationInput" - } - } - }, - { - "name": "name", - "type": "string" - }, - { - "name": "description", - "type": "string" - } - ] - }, - { - "name": "remove_adaptor", - "discriminator": [ - 161, - 199, - 99, - 22, - 25, - 193, - 61, - 193 - ], - "accounts": [ - { - "name": "admin", - "writable": true, - "signer": true, - "relations": [ - "vault" - ] - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "adaptor_add_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 97, - 100, - 97, - 112, - 116, - 111, - 114, - 95, - 97, - 100, - 100, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "adaptor_program" - } - ] - } - }, - { - "name": "adaptor_program" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [] - }, - { - "name": "request_withdraw_vault", - "discriminator": [ - 248, - 225, - 47, - 22, - 116, - 144, - 23, - 143 - ], - "accounts": [ - { - "name": "payer", - "docs": [ - "The payer of the request" - ], - "writable": true, - "signer": true - }, - { - "name": "user_transfer_authority", - "docs": [ - "The authority that owns the LP tokens and wants to redeem them" - ], - "signer": true - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault" - }, - { - "name": "vault_lp_mint", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "user_lp_ata", - "docs": [ - "The user's LP token account from which LP tokens will be burned." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "user_transfer_authority" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "request_withdraw_lp_ata", - "docs": [ - "The request's associated token account for LP." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "request_withdraw_vault_receipt" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "request_withdraw_vault_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 114, - 101, - 113, - 117, - 101, - 115, - 116, - 95, - 119, - 105, - 116, - 104, - 100, - 114, - 97, - 119, - 95, - 118, - 97, - 117, - 108, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "user_transfer_authority" - } - ] - } - }, - { - "name": "lp_token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "is_amount_in_lp", - "type": "bool" - }, - { - "name": "is_withdraw_all", - "type": "bool" - } - ] - }, - { - "name": "update_vault", - "discriminator": [ - 67, - 229, - 185, - 188, - 226, - 11, - 210, - 60 - ], - "accounts": [ - { - "name": "admin", - "signer": true, - "relations": [ - "vault" - ] - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "rent", - "address": "SysvarRent111111111111111111111111111111111" - } - ], - "args": [ - { - "name": "config", - "type": { - "defined": { - "name": "VaultInitializationInput" - } - } - } - ] - }, - { - "name": "withdraw_strategy", - "discriminator": [ - 31, - 45, - 162, - 5, - 193, - 217, - 134, - 188 - ], - "accounts": [ - { - "name": "manager", - "signer": true - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "adaptor_add_receipt", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 97, - 100, - 97, - 112, - 116, - 111, - 114, - 95, - 97, - 100, - 100, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "adaptor_program" - } - ] - } - }, - { - "name": "strategy_init_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 105, - 110, - 105, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "strategy" - }, - { - "name": "adaptor_program" - }, - { - "name": "vault_asset_idle_auth", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 115, - 115, - 101, - 116, - 95, - 105, - 100, - 108, - 101, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "vault_strategy_auth", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 115, - 116, - 114, - 97, - 116, - 101, - 103, - 121, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "strategy" - } - ] - } - }, - { - "name": "vault_asset_mint", - "writable": true - }, - { - "name": "vault_lp_mint", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "vault_asset_idle_ata", - "docs": [ - "The vault's associated token account for asset." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "vault_asset_idle_auth" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_strategy_asset_ata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "vault_strategy_auth" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "asset_token_program" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "instruction_discriminator", - "type": { - "option": "bytes" - } - }, - { - "name": "additional_args", - "type": { - "option": "bytes" - } - } - ] - }, - { - "name": "withdraw_vault", - "discriminator": [ - 135, - 7, - 237, - 120, - 149, - 94, - 95, - 7 - ], - "accounts": [ - { - "name": "user_transfer_authority", - "docs": [ - "The authority that owns the LP tokens and wants to redeem them" - ], - "writable": true, - "signer": true - }, - { - "name": "protocol", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, - 114, - 111, - 116, - 111, - 99, - 111, - 108 - ] - } - ] - } - }, - { - "name": "vault", - "writable": true - }, - { - "name": "vault_asset_mint" - }, - { - "name": "vault_lp_mint", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "request_withdraw_lp_ata", - "docs": [ - "The request's LP token account from which LP tokens will be burned." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "request_withdraw_vault_receipt" - }, - { - "kind": "account", - "path": "lp_token_program" - }, - { - "kind": "account", - "path": "vault_lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_asset_idle_ata", - "docs": [ - "The vault's associated token account for asset." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "vault_asset_idle_auth" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "vault_asset_idle_auth", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 118, - 97, - 117, - 108, - 116, - 95, - 97, - 115, - 115, - 101, - 116, - 95, - 105, - 100, - 108, - 101, - 95, - 97, - 117, - 116, - 104 - ] - }, - { - "kind": "account", - "path": "vault" - } - ] - } - }, - { - "name": "user_asset_ata", - "docs": [ - "The user's asset ATA to which asset tokens will be sent." - ], - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "user_transfer_authority" - }, - { - "kind": "account", - "path": "asset_token_program" - }, - { - "kind": "account", - "path": "vault_asset_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 - ] - } - } - }, - { - "name": "request_withdraw_vault_receipt", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 114, - 101, - 113, - 117, - 101, - 115, - 116, - 95, - 119, - 105, - 116, - 104, - 100, - 114, - 97, - 119, - 95, - 118, - 97, - 117, - 108, - 116, - 95, - 114, - 101, - 99, - 101, - 105, - 112, - 116 - ] - }, - { - "kind": "account", - "path": "vault" - }, - { - "kind": "account", - "path": "user_transfer_authority" - } - ] - } - }, - { - "name": "asset_token_program" - }, - { - "name": "lp_token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [] - } - ], - "accounts": [ - { - "name": "AdaptorAddReceipt", - "discriminator": [ - 105, - 99, - 219, - 155, - 77, - 241, - 7, - 119 - ] - }, - { - "name": "DirectWithdrawInitReceipt", - "discriminator": [ - 206, - 77, - 207, - 208, - 25, - 244, - 81, - 172 - ] - }, - { - "name": "Protocol", - "discriminator": [ - 45, - 39, - 101, - 43, - 115, - 72, - 131, - 40 - ] - }, - { - "name": "RequestWithdrawVaultReceipt", - "discriminator": [ - 203, - 81, - 223, - 141, - 175, - 108, - 101, - 114 - ] - }, - { - "name": "StrategyInitReceipt", - "discriminator": [ - 51, - 8, - 192, - 253, - 115, - 78, - 112, - 214 - ] - }, - { - "name": "Vault", - "discriminator": [ - 211, - 8, - 232, - 43, - 2, - 152, - 117, - 119 + { + "name": "VaultAsset", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "mint", "docs": ["The mint for the vault’s main asset."], "type": "pubkey"}, + {"name": "idle_ata", "docs": ["The “idle” token account holding un-invested assets."], "type": "pubkey"}, + {"name": "total_value", "docs": ["The total amount of this asset currently in the vault."], "type": "u64"}, + {"name": "idle_ata_auth_bump", "docs": ["The bump for the vault asset mint."], "type": "u8"}, + {"name": "reserved", "docs": ["Reserved bytes for future use."], "type": {"array": ["u8", 95]}} ] } - ], - "events": [ - { - "name": "AddAdaptorEvent", - "discriminator": [ - 24, - 181, - 201, - 148, - 240, - 183, - 235, - 12 - ] - }, - { - "name": "CancelRequestWithdrawVaultEvent", - "discriminator": [ - 46, - 165, - 24, - 114, - 1, - 80, - 205, - 136 - ] - }, - { - "name": "CloseStrategyEvent", - "discriminator": [ - 213, - 95, - 219, - 161, - 17, - 208, - 93, - 255 - ] - }, - { - "name": "DepositStrategyEvent", - "discriminator": [ - 202, - 201, - 118, - 49, - 29, - 180, - 116, - 170 - ] - }, - { - "name": "DepositVaultEvent", - "discriminator": [ - 11, - 15, - 7, - 92, - 150, - 100, - 165, - 232 - ] - }, - { - "name": "DirectWithdrawStrategyEvent", - "discriminator": [ - 113, - 202, - 151, - 124, - 137, - 255, - 153, - 101 - ] - }, - { - "name": "HarvestFeeEvent", - "discriminator": [ - 69, - 48, - 192, - 23, - 232, - 22, - 23, - 30 - ] - }, - { - "name": "InitProtocolEvent", - "discriminator": [ - 13, - 81, - 183, - 132, - 88, - 43, - 202, - 213 - ] - }, - { - "name": "InitializeDirectWithdrawStrategyEvent", - "discriminator": [ - 169, - 22, - 57, - 8, - 15, - 73, - 255, - 115 - ] - }, - { - "name": "InitializeStrategyEvent", - "discriminator": [ - 30, - 233, - 211, - 249, - 83, - 188, - 234, - 152 - ] - }, - { - "name": "InitializeVaultEvent", - "discriminator": [ - 179, - 75, - 50, - 161, - 191, - 28, - 245, - 107 - ] - }, - { - "name": "RemoveAdaptorEvent", - "discriminator": [ - 155, - 178, - 2, - 29, - 245, - 86, - 246, - 153 - ] - }, - { - "name": "RequestWithdrawVaultEvent", - "discriminator": [ - 59, - 94, - 26, - 38, - 47, - 131, - 158, - 162 - ] - }, - { - "name": "UpdateProtocolEvent", - "discriminator": [ - 14, - 227, - 204, - 217, - 62, - 46, - 241, - 237 - ] - }, - { - "name": "UpdateVaultEvent", - "discriminator": [ - 123, - 31, - 27, - 189, - 102, - 1, - 121, - 57 - ] - }, - { - "name": "WithdrawStrategyEvent", - "discriminator": [ - 112, - 45, - 16, - 172, - 170, - 33, - 22, - 212 - ] - }, - { - "name": "WithdrawVaultEvent", - "discriminator": [ - 196, - 123, - 79, - 215, - 4, - 214, - 20, - 197 + }, + { + "name": "VaultLp", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "mint", "docs": ["The LP mint (e.g., representing shares in this vault)."], "type": "pubkey"}, + {"name": "mint_bump", "docs": ["The bump for the vault LP mint."], "type": "u8"}, + {"name": "mint_auth_bump", "docs": ["The bump for the vault LP mint authority."], "type": "u8"}, + {"name": "reserved", "docs": ["Reserved bytes for future use."], "type": {"array": ["u8", 62]}} ] } - ], - "errors": [ - { - "code": 6000, - "name": "InvalidAmount", - "msg": "Invalid amount provided." - }, - { - "code": 6001, - "name": "InvalidTokenMint", - "msg": "Invalid token mint." - }, - { - "code": 6002, - "name": "InvalidTokenAccount", - "msg": "Invalid token account." - }, - { - "code": 6003, - "name": "InvalidAccountInput", - "msg": "Invalid account input." - }, - { - "code": 6004, - "name": "MathOverflow", - "msg": "Math overflow." - }, - { - "code": 6005, - "name": "FeeExceedsTotalAssetValue", - "msg": "Fee exceeds total asset value." - }, - { - "code": 6006, - "name": "MaxCapExceeded", - "msg": "Max cap exceeded." - }, - { - "code": 6007, - "name": "VaultNotActive", - "msg": "Vault not active." - }, - { - "code": 6008, - "name": "ManagerNotAllowed", - "msg": "Manager not allowed in remaining." - }, - { - "code": 6009, - "name": "OperationNotAllowed", - "msg": "Operation not allowed." - }, - { - "code": 6010, - "name": "AdaptorEpochInvalid", - "msg": "Adaptor epoch invalid." - }, - { - "code": 6011, - "name": "InvalidFeeConfiguration", - "msg": "Fee configuration invalid." - }, - { - "code": 6012, - "name": "WithdrawalNotYetAvailable", - "msg": "Withdrawal not yet available." - }, - { - "code": 6013, - "name": "InvalidInput", - "msg": "Invalid input." + }, + { + "name": "VaultConfiguration", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "max_cap", "docs": ["The maximum total amount allowed in the vault."], "type": "u64"}, + {"name": "start_at_ts", "docs": ["active from timestamp"], "type": "u64"}, + {"name": "locked_profit_degradation_duration", "docs": ["The locked profit degradation duration."], "type": "u64"}, + {"name": "withdrawal_waiting_period", "docs": ["The waiting period for a withdrawal. prec: seconds"], "type": "u64"}, + {"name": "reserved", "docs": ["Reserved bytes for future use."], "type": {"array": ["u8", 48]}} + ] } - ], - "types": [ - { - "name": "AdaptorAddReceipt", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "docs": [ - "The vault associated with this strategy." - ], - "type": "pubkey" - }, - { - "name": "adaptor_program", - "docs": [ - "The adapter program address." - ], - "type": "pubkey" - }, - { - "name": "version", - "docs": [ - "A version number (1 byte)." - ], - "type": "u8" - }, - { - "name": "bump", - "docs": [ - "The bump for the adaptor add receipt." - ], - "type": "u8" - }, - { - "name": "_padding0", - "docs": [ - "7 bytes of padding to align future 8-byte fields on 8-byte boundaries." - ], - "type": { - "array": [ - "u8", - 7 - ] - } - }, - { - "name": "last_updated_epoch", - "docs": [ - "The epoch at which the strategy was last updated." - ], - "type": "u64" - }, - { - "name": "_reserved", - "docs": [ - "Reserved space for future fields" - ], - "type": { - "array": [ - "u8", - 56 - ] - } - } - ] - } - }, - { - "name": "AddAdaptorEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "adaptor_program", - "type": "pubkey" - }, - { - "name": "adaptor_add_receipt", - "type": "pubkey" - } - ] - } - }, - { - "name": "CancelRequestWithdrawVaultEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "request_withdraw_vault_receipt", - "type": "pubkey" - }, - { - "name": "amount_lp_refunded", - "type": "u64" - }, - { - "name": "amount_lp_burned", - "type": "u64" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_before", - "type": "u128" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_after", - "type": "u128" - } - ] - } - }, - { - "name": "CloseStrategyEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "strategy", - "type": "pubkey" - }, - { - "name": "strategy_init_receipt", - "type": "pubkey" - } - ] - } - }, - { - "name": "DepositStrategyEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "strategy", - "type": "pubkey" - }, - { - "name": "strategy_init_receipt", - "type": "pubkey" - }, - { - "name": "adaptor_program", - "type": "pubkey" - }, - { - "name": "vault_asset_total_value_before", - "type": "u64" - }, - { - "name": "vault_asset_total_value_after", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_before", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_after", - "type": "u64" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_before", - "type": "u128" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_after", - "type": "u128" - }, - { - "name": "vault_asset_idle_ata_amount_before", - "type": "u64" - }, - { - "name": "vault_asset_idle_ata_amount_after", - "type": "u64" - }, - { - "name": "strategy_position_value_before", - "type": "u64" - }, - { - "name": "strategy_position_value_after", - "type": "u64" - } - ] - } - }, - { - "name": "DepositVaultEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "vault_asset_total_value_before", - "type": "u64" - }, - { - "name": "vault_asset_total_value_after", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_before", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_after", - "type": "u64" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_before", - "type": "u128" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_after", - "type": "u128" - }, - { - "name": "vault_last_updated_ts", - "type": "u64" - } - ] - } - }, - { - "name": "DirectWithdrawInitReceipt", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "docs": [ - "The vault associated with this strategy." - ], - "type": "pubkey" - }, - { - "name": "strategy", - "docs": [ - "The strategy address." - ], - "type": "pubkey" - }, - { - "name": "adaptor_program", - "docs": [ - "The position value." - ], - "type": "pubkey" - }, - { - "name": "instruction_discriminator", - "docs": [ - "The instruction discriminator." - ], - "type": "bytes" - }, - { - "name": "additional_args", - "docs": [ - "The additional arguments." - ], - "type": { - "option": "bytes" - } - }, - { - "name": "allow_user_args", - "docs": [ - "Whether the user args are allowed." - ], - "type": "bool" - }, - { - "name": "version", - "docs": [ - "A version number (1 byte)." - ], - "type": "u8" - }, - { - "name": "bump", - "docs": [ - "The bump for the strategy init receipt." - ], - "type": "u8" - } - ] - } - }, - { - "name": "DirectWithdrawStrategyEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "strategy", - "type": "pubkey" - }, - { - "name": "strategy_init_receipt", - "type": "pubkey" - }, - { - "name": "direct_withdraw_init_receipt", - "type": "pubkey" - }, - { - "name": "adaptor_program", - "type": "pubkey" - }, - { - "name": "vault_asset_total_value_before", - "type": "u64" - }, - { - "name": "vault_asset_total_value_after", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_before", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_after", - "type": "u64" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_before", - "type": "u128" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_after", - "type": "u128" - }, - { - "name": "strategy_position_value_before", - "type": "u64" - }, - { - "name": "strategy_position_value_after", - "type": "u64" - } - ] - } - }, - { - "name": "FeeConfiguration", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "manager_performance_fee", - "docs": [ - "Manager performance fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "admin_performance_fee", - "docs": [ - "Admin performance fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "manager_management_fee", - "docs": [ - "Manager management fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "admin_management_fee", - "docs": [ - "Admin management fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "redemption_fee", - "docs": [ - "The redemption fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "issuance_fee", - "docs": [ - "The issuance fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "reserved", - "docs": [ - "Reserved bytes for future use." - ], - "type": { - "array": [ - "u8", - 36 - ] - } - } - ] - } - }, - { - "name": "FeeState", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "accumulated_lp_manager_fees", - "docs": [ - "The accumulated manager fees in the vault." - ], - "type": "u64" - }, - { - "name": "accumulated_lp_admin_fees", - "docs": [ - "The accumulated admin fees in the vault." - ], - "type": "u64" - }, - { - "name": "accumulated_lp_protocol_fees", - "docs": [ - "The accumulated protocol fees in the vault." - ], - "type": "u64" - }, - { - "name": "reserved", - "docs": [ - "Reserved bytes for future use." - ], - "type": { - "array": [ - "u8", - 24 - ] - } - } - ] - } - }, - { - "name": "FeeUpdate", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "last_performance_fee_update_ts", - "docs": [ - "The timestamp when the performance fees were last updated." - ], - "type": "u64" - }, - { - "name": "last_management_fee_update_ts", - "docs": [ - "The timestamp when the management fees were last updated." - ], - "type": "u64" - } - ] - } - }, - { - "name": "HarvestFeeEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "protocol", - "type": "pubkey" - }, - { - "name": "admin", - "type": "pubkey" - }, - { - "name": "manager", - "type": "pubkey" - }, - { - "name": "amount_lp_admin_fees", - "type": "u64" - }, - { - "name": "amount_lp_manager_fees", - "type": "u64" - }, - { - "name": "amount_lp_protocol_fees", - "type": "u64" - } - ] - } - }, - { - "name": "HighWaterMark", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "highest_asset_per_lp_decimal_bits", - "docs": [ - "The highest recorded total asset value per share" - ], - "type": "u128" - }, - { - "name": "last_updated_ts", - "docs": [ - "The timestamp when the high water mark was last updated" - ], - "type": "u64" - }, - { - "name": "reserved", - "docs": [ - "Reserved for future use" - ], - "type": { - "array": [ - "u8", - 8 - ] - } - } - ] - } - }, - { - "name": "InitProtocolEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "admin", - "type": "pubkey" - }, - { - "name": "operational_state", - "type": "u16" - }, - { - "name": "fee", - "type": "u16" - } - ] - } - }, - { - "name": "InitializeDirectWithdrawStrategyEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "strategy", - "type": "pubkey" - }, - { - "name": "strategy_init_receipt", - "type": "pubkey" - }, - { - "name": "adaptor_program", - "type": "pubkey" - }, - { - "name": "instruction_discriminator", - "type": "bytes" - }, - { - "name": "additional_args", - "type": "bytes" - }, - { - "name": "allow_user_args", - "type": "bool" - } - ] - } - }, - { - "name": "InitializeStrategyEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "strategy", - "type": "pubkey" - }, - { - "name": "strategy_init_receipt", - "type": "pubkey" - }, - { - "name": "adaptor_program", - "type": "pubkey" - } - ] - } - }, - { - "name": "InitializeVaultEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "vault_name", - "type": "string" - }, - { - "name": "vault_description", - "type": "string" - }, - { - "name": "vault_asset_mint", - "type": "pubkey" - }, - { - "name": "vault_asset_idle_ata", - "type": "pubkey" - }, - { - "name": "vault_lp_mint", - "type": "pubkey" - }, - { - "name": "vault_manager", - "type": "pubkey" - }, - { - "name": "vault_admin", - "type": "pubkey" - }, - { - "name": "vault_config_max_cap", - "type": "u64" - }, - { - "name": "vault_config_start_at_ts", - "type": "u64" - }, - { - "name": "vault_config_locked_profit_degradation_duration", - "type": "u64" - }, - { - "name": "vault_config_withdrawal_waiting_period", - "type": "u64" - }, - { - "name": "vault_config_manager_performance_fee", - "type": "u16" - }, - { - "name": "vault_config_admin_performance_fee", - "type": "u16" - }, - { - "name": "vault_config_manager_management_fee", - "type": "u16" - }, - { - "name": "vault_config_admin_management_fee", - "type": "u16" - }, - { - "name": "vault_config_redemption_fee", - "type": "u16" - }, - { - "name": "vault_config_issuance_fee", - "type": "u16" - }, - { - "name": "vault_last_updated_ts", - "type": "u64" - } - ] - } - }, - { - "name": "LockedProfitState", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "last_updated_locked_profit", - "type": "u64" - }, - { - "name": "last_report", - "type": "u64" - } - ] - } - }, - { - "name": "Protocol", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "admin", - "docs": [ - "The admin of the protocol." - ], - "type": "pubkey" - }, - { - "name": "operational_state", - "docs": [ - "The operational state of the protocol." - ], - "type": "u16" - }, - { - "name": "fee", - "docs": [ - "The fee for the protocol." - ], - "type": "u16" - }, - { - "name": "bump", - "docs": [ - "The bump for the protocol." - ], - "type": "u8" - }, - { - "name": "_padding0", - "docs": [ - "1 byte of padding to align future 8-byte fields on 8-byte boundaries." - ], - "type": { - "array": [ - "u8", - 1 - ] - } - }, - { - "name": "_reserved", - "docs": [ - "Reserved space for future fields" - ], - "type": { - "array": [ - "u8", - 64 - ] - } - } - ] - } - }, - { - "name": "RemoveAdaptorEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "adaptor_program", - "type": "pubkey" - }, - { - "name": "adaptor_add_receipt", - "type": "pubkey" - } - ] - } - }, - { - "name": "RequestWithdrawVaultEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "request_withdraw_vault_receipt", - "type": "pubkey" - }, - { - "name": "amount_lp_escrowed", - "type": "u64" - }, - { - "name": "amount_asset_to_withdraw_decimal_bits", - "type": "u128" - }, - { - "name": "withdrawable_from_ts", - "type": "u64" - } - ] - } - }, - { - "name": "RequestWithdrawVaultReceipt", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "amount_lp_escrowed", - "type": "u64" - }, - { - "name": "amount_asset_to_withdraw_decimal_bits", - "type": "u128" - }, - { - "name": "withdrawable_from_ts", - "type": "u64" - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "version", - "type": "u8" - } - ] - } - }, - { - "name": "StrategyInitReceipt", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "docs": [ - "The vault associated with this strategy." - ], - "type": "pubkey" - }, - { - "name": "strategy", - "docs": [ - "The strategy address." - ], - "type": "pubkey" - }, - { - "name": "adaptor_program", - "docs": [ - "The adaptor program address." - ], - "type": "pubkey" - }, - { - "name": "position_value", - "docs": [ - "The position value." - ], - "type": "u64" - }, - { - "name": "last_updated_ts", - "docs": [ - "The last updated timestamp." - ], - "type": "u64" - }, - { - "name": "version", - "docs": [ - "A version number (1 byte)." - ], - "type": "u8" - }, - { - "name": "bump", - "docs": [ - "The bump for the strategy init receipt." - ], - "type": "u8" - }, - { - "name": "vault_strategy_auth_bump", - "docs": [ - "The bump for the vault strategy auth." - ], - "type": "u8" - }, - { - "name": "_padding0", - "docs": [ - "6 bytes of padding to align future 8-byte fields on 8-byte boundaries." - ], - "type": { - "array": [ - "u8", - 5 - ] - } - }, - { - "name": "_reserved", - "docs": [ - "Reserved space for future fields" - ], - "type": { - "array": [ - "u8", - 64 - ] - } - } - ] - } - }, - { - "name": "UpdateProtocolEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "protocol", - "type": "pubkey" - }, - { - "name": "admin_before", - "type": "pubkey" - }, - { - "name": "admin_after", - "type": "pubkey" - }, - { - "name": "operational_state_before", - "type": "u16" - }, - { - "name": "operational_state_after", - "type": "u16" - }, - { - "name": "fee_before", - "type": "u16" - }, - { - "name": "fee_after", - "type": "u16" - } - ] - } - }, - { - "name": "UpdateVaultEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "vault_config_max_cap_before", - "type": "u64" - }, - { - "name": "vault_config_max_cap_after", - "type": "u64" - }, - { - "name": "vault_config_start_at_ts_before", - "type": "u64" - }, - { - "name": "vault_config_start_at_ts_after", - "type": "u64" - }, - { - "name": "vault_config_locked_profit_degradation_duration_before", - "type": "u64" - }, - { - "name": "vault_config_locked_profit_degradation_duration_after", - "type": "u64" - }, - { - "name": "vault_config_withdrawal_waiting_period_before", - "type": "u64" - }, - { - "name": "vault_config_withdrawal_waiting_period_after", - "type": "u64" - }, - { - "name": "vault_config_manager_performance_fee_before", - "type": "u16" - }, - { - "name": "vault_config_manager_performance_fee_after", - "type": "u16" - }, - { - "name": "vault_config_admin_performance_fee_before", - "type": "u16" - }, - { - "name": "vault_config_admin_performance_fee_after", - "type": "u16" - }, - { - "name": "vault_config_manager_management_fee_before", - "type": "u16" - }, - { - "name": "vault_config_manager_management_fee_after", - "type": "u16" - }, - { - "name": "vault_config_admin_management_fee_before", - "type": "u16" - }, - { - "name": "vault_config_admin_management_fee_after", - "type": "u16" - }, - { - "name": "vault_config_redemption_fee_before", - "type": "u16" - }, - { - "name": "vault_config_redemption_fee_after", - "type": "u16" - }, - { - "name": "vault_config_issuance_fee_before", - "type": "u16" - }, - { - "name": "vault_config_issuance_fee_after", - "type": "u16" - }, - { - "name": "vault_last_updated_ts", - "type": "u64" - } - ] - } - }, - { - "name": "Vault", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "name", - "docs": [ - "The vault's name." - ], - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "description", - "docs": [ - "A description or summary for this vault." - ], - "type": { - "array": [ - "u8", - 64 - ] - } - }, - { - "name": "asset", - "docs": [ - "The vault’s main asset configuration (inline nested struct)." - ], - "type": { - "defined": { - "name": "VaultAsset" - } - } - }, - { - "name": "lp", - "docs": [ - "The vault’s LP (share) configuration (inline nested struct)." - ], - "type": { - "defined": { - "name": "VaultLp" - } - } - }, - { - "name": "manager", - "docs": [ - "The manager of this vault (has certain permissions)." - ], - "type": "pubkey" - }, - { - "name": "admin", - "docs": [ - "The admin of this vault (broader or fallback permissions)." - ], - "type": "pubkey" - }, - { - "name": "vault_configuration", - "docs": [ - "The vault fee, cap, and locked profit degradation duration configuration (inline nested struct)." - ], - "type": { - "defined": { - "name": "VaultConfiguration" - } - } - }, - { - "name": "fee_configuration", - "docs": [ - "The vault fee and cap configuration (inline nested struct)." - ], - "type": { - "defined": { - "name": "FeeConfiguration" - } - } - }, - { - "name": "fee_update", - "docs": [ - "The fee update state of the vault." - ], - "type": { - "defined": { - "name": "FeeUpdate" - } - } - }, - { - "name": "fee_state", - "docs": [ - "The fee state of the vault." - ], - "type": { - "defined": { - "name": "FeeState" - } - } - }, - { - "name": "high_water_mark", - "type": { - "defined": { - "name": "HighWaterMark" - } - } - }, - { - "name": "last_updated_ts", - "docs": [ - "The last time (Unix timestamp) this vault data was updated." - ], - "type": "u64" - }, - { - "name": "version", - "docs": [ - "The version of the vault." - ], - "type": "u8" - }, - { - "name": "_padding0", - "docs": [ - "padding to align future 8-byte fields on 8-byte boundaries." - ], - "type": { - "array": [ - "u8", - 7 - ] - } - }, - { - "name": "locked_profit_state", - "docs": [ - "The locked profit state of the vault." - ], - "type": { - "defined": { - "name": "LockedProfitState" - } - } - }, - { - "name": "reserved", - "docs": [ - "Reserved bytes for future use." - ], - "type": { - "array": [ - "u8", - 240 - ] - } - } - ] - } - }, - { - "name": "VaultAsset", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "mint", - "docs": [ - "The mint for the vault’s main asset." - ], - "type": "pubkey" - }, - { - "name": "idle_ata", - "docs": [ - "The “idle” token account holding un-invested assets." - ], - "type": "pubkey" - }, - { - "name": "total_value", - "docs": [ - "The total amount of this asset currently in the vault." - ], - "type": "u64" - }, - { - "name": "idle_ata_auth_bump", - "docs": [ - "The bump for the vault asset mint." - ], - "type": "u8" - }, - { - "name": "reserved", - "docs": [ - "Reserved bytes for future use." - ], - "type": { - "array": [ - "u8", - 95 - ] - } - } - ] - } - }, - { - "name": "VaultConfiguration", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "max_cap", - "docs": [ - "The maximum total amount allowed in the vault." - ], - "type": "u64" - }, - { - "name": "start_at_ts", - "docs": [ - "active from timestamp" - ], - "type": "u64" - }, - { - "name": "locked_profit_degradation_duration", - "docs": [ - "The locked profit degradation duration." - ], - "type": "u64" - }, - { - "name": "withdrawal_waiting_period", - "docs": [ - "The waiting period for a withdrawal. prec: seconds" - ], - "type": "u64" - }, - { - "name": "reserved", - "docs": [ - "Reserved bytes for future use." - ], - "type": { - "array": [ - "u8", - 48 - ] - } - } - ] - } - }, - { - "name": "VaultInitializationInput", - "type": { - "kind": "struct", - "fields": [ - { - "name": "max_cap", - "docs": [ - "The maximum total amount allowed in the vault." - ], - "type": "u64" - }, - { - "name": "start_at_ts", - "docs": [ - "active from timestamp" - ], - "type": "u64" - }, - { - "name": "manager_performance_fee", - "docs": [ - "Manager performance fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "admin_performance_fee", - "docs": [ - "Admin performance fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "manager_management_fee", - "docs": [ - "Manager management fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "admin_management_fee", - "docs": [ - "Admin management fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "locked_profit_degradation_duration", - "docs": [ - "The locked profit degradation duration." - ], - "type": "u64" - }, - { - "name": "redemption_fee", - "docs": [ - "The redemption fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "issuance_fee", - "docs": [ - "The issuance fee in basis points (BPS)." - ], - "type": "u16" - }, - { - "name": "withdrawal_waiting_period", - "docs": [ - "The waiting period for a withdrawal." - ], - "type": "u64" - } - ] - } - }, - { - "name": "VaultLp", - "serialization": "bytemuckunsafe", - "repr": { - "kind": "c" - }, - "type": { - "kind": "struct", - "fields": [ - { - "name": "mint", - "docs": [ - "The LP mint (e.g., representing shares in this vault)." - ], - "type": "pubkey" - }, - { - "name": "mint_bump", - "docs": [ - "The bump for the vault LP mint." - ], - "type": "u8" - }, - { - "name": "mint_auth_bump", - "docs": [ - "The bump for the vault LP mint authority." - ], - "type": "u8" - }, - { - "name": "reserved", - "docs": [ - "Reserved bytes for future use." - ], - "type": { - "array": [ - "u8", - 62 - ] - } - } - ] - } - }, - { - "name": "WithdrawStrategyEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "strategy", - "type": "pubkey" - }, - { - "name": "strategy_init_receipt", - "type": "pubkey" - }, - { - "name": "adaptor_program", - "type": "pubkey" - }, - { - "name": "vault_asset_total_value_before", - "type": "u64" - }, - { - "name": "vault_asset_total_value_after", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_before", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_after", - "type": "u64" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_before", - "type": "u128" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_after", - "type": "u128" - }, - { - "name": "vault_asset_idle_ata_amount_before", - "type": "u64" - }, - { - "name": "vault_asset_idle_ata_amount_after", - "type": "u64" - }, - { - "name": "strategy_position_value_before", - "type": "u64" - }, - { - "name": "strategy_position_value_after", - "type": "u64" - } - ] - } - }, - { - "name": "WithdrawVaultEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "vault", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "vault_asset_total_value_before", - "type": "u64" - }, - { - "name": "vault_asset_total_value_after", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_before", - "type": "u64" - }, - { - "name": "vault_lp_supply_incl_fees_after", - "type": "u64" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_before", - "type": "u128" - }, - { - "name": "vault_highest_asset_per_lp_decimal_bits_after", - "type": "u128" - }, - { - "name": "vault_last_updated_ts", - "type": "u64" - } - ] - } + }, + { + "name": "FeeConfiguration", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "manager_performance_fee", "docs": ["Manager performance fee in basis points (BPS)."], "type": "u16"}, + {"name": "admin_performance_fee", "docs": ["Admin performance fee in basis points (BPS)."], "type": "u16"}, + {"name": "manager_management_fee", "docs": ["Manager management fee in basis points (BPS)."], "type": "u16"}, + {"name": "admin_management_fee", "docs": ["Admin management fee in basis points (BPS)."], "type": "u16"}, + {"name": "redemption_fee", "docs": ["The redemption fee in basis points (BPS)."], "type": "u16"}, + {"name": "issuance_fee", "docs": ["The issuance fee in basis points (BPS)."], "type": "u16"}, + {"name": "reserved", "docs": ["Reserved bytes for future use."], "type": {"array": ["u8", 36]}} + ] } - ] - } \ No newline at end of file + }, + { + "name": "FeeUpdate", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "last_performance_fee_update_ts", "docs": ["The timestamp when the performance fees were last updated."], "type": "u64"}, + {"name": "last_management_fee_update_ts", "docs": ["The timestamp when the management fees were last updated."], "type": "u64"} + ] + } + }, + { + "name": "FeeState", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "accumulated_lp_manager_fees", "docs": ["The accumulated manager fees in the vault."], "type": "u64"}, + {"name": "accumulated_lp_admin_fees", "docs": ["The accumulated admin fees in the vault."], "type": "u64"}, + {"name": "accumulated_lp_protocol_fees", "docs": ["The accumulated protocol fees in the vault."], "type": "u64"}, + {"name": "reserved", "docs": ["Reserved bytes for future use."], "type": {"array": ["u8", 24]}} + ] + } + }, + { + "name": "HighWaterMark", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "highest_asset_per_lp_decimal_bits", "docs": ["The highest recorded total asset value per share"], "type": "u128"}, + {"name": "last_updated_ts", "docs": ["The timestamp when the high water mark was last updated"], "type": "u64"}, + {"name": "reserved", "docs": ["Reserved for future use"], "type": {"array": ["u8", 8]}} + ] + } + }, + { + "name": "LockedProfitState", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": {"kind": "struct", "fields": [{"name": "last_updated_locked_profit", "type": "u64"}, {"name": "last_report", "type": "u64"}]} + } + ] +} \ No newline at end of file diff --git a/utils/scripts/sortTopFilesByLines.js b/utils/scripts/sortTopFilesByLines.js new file mode 100644 index 000000000..f865cdbb0 --- /dev/null +++ b/utils/scripts/sortTopFilesByLines.js @@ -0,0 +1,75 @@ +const fs = require('fs'); +const path = require('path'); + +function countLines(filePath) { + try { + const content = fs.readFileSync(filePath, 'utf8'); + return content.split('\n').length; + } catch (error) { + return 0; + } +} + +function getAllFiles(dirPath, filesList = []) { + try { + const files = fs.readdirSync(dirPath); + + files.forEach(file => { + const filePath = path.join(dirPath, file); + const stat = fs.statSync(filePath); + + if (stat.isDirectory()) { + if (!blacklistedFolders.has(file)) + getAllFiles(filePath, filesList); + } else { + filesList.push(filePath); + } + }); + } catch (error) { + console.error(`Error reading directory ${dirPath}:`, error.message); + } + + return filesList; +} + +const blacklistedFolders = new Set(['node_modules']) + +function main() { + const projectsDir = path.join(__dirname, '../../projects'); + + if (!fs.existsSync(projectsDir)) { + console.error('Projects folder not found!'); + return; + } + + console.log('Scanning files...'); + const allFiles = getAllFiles(projectsDir); + + console.log('Counting lines...'); + const filesWithLines = allFiles.map(filePath => ({ + path: path.relative(projectsDir, filePath), + lines: countLines(filePath) + })); + + // Sort by line count (descending) and take top 100 + const top100 = filesWithLines + .sort((a, b) => b.lines - a.lines) + .slice(0, 100); + + // Print table + console.log('\nTop 100 Files by Line Count:'); + console.log('─'.repeat(80)); + console.log('File Path'.padEnd(60) + 'Lines'); + console.log('─'.repeat(80)); + + top100.forEach((file, index) => { + const truncatedPath = file.path.length > 58 ? + '...' + file.path.slice(-55) : file.path; + console.log(`${truncatedPath.padEnd(60)}${file.lines}`); + }); + + console.log('─'.repeat(80)); + console.log(`Total files scanned: ${allFiles.length}`); +} + +main(); \ No newline at end of file