oil-api
API for interacting with the OIL protocol on Solana. OIL is a crypto mining protocol that allows users to deploy SOL to claim space on a board, mine OIL tokens, and stake for yield.
Features
- Instruction builders for all OIL protocol instructions
- State types and account deserialization for all program accounts
- PDA derivation utilities for deriving program-derived addresses
- SDK functions for common operations like deploying, claiming, and staking
- Type-safe instruction and state handling using
steelandbytemuck
Usage
Add to your Cargo.toml:
[]
= "0.3.3"
Example
use *;
use Pubkey;
// Derive a Miner PDA
let = miner_pda;
// Build a Deploy instruction
let deploy_ix = deploy;
// Build a ClaimOIL instruction
let claim_oil_ix = claim_oil;
// Build a Deposit instruction for staking
let deposit_ix = deposit;
Modules
Core Modules
consts- Program constants including addresses, time constants, and token decimalserror- Custom program error typesevent- Program event typesinstruction- Instruction types and builderssdk- High-level SDK functions for common operationsstate- Account state types and PDA derivation functions
State Accounts
Auction- Auction stateAutomation- Automation configurationBid- Auction bid accountBoard- Current round stateConfig- Global program configurationMiner- User mining statePool- Mining pool stateAuctionPool- Auction pool stateReferral- Referral trackingRig- Rig configurationRound- Round-specific stateStake- Staking accountTreasury- Treasury accountWell- Well state
Instructions
Mining Instructions
deploy- Deploy SOL to claim space on the boardclaim_oil- Claim OIL mining rewardsclaim_sol- Claim SOL mining rewardscheckpoint- Checkpoint rewards from a prior roundautomate- Configure automationreload_sol- Reload SOL mining rewards into automationreset- Reset the board for a new round
Auction Instructions
place_bid- Set a bid in the auction (automatically syncs accumulated OIL and halvings)claim_auction_oil- Claim OIL from auctionclaim_auction_sol- Claim SOL from auction
Staking Instructions
deposit- Deposit OIL into a stake accountwithdraw- Withdraw OIL from a stake accountclaim_yield- Claim staking yield
Referral Instructions
create_referral- Create a referral accountclaim_referral- Claim referral rewards
Program ID
The OIL program ID is: oiLPAxq5ZTRHDqi4QtwGzm5iTe4X93nNnGgy9hoXK5z
Documentation
Full API documentation is available at:
- docs.rs: https://docs.rs/oil-api
- Repository: https://github.com/oil-protocol/oil
Dependencies
This crate depends on:
entropy-rng-api- For entropy-based randomnessoil-mint-api- For OIL token minting operationssolana-program- Solana program SDKsteel- Solana instruction building frameworkspl-token- SPL token programspl-token-2022- SPL token 2022 program
License
Licensed under Apache-2.0
Related
- OIL Program - The on-chain Solana program
- OIL Protocol - Protocol website