Skip to content

feat(solana): implement SVM Entropy contract with V2 API #2886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions target_chains/solana/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions target_chains/solana/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"programs/*",
"programs/pyth-entropy",
"cli/",
"program_simulator/",
"pyth_solana_receiver_sdk/",
Expand Down
22 changes: 22 additions & 0 deletions target_chains/solana/programs/pyth-entropy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "pyth-entropy"
version = "0.1.0"
description = "Pyth Entropy - Secure randomness provider for Solana"
edition = "2021"

[lib]
crate-type = ["cdylib", "lib"]
name = "pyth_entropy"

[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
test-bpf = []

[dependencies]
anchor-lang = { workspace = true }
solana-program = { workspace = true }
byteorder = "1.4.3"
rand = "0.8.5"
2 changes: 2 additions & 0 deletions target_chains/solana/programs/pyth-entropy/Xargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.bpfel-unknown-unknown.dependencies.std]
features = []
52 changes: 52 additions & 0 deletions target_chains/solana/programs/pyth-entropy/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
use anchor_lang::prelude::*;

#[error_code]
pub enum EntropyError {
#[msg("Provider not found")]
NoSuchProvider,

#[msg("Request not found")]
NoSuchRequest,

#[msg("Insufficient fee provided")]
InsufficientFee,

#[msg("Provider is out of randomness")]
OutOfRandomness,

#[msg("Incorrect revelation provided")]
IncorrectRevelation,

#[msg("Unauthorized access")]
Unauthorized,

#[msg("Invalid reveal call")]
InvalidRevealCall,

#[msg("Assertion failure")]
AssertionFailure,

#[msg("Update too old")]
UpdateTooOld,

#[msg("Last revealed too old")]
LastRevealedTooOld,

#[msg("Insufficient gas")]
InsufficientGas,

#[msg("Max gas limit exceeded")]
MaxGasLimitExceeded,

#[msg("Blockhash unavailable")]
BlockhashUnavailable,

#[msg("Zero minimum signatures")]
ZeroMinimumSignatures,

#[msg("Invalid guardian order")]
InvalidGuardianOrder,

#[msg("Invalid guardian index")]
InvalidGuardianIndex,
}
Loading
Loading