-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add get_minimum_delegation_data() helper function
- Loading branch information
1 parent
f7b00ad
commit 9e36279
Showing
7 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "solana-bpf-rust-get-minimum-delegation-data" | ||
version = "1.11.0" | ||
description = "Solana BPF test program written in Rust" | ||
authors = ["Solana Maintainers <[email protected]>"] | ||
repository = "https://github.com/solana-labs/solana" | ||
license = "Apache-2.0" | ||
homepage = "https://solana.com/" | ||
documentation = "https://docs.rs/solana-bpf-rust-get-minimum-delegation-data" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
solana-program = { path = "../../../../sdk/program", version = "=1.11.0" } | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//! Example/test program for calling GetMinimumDelegation and then the | ||
//! helper function to return the minimum delegation value. | ||
#![allow(unreachable_code)] | ||
|
||
extern crate solana_program; | ||
use solana_program::{ | ||
account_info::AccountInfo, entrypoint::ProgramResult, program, pubkey::Pubkey, stake, | ||
}; | ||
|
||
solana_program::entrypoint!(process_instruction); | ||
#[allow(clippy::unnecessary_wraps)] | ||
fn process_instruction( | ||
_program_id: &Pubkey, | ||
_accounts: &[AccountInfo], | ||
_instruction_data: &[u8], | ||
) -> ProgramResult { | ||
let get_minimum_delegation_instruction = stake::instruction::get_minimum_delegation(); | ||
program::invoke(&get_minimum_delegation_instruction, &[]).unwrap(); | ||
|
||
let minimum_delegation = stake::instruction::utils::get_minimum_delegation_data(); | ||
assert!(minimum_delegation.is_some()); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters