Fetch Global State
- TypeScript
- Python
const globalState = await sdk.orica.fetchGlobalState();
console.log("Authority:", globalState.authority.toBase58());
console.log("Market Count:", globalState.marketCount.toString());
console.log("USDC Mint:", globalState.usdcMint.toBase58());
console.log("Fee Vault:", globalState.feeVault.toBase58());
global_state = await sdk.orica.fetch_global_state()
print(f"Authority: {global_state.authority}")
print(f"Market Count: {global_state.market_count}")
print(f"USDC Mint: {global_state.usdc_mint}")
print(f"Fee Vault: {global_state.fee_vault}")
Fee Information
- TypeScript
- Python
const globalState = await sdk.orica.fetchGlobalState();
console.log("Market Creation Fee:", globalState.creationFee.toString(), "lamports");
console.log("Protocol Trading Fee:", globalState.authorityTradingFeeBps, "bps");
console.log("Creator Trading Fee:", globalState.creatorTradingFeeBps, "bps");
console.log("Redemption Fee:", globalState.redemptionFeeBps, "bps");
// Total trading fee
const totalTradingFeeBps = globalState.authorityTradingFeeBps + globalState.creatorTradingFeeBps;
console.log("Total Trading Fee:", totalTradingFeeBps / 100, "%");
global_state = await sdk.orica.fetch_global_state()
print(f"Market Creation Fee: {global_state.creation_fee} lamports")
print(f"Protocol Trading Fee: {global_state.authority_trading_fee_bps} bps")
print(f"Creator Trading Fee: {global_state.creator_trading_fee_bps} bps")
print(f"Redemption Fee: {global_state.redemption_fee_bps} bps")
# Total trading fee
total_trading_fee_bps = global_state.authority_trading_fee_bps + global_state.creator_trading_fee_bps
print(f"Total Trading Fee: {total_trading_fee_bps / 100}%")
Admin List
- TypeScript
- Python
const globalState = await sdk.orica.fetchGlobalState();
console.log("Admins:");
for (const admin of globalState.admins) {
console.log(" -", admin.toBase58());
}
global_state = await sdk.orica.fetch_global_state()
print("Admins:")
for admin in global_state.admins:
print(f" - {admin}")
Global State Structure
- TypeScript
- Python
interface GlobalState {
authority: PublicKey; // Protocol authority
admins: PublicKey[]; // List of admins
creationFee: BN; // Fee to create market (lamports)
authorityTradingFeeBps: number; // Protocol trading fee (basis points)
creatorTradingFeeBps: number; // Creator trading fee (basis points)
redemptionFeeBps: number; // Redemption fee (basis points)
usdcMint: PublicKey; // USDC token mint
feeVault: PublicKey; // Protocol fee collection account
marketCount: BN; // Total markets created
bump: number; // PDA bump
feeVaultBump: number; // Fee vault PDA bump
}
@dataclass
class GlobalState:
authority: Pubkey # Protocol authority
admins: list[Pubkey] # List of admins
creation_fee: int # Fee to create market (lamports)
authority_trading_fee_bps: int # Protocol trading fee (basis points)
creator_trading_fee_bps: int # Creator trading fee (basis points)
redemption_fee_bps: int # Redemption fee (basis points)
usdc_mint: Pubkey # USDC token mint
fee_vault: Pubkey # Protocol fee collection account
market_count: int # Total markets created
bump: int # PDA bump
fee_vault_bump: int # Fee vault PDA bump
Derive Global State PDA
- TypeScript
- Python
const [globalStatePDA, bump] = sdk.orica.pda.globalState();
console.log("Global State address:", globalStatePDA.toBase58());
global_state_pda, bump = sdk.orica.pda.global_state()
print(f"Global State address: {global_state_pda}")
Next Steps
Markets
Fetch market data.
Trading
Execute trades.