Skip to content

Commit

Permalink
feat: brick program (#144)
Browse files Browse the repository at this point in the history
* feat: brick program

* Error for any program call rather than one instruction nobody will ever call (#147)

* fix: add test feature to compile

---------

Co-authored-by: Pierre <[email protected]>
Co-authored-by: J <[email protected]>
  • Loading branch information
3 people authored Dec 15, 2023
1 parent 53e018a commit 9785d82
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

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

23 changes: 23 additions & 0 deletions programs/brick/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "brick"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"

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

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

[profile.release]
overflow-checks = true

[dependencies]
anchor-lang = "0.26.0"
2 changes: 2 additions & 0 deletions programs/brick/Xargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.bpfel-unknown-unknown.dependencies.std]
features = []
22 changes: 22 additions & 0 deletions programs/brick/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use anchor_lang::prelude::*;

declare_id!("MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA");

#[program]
pub mod brick {
use super::*;

pub fn fallback(
_program_id: &Pubkey,
_accounts: &[AccountInfo],
_instruction_data: &[u8],
) -> Result<()> {
Err(ErrorCode::ProgramDisabled.into())
}
}

#[error_code]
pub enum ErrorCode {
#[msg("This program is temporarily disabled.")]
ProgramDisabled,
}

0 comments on commit 9785d82

Please sign in to comment.