Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ members = [
"basics/rent/pinocchio/program",
"basics/rent/anchor/programs/*",
"basics/favorites/native/program",
"basics/favorites/pinocchio/program",
"basics/repository-layout/native/program",
"basics/repository-layout/anchor/programs/*",
"basics/transfer-sol/native/program",
Expand Down
11 changes: 2 additions & 9 deletions basics/account-data/pinocchio/program/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#![no_std]
#![allow(deprecated)]

use pinocchio::{
account_info::AccountInfo,
entrypoint, nostd_panic_handler,
program_error::ProgramError,
pubkey::Pubkey,
sysvars::rent::{
Rent, DEFAULT_BURN_PERCENT, DEFAULT_EXEMPTION_THRESHOLD, DEFAULT_LAMPORTS_PER_BYTE_YEAR,
},
sysvars::{rent::Rent, Sysvar},
ProgramResult,
};
use pinocchio_system::instructions::CreateAccount;
Expand Down Expand Up @@ -63,11 +60,7 @@ fn process_create(
return Err(ProgramError::InvalidInstructionData);
}

let rent = Rent {
lamports_per_byte_year: DEFAULT_LAMPORTS_PER_BYTE_YEAR,
exemption_threshold: DEFAULT_EXEMPTION_THRESHOLD,
burn_percent: DEFAULT_BURN_PERCENT,
};
let rent = Rent::get()?;

let account_span = AddressInfo::LEN;
let lamports_required = rent.minimum_balance(account_span);
Expand Down
1 change: 0 additions & 1 deletion basics/checking-accounts/pinocchio/program/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![no_std]
#![allow(deprecated)]

use pinocchio::{
account_info::AccountInfo, entrypoint, nostd_panic_handler, program_error::ProgramError,
Expand Down
17 changes: 3 additions & 14 deletions basics/close-account/pinocchio/program/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![no_std]
#![allow(deprecated)]

use pinocchio::{
account_info::AccountInfo,
Expand All @@ -8,9 +7,7 @@ use pinocchio::{
nostd_panic_handler,
program_error::ProgramError,
pubkey::Pubkey,
sysvars::rent::{
Rent, DEFAULT_BURN_PERCENT, DEFAULT_EXEMPTION_THRESHOLD, DEFAULT_LAMPORTS_PER_BYTE_YEAR,
},
sysvars::{rent::Rent, Sysvar},
ProgramResult,
};
use pinocchio_system::instructions::CreateAccount;
Expand Down Expand Up @@ -51,11 +48,7 @@ fn process_user(
return Err(ProgramError::NotEnoughAccountKeys);
};

let rent = Rent {
lamports_per_byte_year: DEFAULT_LAMPORTS_PER_BYTE_YEAR,
exemption_threshold: DEFAULT_EXEMPTION_THRESHOLD,
burn_percent: DEFAULT_BURN_PERCENT,
};
let rent = Rent::get()?;

let account_span = User::LEN;
let lamports_required = rent.minimum_balance(account_span);
Expand Down Expand Up @@ -93,11 +86,7 @@ fn process_close(accounts: &[AccountInfo]) -> ProgramResult {
return Err(ProgramError::NotEnoughAccountKeys);
};

let rent = Rent {
lamports_per_byte_year: DEFAULT_LAMPORTS_PER_BYTE_YEAR,
exemption_threshold: DEFAULT_EXEMPTION_THRESHOLD,
burn_percent: DEFAULT_BURN_PERCENT,
};
let rent = Rent::get()?;

let account_span = 0usize;
let lamports_required = rent.minimum_balance(account_span);
Expand Down
1 change: 0 additions & 1 deletion basics/counter/pinocchio/program/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![no_std]
#![allow(deprecated)]

use pinocchio::{
account_info::AccountInfo, nostd_panic_handler, program_error::ProgramError, pubkey::Pubkey,
Expand Down
1 change: 0 additions & 1 deletion basics/create-account/pinocchio/program/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![no_std]
#![allow(deprecated)]

use pinocchio::{
account_info::AccountInfo, entrypoint, nostd_panic_handler, program_error::ProgramError,
Expand Down
8 changes: 8 additions & 0 deletions basics/favorites/pinocchio/cicd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# This script is for quick building & deploying of the program.
# It also serves as a reference for the commands used for building & deploying Solana programs.
# Run this bad boy with "bash cicd.sh" or "./cicd.sh"

cargo build-sbf --manifest-path=./program/Cargo.toml --bpf-out-dir=./program/target/so
solana program deploy ./program/target/so/program.so
24 changes: 24 additions & 0 deletions basics/favorites/pinocchio/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "module",
"scripts": {
"test": "pnpm ts-mocha -p ./tsconfig.json -t 1000000 ./tests/test.ts",
"build-and-test": "cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./tests/fixtures && pnpm test",
"build": "cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./program/target/so",
"deploy": "solana program deploy ./program/target/so/program.so"
},
"dependencies": {
"@solana/web3.js": "^1.47.3",
"borsh": "^2.0.0"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"@types/node": "^22.8.1",
"chai": "^4.3.4",
"mocha": "^9.0.3",
"solana-bankrun": "^0.3.0",
"ts-mocha": "^10.0.0",
"typescript": "^4.3.5"
}
}
Loading
Loading