syntax = "proto3"; package code.currency.v1; option go_package = "github.com/code-payments/code-protobuf-api/generated/go/currency/v1;currency"; option java_package = "com.codeinc.gen.currency.v1"; option objc_class_prefix = "CPBCurrencyV1"; import "common/v1/model.proto"; import "validate/validate.proto"; import "google/protobuf/timestamp.proto"; service Currency { // GetAllRates returns the exchange rates for the core mint token against all // available currencies rpc GetAllRates(GetAllRatesRequest) returns (GetAllRatesResponse); // GetMints gets mint account metadata by address rpc GetMints(GetMintsRequest) returns (GetMintsResponse); } message GetAllRatesRequest { // If timestamp is included, the returned rate will be the most recent available // exchange rate prior to the provided timestamp within the same day. Otherwise, // the latest rates will be returned. google.protobuf.Timestamp timestamp = 1; } message GetAllRatesResponse { Result result = 1; enum Result { OK = 0; // No currency data is available for the requested timestamp. MISSING_DATA = 1; } // The time the exchange rates were observed google.protobuf.Timestamp as_of = 2 [(validate.rules).timestamp.required = true]; // The price of 1 core mint token in different currencies, keyed on 3- or 4- // letter lowercase currency code. map rates = 3 [(validate.rules).map.keys.string = { pattern: "^[a-z]{3,4}$" }]; } message GetMintsRequest { repeated common.v1.SolanaAccountId addresses = 1 [(validate.rules).repeated = { min_items: 1 max_items: 1024 // Arbitrary }]; } message GetMintsResponse { Result result = 1; enum Result { OK = 0; NOT_FOUND = 1; } map metadata_by_address = 2; } message Mint { // Token mint address common.v1.SolanaAccountId address = 1 [(validate.rules).message.required = true]; // The number of decimals configured for the mint uint32 decimals = 2; // Currency name string name = 3 [(validate.rules).string = { min_len: 1, max_len: 32, }]; // Currency ticker symbol string symbol = 4 [(validate.rules).string = { min_len: 1, max_len: 8, }]; // Currency description string description = 5 [(validate.rules).string = { min_len: 1, max_len: 4096, }]; // URL to currency image string image_url = 6 [(validate.rules).string = { min_len: 1, max_len: 1024, }]; // Available when a VM exists for the given mint, and can be used for deriving // VM deposit PDAs // // Note: Only currencies with a VM are useable for payments VmMetadata vm_metadata = 7; // Available when created by the launchpad via the currency creator program, and // can be used for calculating price, market cap, etc. based on the exponential // bonding curve LaunchpadMetadata launchpad_metadata = 8; // Timestamp the currency was created google.protobuf.Timestamp created_at = 9 [(validate.rules).timestamp.required = true]; } message VmMetadata { // VM address common.v1.SolanaAccountId vm = 1 [(validate.rules).message.required = true]; // Authority that subsidizes and authorizes all transactions against the VM common.v1.SolanaAccountId authority = 2 [(validate.rules).message.required = true]; // Lock duration of Virtual Timelock Accounts on the VM, currently hardcoded // to 21 days uint32 lock_duration_in_days = 3 [(validate.rules).uint32.const = 21]; } message LaunchpadMetadata { // The address of the currency config common.v1.SolanaAccountId currency_config = 1 [(validate.rules).message.required = true]; // The address of the liquidity pool common.v1.SolanaAccountId liquidity_pool = 2 [(validate.rules).message.required = true]; // The random seed used during currency creation common.v1.SolanaAccountId seed = 3 [(validate.rules).message.required = true]; // The address of the authority for the currency common.v1.SolanaAccountId authority = 4 [(validate.rules).message.required = true]; // The address where this mint's tokens are locked against the liquidity pool common.v1.SolanaAccountId mint_vault = 5 [(validate.rules).message.required = true]; // The address where core mint tokens are locked against the liquidity pool common.v1.SolanaAccountId core_mint_vault = 6 [(validate.rules).message.required = true]; // Reserved for mint_fees if we enable buy fees reserved 7; // The address where core mint fees are paid common.v1.SolanaAccountId core_mint_fees = 8 [(validate.rules).message.required = true]; // Current circulating mint token supply in quarks uint64 supply_from_bonding = 9; // Current core mint quarks locked in the liquidity pool uint64 core_mint_locked = 10; // Reserved for buy_fee_bps if we enable buy fees reserved 11; // Precent fee for sells in basis points, currently hardcoded to 1% uint32 sell_fee_bps = 12 [(validate.rules).uint32.const = 100]; }