2 releases
2.0.0-mod.2 | Aug 8, 2024 |
---|
#46 in #mining
8KB
142 lines
ORE
ORE is a proof-of-work token everyone can mine.
API
Consts
– Program constants.Error
– Custom program errors.Event
– Custom program events.Instruction
– Declared instructions and arguments.
Instructions
Claim
– Distributes ORE from the treasury to a miner.Close
– Closes a proof account returns the rent to the owner.Open
– Opens a new proof account for a miner.Mine
– Verifies a hash and increments a miner's claimable balance.Stake
– Stakes ORE with a miner to increase their multiplier.Reset
– Resets the program for a new epoch.Update
– Updates a proof account's miner authority.Upgrade
– Migrates ORE v1 tokens to ORE v2, one-for-one.Initialize
– Initializes the program and creates the global accounts.
State
Bus
- An account (8 total) which tracks and limits the amount ORE mined each epoch.Config
– A singleton account which manages program-wide variables.Proof
- An account (1 per user) which tracks a miner's current hash and current stake.Treasury
– A singleton account which has authority to mint ORE and holds onto user stake.
Tests
To run the test suite, use the Solana toolchain:
cargo test-sbf
For line coverage, use llvm-cov:
cargo llvm-cov
Dependencies
~2–11MB
~121K SLoC