Skip to content

Commit 233ac62

Browse files
devin-ai-integration[bot]Jayant
andcommitted
feat(solana): implement SVM Entropy contract with V2 API
- Create new pyth-entropy Solana program using Anchor framework - Implement V2 variants of Entropy contract methods from Ethereum version - Add account structures for EntropyConfig, ProviderInfo, and EntropyRequest - Include provider registration, randomness requests, and reveal functionality - Support callback mechanisms and fee management - Follow existing workspace patterns and dependencies Refs: target_chains/ethereum/contracts/contracts/entropy/Entropy.sol Co-Authored-By: Jayant <[email protected]>
1 parent 264c790 commit 233ac62

File tree

6 files changed

+821
-0
lines changed

6 files changed

+821
-0
lines changed

target_chains/solana/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[workspace]
22
members = [
33
"programs/*",
4+
"programs/pyth-entropy",
45
"cli/",
56
"program_simulator/",
67
"pyth_solana_receiver_sdk/",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "pyth-entropy"
3+
version = "0.1.0"
4+
description = "Pyth Entropy - Secure randomness provider for Solana"
5+
edition = "2021"
6+
7+
[lib]
8+
crate-type = ["cdylib", "lib"]
9+
name = "pyth_entropy"
10+
11+
[features]
12+
no-entrypoint = []
13+
no-idl = []
14+
no-log-ix-name = []
15+
cpi = ["no-entrypoint"]
16+
test-bpf = []
17+
18+
[dependencies]
19+
anchor-lang = { workspace = true }
20+
solana-program = { workspace = true }
21+
byteorder = "1.4.3"
22+
rand = "0.8.5"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.bpfel-unknown-unknown.dependencies.std]
2+
features = []
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
use anchor_lang::prelude::*;
2+
3+
#[error_code]
4+
pub enum EntropyError {
5+
#[msg("Provider not found")]
6+
NoSuchProvider,
7+
8+
#[msg("Request not found")]
9+
NoSuchRequest,
10+
11+
#[msg("Insufficient fee provided")]
12+
InsufficientFee,
13+
14+
#[msg("Provider is out of randomness")]
15+
OutOfRandomness,
16+
17+
#[msg("Incorrect revelation provided")]
18+
IncorrectRevelation,
19+
20+
#[msg("Unauthorized access")]
21+
Unauthorized,
22+
23+
#[msg("Invalid reveal call")]
24+
InvalidRevealCall,
25+
26+
#[msg("Assertion failure")]
27+
AssertionFailure,
28+
29+
#[msg("Update too old")]
30+
UpdateTooOld,
31+
32+
#[msg("Last revealed too old")]
33+
LastRevealedTooOld,
34+
35+
#[msg("Insufficient gas")]
36+
InsufficientGas,
37+
38+
#[msg("Max gas limit exceeded")]
39+
MaxGasLimitExceeded,
40+
41+
#[msg("Blockhash unavailable")]
42+
BlockhashUnavailable,
43+
44+
#[msg("Zero minimum signatures")]
45+
ZeroMinimumSignatures,
46+
47+
#[msg("Invalid guardian order")]
48+
InvalidGuardianOrder,
49+
50+
#[msg("Invalid guardian index")]
51+
InvalidGuardianIndex,
52+
}

0 commit comments

Comments
 (0)