feat: add bpf-c-noop example
This commit is contained in:
1
web3.js/examples/bpf-c-noop/.gitignore
vendored
Normal file
1
web3.js/examples/bpf-c-noop/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/out/
|
1
web3.js/examples/bpf-c-noop/makefile
Normal file
1
web3.js/examples/bpf-c-noop/makefile
Normal file
@ -0,0 +1 @@
|
||||
include ../../bpf-sdk/bpf.mk
|
24
web3.js/examples/bpf-c-noop/src/noop.c
Normal file
24
web3.js/examples/bpf-c-noop/src/noop.c
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @brief Example C-based BPF program that prints out the parameters
|
||||
* passed to it
|
||||
*/
|
||||
|
||||
#include <sol_bpf.h>
|
||||
|
||||
/**
|
||||
* Number of SolKeyedAccounts expected. The program should bail if an
|
||||
* unexpected number of accounts are passed to the program's entrypoint
|
||||
*/
|
||||
#define NUM_KA 1
|
||||
|
||||
extern bool entrypoint(const uint8_t *input) {
|
||||
SolKeyedAccounts ka[NUM_KA];
|
||||
uint8_t *data;
|
||||
uint64_t data_len;
|
||||
|
||||
if (!sol_deserialize(input, NUM_KA, ka, &data, &data_len)) {
|
||||
return false;
|
||||
}
|
||||
sol_print_params(NUM_KA, ka, data, data_len);
|
||||
return true;
|
||||
}
|
Reference in New Issue
Block a user