Skip to content

Commit e8f35eb

Browse files
authored
Merge pull request solana-labs#64 from jarry-xiao/gumball-machine
Gumball machine v0
2 parents 81cecaf + ddba093 commit e8f35eb

File tree

15 files changed

+1763
-54
lines changed

15 files changed

+1763
-54
lines changed

contracts/Anchor.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
gummyroll = "GRoLLMza82AiYN7W9S9KCCtCyyPRAQP2ifBy4v4D5RMD"
33
gummyroll_crud = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
44
bubblegum = "BGUMzZr2wWfD2yzrXFEWTK2HbdYhqQCP2EZoPEkZBD6o"
5+
gumball_machine = "BRKyVDRGT7SPBtMhjHN4PVSPVYoc3Wa3QTyuRVM4iZkt"
56

67
[[test.genesis]]
78
address = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"

contracts/Cargo.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
members = [
33
"programs/gummyroll",
44
"programs/gummyroll_crud",
5-
"programs/bubblegum"
5+
"programs/bubblegum",
6+
"programs/gumball-machine"
67
]

contracts/programs/bubblegum/src/state/metaplex_adapter.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,25 @@ pub enum UseMethod {
3939
Single,
4040
}
4141

42+
impl UseMethod {
43+
pub fn to_u8(&self) -> u8 {
44+
match self {
45+
Self::Burn => 1,
46+
Self::Multiple => 2,
47+
Self::Single => 3,
48+
}
49+
}
50+
51+
pub fn from_u8(i: u8) -> Result<Self> {
52+
match i {
53+
1 => Ok(Self::Burn),
54+
2 => Ok(Self::Multiple),
55+
3 => Ok(Self::Single),
56+
_ => Err(ProgramError::InvalidArgument.into())
57+
}
58+
}
59+
}
60+
4261
#[derive(AnchorSerialize, AnchorDeserialize, PartialEq, Debug, Clone)]
4362
pub struct Uses {
4463
// 17 bytes + Option byte
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[package]
2+
name = "gumball-machine"
3+
version = "0.1.0"
4+
description = "Created with Anchor"
5+
edition = "2018"
6+
7+
[lib]
8+
crate-type = ["cdylib", "lib"]
9+
name = "gumball_machine"
10+
11+
[features]
12+
no-entrypoint = []
13+
no-idl = []
14+
no-log-ix-name = []
15+
cpi = ["no-entrypoint"]
16+
default = []
17+
18+
[dependencies]
19+
anchor-lang = { path="../../../deps/anchor/lang" }
20+
anchor-spl = { path="../../../deps/anchor/spl" }
21+
spl-token = "3.3.0"
22+
mpl-token-metadata = { git = "https://github.com/jarry-xiao/metaplex-program-library", rev="7e2810a", features = [ "no-entrypoint" ] }
23+
bubblegum = { path = "../bubblegum", features = ["cpi"] }
24+
gummyroll = { path = "../gummyroll", features = ["cpi"] }
25+
bytemuck = "1.8.0"
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 = []

0 commit comments

Comments
 (0)