UNPKG

@pushchain/core

Version:
541 lines (540 loc) 17.1 kB
{ "address": "3zrWaMknHTRQpZSxY4BvQxw9TStSXiHcmcp3NMPTFkke", "metadata": { "name": "pushsolanalocker", "version": "0.1.0", "spec": "0.1.0", "description": "Created with Anchor" }, "instructions": [ { "name": "add_funds", "discriminator": [ 132, 237, 76, 57, 80, 10, 179, 138 ], "accounts": [ { "name": "locker", "pda": { "seeds": [ { "kind": "const", "value": [ 108, 111, 99, 107, 101, 114 ] } ] } }, { "name": "vault", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 118, 97, 117, 108, 116 ] } ] } }, { "name": "user", "writable": true, "signer": true }, { "name": "price_update" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [ { "name": "amount", "type": "u64" }, { "name": "transaction_hash", "type": { "array": [ "u8", 32 ] } } ] }, { "name": "get_sol_price", "discriminator": [ 230, 145, 206, 175, 43, 184, 97, 110 ], "accounts": [ { "name": "price_update" } ], "args": [], "returns": { "defined": { "name": "PriceData" } } }, { "name": "initialize", "discriminator": [ 175, 175, 109, 31, 13, 152, 155, 237 ], "accounts": [ { "name": "locker_data", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 108, 111, 99, 107, 101, 114 ] } ] } }, { "name": "vault", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 118, 97, 117, 108, 116 ] } ] } }, { "name": "admin", "writable": true, "signer": true }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [] }, { "name": "recover_tokens", "discriminator": [ 156, 18, 205, 212, 197, 254, 126, 142 ], "accounts": [ { "name": "locker_data" }, { "name": "vault", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 118, 97, 117, 108, 116 ] } ] } }, { "name": "recipient", "writable": true, "signer": true }, { "name": "admin", "writable": true, "signer": true }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [ { "name": "amount", "type": "u64" } ] } ], "accounts": [ { "name": "Locker", "discriminator": [ 74, 246, 6, 113, 249, 228, 75, 169 ] }, { "name": "PriceUpdateV2", "discriminator": [ 34, 241, 35, 99, 157, 126, 244, 205 ] } ], "events": [ { "name": "FundsAddedEvent", "discriminator": [ 127, 31, 108, 255, 187, 19, 70, 68 ] }, { "name": "TokenRecoveredEvent", "discriminator": [ 72, 100, 110, 181, 188, 125, 10, 53 ] } ], "errors": [ { "code": 6000, "name": "NoFundsSent", "msg": "No SOL sent" }, { "code": 6001, "name": "Unauthorized", "msg": "Unauthorized" }, { "code": 6002, "name": "InvalidPrice", "msg": "Invalid price data" } ], "types": [ { "name": "FundsAddedEvent", "type": { "kind": "struct", "fields": [ { "name": "user", "type": "pubkey" }, { "name": "sol_amount", "type": "u64" }, { "name": "usd_equivalent", "type": "i128" }, { "name": "usd_exponent", "type": "i32" }, { "name": "transaction_hash", "type": { "array": [ "u8", 32 ] } } ] } }, { "name": "Locker", "type": { "kind": "struct", "fields": [ { "name": "admin", "type": "pubkey" }, { "name": "bump", "type": "u8" }, { "name": "vault_bump", "type": "u8" } ] } }, { "name": "PriceData", "type": { "kind": "struct", "fields": [ { "name": "price", "type": "i64" }, { "name": "exponent", "type": "i32" }, { "name": "publish_time", "type": "i64" }, { "name": "confidence", "type": "u64" } ] } }, { "name": "PriceFeedMessage", "repr": { "kind": "c" }, "type": { "kind": "struct", "fields": [ { "name": "feed_id", "docs": [ "`FeedId` but avoid the type alias because of compatibility issues with Anchor's `idl-build` feature." ], "type": { "array": [ "u8", 32 ] } }, { "name": "price", "type": "i64" }, { "name": "conf", "type": "u64" }, { "name": "exponent", "type": "i32" }, { "name": "publish_time", "docs": [ "The timestamp of this price update in seconds" ], "type": "i64" }, { "name": "prev_publish_time", "docs": [ "The timestamp of the previous price update. This field is intended to allow users to", "identify the single unique price update for any moment in time:", "for any time t, the unique update is the one such that prev_publish_time < t <= publish_time.", "", "Note that there may not be such an update while we are migrating to the new message-sending logic,", "as some price updates on pythnet may not be sent to other chains (because the message-sending", "logic may not have triggered). We can solve this problem by making the message-sending mandatory", "(which we can do once publishers have migrated over).", "", "Additionally, this field may be equal to publish_time if the message is sent on a slot where", "where the aggregation was unsuccesful. This problem will go away once all publishers have", "migrated over to a recent version of pyth-agent." ], "type": "i64" }, { "name": "ema_price", "type": "i64" }, { "name": "ema_conf", "type": "u64" } ] } }, { "name": "PriceUpdateV2", "docs": [ "A price update account. This account is used by the Pyth Receiver program to store a verified price update from a Pyth price feed.", "It contains:", "- `write_authority`: The write authority for this account. This authority can close this account to reclaim rent or update the account to contain a different price update.", "- `verification_level`: The [`VerificationLevel`] of this price update. This represents how many Wormhole guardian signatures have been verified for this price update.", "- `price_message`: The actual price update.", "- `posted_slot`: The slot at which this price update was posted." ], "type": { "kind": "struct", "fields": [ { "name": "write_authority", "type": "pubkey" }, { "name": "verification_level", "type": { "defined": { "name": "VerificationLevel" } } }, { "name": "price_message", "type": { "defined": { "name": "PriceFeedMessage" } } }, { "name": "posted_slot", "type": "u64" } ] } }, { "name": "TokenRecoveredEvent", "type": { "kind": "struct", "fields": [ { "name": "admin", "type": "pubkey" }, { "name": "amount", "type": "u64" } ] } }, { "name": "VerificationLevel", "docs": [ "Pyth price updates are bridged to all blockchains via Wormhole.", "Using the price updates on another chain requires verifying the signatures of the Wormhole guardians.", "The usual process is to check the signatures for two thirds of the total number of guardians, but this can be cumbersome on Solana because of the transaction size limits,", "so we also allow for partial verification.", "", "This enum represents how much a price update has been verified:", "- If `Full`, we have verified the signatures for two thirds of the current guardians.", "- If `Partial`, only `num_signatures` guardian signatures have been checked.", "", "# Warning", "Using partially verified price updates is dangerous, as it lowers the threshold of guardians that need to collude to produce a malicious price update." ], "type": { "kind": "enum", "variants": [ { "name": "Partial", "fields": [ { "name": "num_signatures", "type": "u8" } ] }, { "name": "Full" } ] } } ] }