UNPKG

@sol-synth-engine/js-client

Version:

JavaScript client for Sol Synth Engine

1,628 lines 58 kB
{ "address": "Efn1LMT8eTQb8RGMgeZ13WsWyACvxKZh5cqADGx3hc6u", "metadata": { "name": "sol_synth_engine", "version": "0.1.0", "spec": "0.1.0", "description": "Created with Anchor" }, "instructions": [ { "name": "add_treasury", "discriminator": [36, 23, 46, 82, 89, 92, 62, 145], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "market", "writable": true }, { "name": "treasury_mint" }, { "name": "market_treasury_account", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 109, 97, 114, 107, 101, 116, 95, 116, 114, 101, 97, 115, 117, 114, 121, 95, 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "market" }, { "kind": "account", "path": "treasury_mint" } ] } }, { "name": "treasury_oracle" }, { "name": "token_program" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AddTreasuryParams" } } } ] }, { "name": "add_underlying_token", "discriminator": [20, 96, 206, 205, 249, 191, 184, 111], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "market", "writable": true }, { "name": "underlying_token" }, { "name": "market_underlying_token_account", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 109, 97, 114, 107, 101, 116, 95, 117, 110, 100, 101, 114, 108, 121, 105, 110, 103, 95, 116, 111, 107, 101, 110, 95, 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "market" }, { "kind": "account", "path": "underlying_token" } ] } }, { "name": "underlying_token_oracle" }, { "name": "token_program" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AddUnderlyingTokenParams" } } } ] }, { "name": "create_market", "discriminator": [103, 226, 97, 235, 200, 188, 251, 254], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "protocol_config" }, { "name": "market", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [109, 97, 114, 107, 101, 116] }, { "kind": "account", "path": "protocol_config" }, { "kind": "arg", "path": "params.market_index" } ] } }, { "name": "synthetic_mint", "writable": true, "signer": true }, { "name": "synthetic_oracle" }, { "name": "token_program" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [ { "name": "params", "type": { "defined": { "name": "CreateMarketParams" } } } ] }, { "name": "flash_borrow", "discriminator": [166, 221, 220, 25, 61, 73, 127, 240], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "protocol_config" }, { "name": "market", "writable": true }, { "name": "loan", "writable": true, "signer": true }, { "name": "market_token_account_to_borrow", "writable": true }, { "name": "user_token_account_to_borrow", "writable": true }, { "name": "token_mint_to_borrow" }, { "name": "token_oracle" }, { "name": "token_program" }, { "name": "system_program", "address": "11111111111111111111111111111111" }, { "name": "instruction_sysvar", "address": "Sysvar1nstructions1111111111111111111111111" } ], "args": [ { "name": "params", "type": { "defined": { "name": "FlashLoanParams" } } } ] }, { "name": "flash_repay", "discriminator": [182, 143, 19, 23, 39, 221, 184, 78], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "protocol_config" }, { "name": "market", "writable": true }, { "name": "loan", "writable": true }, { "name": "market_token_account_to_repay", "writable": true }, { "name": "user_token_account_to_repay", "writable": true }, { "name": "token_mint_borrowed" }, { "name": "token_mint_to_repay" }, { "name": "token_oracle" }, { "name": "token_program" }, { "name": "instruction_sysvar", "address": "Sysvar1nstructions1111111111111111111111111" } ], "args": [ { "name": "params", "type": { "defined": { "name": "FlashLoanParams" } } } ] }, { "name": "init_protocol_config", "discriminator": [91, 97, 211, 137, 96, 222, 139, 40], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "config", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [99, 111, 110, 102, 105, 103] }, { "kind": "arg", "path": "params.config_index" } ] } }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [ { "name": "params", "type": { "defined": { "name": "InitProtocolConfigParams" } } } ] }, { "name": "mint", "discriminator": [51, 57, 225, 47, 182, 146, 137, 166], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "protocol_config" }, { "name": "market", "writable": true }, { "name": "market_underlying_token_account", "writable": true }, { "name": "user_underlying_token_account", "writable": true }, { "name": "user_synthetic_account", "writable": true }, { "name": "synthetic_mint", "writable": true }, { "name": "underlying_token_mint" }, { "name": "synthetic_oracle" }, { "name": "underlying_token_oracle" }, { "name": "token_program_underlying" }, { "name": "token_program_synthetic" } ], "args": [ { "name": "params", "type": { "defined": { "name": "MintParams" } } } ] }, { "name": "redeem", "discriminator": [184, 12, 86, 149, 70, 196, 97, 225], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "protocol_config" }, { "name": "market", "writable": true }, { "name": "market_underlying_token_account", "writable": true }, { "name": "underlying_token_mint" }, { "name": "underlying_token_oracle" }, { "name": "synthetic_oracle" }, { "name": "token_program" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [] }, { "name": "request_redeem", "discriminator": [105, 49, 44, 38, 207, 241, 33, 173], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "protocol_config" }, { "name": "market", "writable": true }, { "name": "user_synthetic_account", "writable": true }, { "name": "receiver_underlying_token_account", "writable": true }, { "name": "redeem_request", "writable": true, "signer": true }, { "name": "synthetic_mint", "writable": true }, { "name": "underlying_token_mint" }, { "name": "token_program" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [ { "name": "amount", "type": "u64" } ] }, { "name": "update_protocol_authority", "discriminator": [207, 19, 17, 100, 133, 169, 89, 253], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "config", "writable": true } ], "args": [ { "name": "params", "type": { "defined": { "name": "UpdateProtocolAuthorityParams" } } } ] }, { "name": "update_protocol_config", "discriminator": [197, 97, 123, 54, 221, 168, 11, 135], "accounts": [ { "name": "signer", "writable": true, "signer": true }, { "name": "config", "writable": true } ], "args": [ { "name": "params", "type": { "defined": { "name": "UpdateProtocolConfigParams" } } } ] } ], "accounts": [ { "name": "Loan", "discriminator": [20, 195, 70, 117, 165, 227, 182, 1] }, { "name": "Market", "discriminator": [219, 190, 213, 55, 0, 227, 198, 154] }, { "name": "ProtocolConfig", "discriminator": [207, 91, 250, 28, 152, 179, 215, 209] }, { "name": "RedeemRequest", "discriminator": [103, 82, 139, 51, 199, 234, 111, 115] } ], "events": [ { "name": "BatchRedeemed", "discriminator": [29, 133, 124, 168, 252, 115, 14, 175] }, { "name": "FlashBorrowed", "discriminator": [167, 227, 8, 165, 41, 203, 102, 186] }, { "name": "FlashRepaid", "discriminator": [195, 212, 61, 3, 173, 144, 29, 65] }, { "name": "MarketCreated", "discriminator": [88, 184, 130, 231, 226, 84, 6, 58] }, { "name": "Minted", "discriminator": [174, 131, 21, 57, 88, 117, 114, 121] }, { "name": "ProtocolAuthorityUpdated", "discriminator": [43, 87, 57, 197, 28, 30, 11, 9] }, { "name": "ProtocolConfigInitialized", "discriminator": [243, 69, 27, 238, 111, 169, 87, 231] }, { "name": "ProtocolConfigUpdated", "discriminator": [20, 99, 32, 237, 111, 86, 195, 199] }, { "name": "RedeemRequested", "discriminator": [5, 130, 67, 249, 243, 168, 11, 88] }, { "name": "Redeemed", "discriminator": [14, 29, 183, 71, 31, 165, 107, 38] }, { "name": "TreasuryAdded", "discriminator": [221, 133, 19, 21, 42, 43, 32, 16] }, { "name": "UnderlyingTokenAdded", "discriminator": [38, 31, 107, 92, 15, 10, 147, 165] } ], "errors": [ { "code": 6000, "name": "CustomError", "msg": "Custom error message" }, { "code": 6001, "name": "MarketPaused", "msg": "Market is paused" }, { "code": 6002, "name": "MathOverflow", "msg": "Math overflow" }, { "code": 6003, "name": "InvalidMarket", "msg": "Invalid market" }, { "code": 6004, "name": "InvalidLoanUser", "msg": "Invalid loan user" }, { "code": 6005, "name": "InvalidMarketUnderlyingToken", "msg": "Invalid market underlying token" }, { "code": 6006, "name": "InvalidMarketUnderlyingTokenOrTreasuryToken", "msg": "Invalid market underlying token or treasury token" }, { "code": 6007, "name": "InvalidMarketTreasuryToken", "msg": "Invalid market treasury token" }, { "code": 6008, "name": "DepositedCollateralLimitReached", "msg": "Deposited collateral limit reached" }, { "code": 6009, "name": "RequestWithdrawalCollateralLimitReached", "msg": "Request withdrawal collateral limit reached" }, { "code": 6010, "name": "SyntheticSupplyLimitReached", "msg": "Synthetic supply limit reached" }, { "code": 6011, "name": "InvalidRemainingAccounts", "msg": "Invalid remaining accounts" }, { "code": 6012, "name": "InvalidRedeemRequest", "msg": "Invalid redeem request" }, { "code": 6013, "name": "InsufficientBalance", "msg": "Insufficient balance" }, { "code": 6014, "name": "InvalidTokenAccount", "msg": "Invalid token account" }, { "code": 6015, "name": "CollateralValueLessThanSyntheticValue", "msg": "Collateral value is less than synthetic value" }, { "code": 6016, "name": "AmountGreaterThanMaxBorrowAmount", "msg": "Amount is greater than max borrow amount" }, { "code": 6017, "name": "AmountNotGreaterThanZero", "msg": "Amount is not greater than 0" }, { "code": 6018, "name": "InvalidInstructionData", "msg": "Invalid instruction data" }, { "code": 6019, "name": "InvalidFlashLoanInstructions", "msg": "Invalid flash loan instructions" }, { "code": 6020, "name": "InvalidMarketAuthority", "msg": "Invalid market authority" }, { "code": 6021, "name": "InvalidMarketAdminAuthority", "msg": "Invalid market admin authority" }, { "code": 6022, "name": "InvalidProtocolAuthority", "msg": "Invalid protocol authority" }, { "code": 6023, "name": "UnderlyingTokenLimitReached", "msg": "Underlying token limit reached" }, { "code": 6024, "name": "TreasuryTokenLimitReached", "msg": "Treasury token limit reached" }, { "code": 6025, "name": "UnderlyingTokenNotFound", "msg": "Underlying token not found" }, { "code": 6026, "name": "TreasuryTokenNotFound", "msg": "Treasury token not found" }, { "code": 6027, "name": "UnderlyingTokenCapacityReached", "msg": "Underlying token capacity reached" }, { "code": 6028, "name": "TreasuryTokenCapacityReached", "msg": "Treasury token capacity reached" }, { "code": 6029, "name": "TokenOracleMismatch", "msg": "Token oracle mismatch" }, { "code": 6030, "name": "InvalidMarketProtocolConfig", "msg": "Invalid market protocol config" }, { "code": 6031, "name": "InvalidSyntheticMint", "msg": "Invalid synthetic mint" }, { "code": 6032, "name": "InvalidUnderlyingTokenMint", "msg": "Invalid underlying token mint" }, { "code": 6033, "name": "InvalidUnderlyingTokenAccount", "msg": "Invalid underlying token account" }, { "code": 6034, "name": "InvalidMarketUnderlyingTokenAccount", "msg": "Invalid market underlying token account" }, { "code": 6035, "name": "InvalidTreasuryAccount", "msg": "Invalid treasury account" }, { "code": 6036, "name": "InvalidMarketTreasuryAccount", "msg": "Invalid market treasury account" }, { "code": 6037, "name": "InvalidSyntheticTokenAccount", "msg": "Invalid synthetic token account" }, { "code": 6038, "name": "InvalidTokenProgram", "msg": "Invalid token program" }, { "code": 6039, "name": "InvalidOracleFeed", "msg": "Invalid oracle feed" }, { "code": 6040, "name": "SyntheticAmountLessThanMinMintAmount", "msg": "Synthetic amount is less than min mint amount" }, { "code": 6041, "name": "InvalidMarketOperatorAuthority", "msg": "Invalid market operator authority" }, { "code": 6042, "name": "InvalidFlashLoanAmount", "msg": "Invalid flash loan amount" }, { "code": 6043, "name": "InvalidMarketTokenMint", "msg": "Invalid market token mint" }, { "code": 6044, "name": "UnderlyingTokenDepositAmountTooLow", "msg": "Underlying token deposit amount too low" } ], "types": [ { "name": "AddTreasuryParams", "type": { "kind": "struct", "fields": [ { "name": "max_treasury_capacity", "type": "u64" }, { "name": "oracle_source", "type": { "defined": { "name": "OracleSource" } } } ] } }, { "name": "AddUnderlyingTokenParams", "type": { "kind": "struct", "fields": [ { "name": "max_underlying_capacity", "type": "u64" }, { "name": "min_deposit_amount", "type": "u64" }, { "name": "oracle_source", "type": { "defined": { "name": "OracleSource" } } } ] } }, { "name": "BatchRedeemed", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "underlying_token_mint", "type": "pubkey" }, { "name": "synthetic_mint", "type": "pubkey" }, { "name": "total_redeemed_underlying_token", "type": "u64" }, { "name": "total_burned_synthetic", "type": "u64" } ] } }, { "name": "CreateMarketParams", "type": { "kind": "struct", "fields": [ { "name": "admin_authority", "type": "pubkey" }, { "name": "treasury_authority", "type": "pubkey" }, { "name": "operator", "type": "pubkey" }, { "name": "market_index", "type": "u16" }, { "name": "market_name", "type": { "array": ["u8", 32] } }, { "name": "synthetic_mint_decimals", "type": "u8" }, { "name": "max_synthetic_supply", "type": "u64" }, { "name": "min_redeem_amount", "type": "u64" }, { "name": "oracle_source", "type": { "defined": { "name": "OracleSource" } } } ] } }, { "name": "FlashBorrowed", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "loan", "type": "pubkey" }, { "name": "token_mint_borrowed", "type": "pubkey" }, { "name": "token_amount_borrowed", "type": "u64" }, { "name": "token_value_borrowed_scaled", "type": "u128" }, { "name": "token_price_borrowed_scaled", "type": "i64" } ] } }, { "name": "FlashLoanParams", "type": { "kind": "struct", "fields": [ { "name": "amount", "type": "u64" }, { "name": "min_amount_to_repay", "type": "u64" }, { "name": "token_to_borrow", "type": { "defined": { "name": "MarketToken" } } }, { "name": "token_to_repay", "type": { "defined": { "name": "MarketToken" } } } ] } }, { "name": "FlashRepaid", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "loan", "type": "pubkey" }, { "name": "token_mint_borrowed", "type": "pubkey" }, { "name": "token_mint_repaid", "type": "pubkey" }, { "name": "token_amount_borrowed", "type": "u64" }, { "name": "token_price_borrowed_scaled", "type": "i64" }, { "name": "token_value_borrowed_scaled", "type": "u128" }, { "name": "token_amount_repaid", "type": "u64" }, { "name": "token_price_repaid_scaled", "type": "i64" }, { "name": "token_value_repaid_scaled", "type": "u128" } ] } }, { "name": "InitProtocolConfigParams", "type": { "kind": "struct", "fields": [ { "name": "config_index", "type": "u16" }, { "name": "protocol_fee_bps", "type": "u16" }, { "name": "fee_authority", "type": "pubkey" } ] } }, { "name": "Loan", "type": { "kind": "struct", "fields": [ { "name": "user", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "token_mint_borrowed", "type": "pubkey" }, { "name": "token_amount_borrowed", "type": "u64" }, { "name": "token_price_borrowed_scaled", "type": "i64" }, { "name": "token_value_borrowed_scaled", "type": "u128" }, { "name": "min_amount_to_repay", "type": "u64" } ] } }, { "name": "Market", "serialization": "bytemuck", "repr": { "kind": "c" }, "type": { "kind": "struct", "fields": [ { "name": "protocol_config", "type": "pubkey" }, { "name": "admin_authority", "type": "pubkey" }, { "name": "treasury_authority", "type": "pubkey" }, { "name": "operator", "type": "pubkey" }, { "name": "synthetic_mint", "type": "pubkey" }, { "name": "market_name", "type": { "array": ["u8", 32] } }, { "name": "max_synthetic_supply", "type": "u64" }, { "name": "total_synthetic_supply", "type": "u64" }, { "name": "min_redeem_amount", "type": "u64" }, { "name": "underlying_tokens", "type": { "array": [ { "defined": { "name": "UnderlyingToken" } }, 10 ] } }, { "name": "treasury_tokens", "type": { "array": [ { "defined": { "name": "TreasuryToken" } }, 10 ] } }, { "name": "synthetic_oracle", "type": { "defined": { "name": "Oracle" } } }, { "name": "padding_oracle", "type": { "array": ["u8", 4] } }, { "name": "market_index", "type": "u16" }, { "name": "synthetic_decimals", "type": "u8" }, { "name": "seed_bump", "type": "u8" }, { "name": "paused", "type": "u8" }, { "name": "padding_0", "type": { "array": ["u8", 3] } } ] } }, { "name": "MarketCreated", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "protocol_config", "type": "pubkey" }, { "name": "admin_authority", "type": "pubkey" }, { "name": "operator", "type": "pubkey" }, { "name": "synthetic_mint", "type": "pubkey" }, { "name": "synthetic_oracle", "type": "pubkey" }, { "name": "market_name", "type": { "array": ["u8", 32] } }, { "name": "market_index", "type": "u16" }, { "name": "max_synthetic_supply", "type": "u64" }, { "name": "synthetic_oracle_source", "type": { "defined": { "name": "OracleSource" } } } ] } }, { "name": "MarketToken", "type": { "kind": "enum", "variants": [ { "name": "UnderlyingToken" }, { "name": "TreasuryToken" } ] } }, { "name": "MintParams", "type": { "kind": "struct", "fields": [ { "name": "amount", "type": "u64" }, { "name": "min_mint_amount", "type": "u64" } ] } }, { "name": "Minted", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "receiver_token_account", "type": "pubkey" }, { "name": "synthetic_mint", "type": "pubkey" }, { "name": "synthetic_amount", "type": "u64" }, { "name": "collateral_amount", "type": "u64" }, { "name": "collateral_mint", "type": "pubkey" }, { "name": "min_mint_amount", "type": "u64" } ] } }, { "name": "Oracle", "serialization": "bytemuck", "repr": { "kind": "c" }, "type": { "kind": "struct", "fields": [ { "name": "feed", "type": "pubkey" }, { "name": "source", "type": "u8" }, { "name": "padding", "type": { "array": ["u8", 3] } } ] } }, { "name": "OracleSource", "repr": { "kind": "c" }, "type": { "kind": "enum", "variants": [ { "name": "Pyth" }, { "name": "Pyth1K" }, { "name": "Pyth1M" }, { "name": "PythStableCoin" } ] } }, { "name": "ProtocolAuthorityUpdated", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "protocol_config", "type": "pubkey" }, { "name": "old_admin_authority", "type": "pubkey" }, { "name": "new_admin_authority", "type": "pubkey" } ] } }, { "name": "ProtocolConfig", "type": { "kind": "struct", "fields": [ { "name": "admin_authority", "type": "pubkey" }, { "name": "fee_authority", "type": "pubkey" }, { "name": "config_index", "type": "u16" }, { "name": "protocol_fee_bps", "type": "u16" }, { "name": "seed_bump", "type": "u8" } ] } }, { "name": "ProtocolConfigInitialized", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "protocol_config", "type": "pubkey" }, { "name": "config_index", "type": "u16" }, { "name": "authority", "type": "pubkey" }, { "name": "protocol_fee_bps", "type": "u16" }, { "name": "fee_authority", "type": "pubkey" } ] } }, { "name": "ProtocolConfigUpdated", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "protocol_config", "type": "pubkey" }, { "name": "protocol_fee_bps", "type": "u16" }, { "name": "fee_authority", "type": "pubkey" } ] } }, { "name": "RedeemRequest", "type": { "kind": "struct", "fields": [ { "name": "user", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "receiver_underlying_token_account", "type": "pubkey" }, { "name": "created_ts", "type": "i64" }, { "name": "synthetic_amount", "type": "u64" } ] } }, { "name": "RedeemRequested", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "redeem_request", "type": "pubkey" }, { "name": "underlying_token_mint", "type": "pubkey" }, { "name": "synthetic_mint", "type": "pubkey" }, { "name": "receiver_underlying_token_account", "type": "pubkey" }, { "name": "synthetic_amount", "type": "u64" } ] } }, { "name": "Redeemed", "type": { "kind": "struct", "fields": [ { "name": "signer", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "redeem_request", "type": "pubkey" }, { "name": "underlying_token_mint", "type": "pubkey" }, { "name": "synthetic_mint", "