feat: миграция smart-updown на anchor 0.31.1 + solana 2.x (SBPFv3)
- anchor-lang 0.31.1 вместо 2.0-rc/anchor-next (git) - Address -> Pubkey (state/events/instructions) - убран #[discrim], добавлен #[derive(InitSpace)] + space=8+INIT_SPACE - тесты переписаны на solana-program-test 2.x (10 passed) - сборка SBPFv3 через cargo build-sbf --tools-version v1.57 - deploy успешен в нашу сеть (agave 4.2.2, SBPFv3)
This commit is contained in:
@@ -3,17 +3,18 @@ use anchor_lang::prelude::*;
|
||||
use crate::{constants::GLOBAL_SEED, state::Global};
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct Initialize {
|
||||
pub struct Initialize<'info> {
|
||||
#[account(mut)]
|
||||
pub admin: Signer,
|
||||
pub admin: Signer<'info>,
|
||||
#[account(
|
||||
init,
|
||||
payer = admin,
|
||||
space = 8 + Global::INIT_SPACE,
|
||||
seeds = [GLOBAL_SEED],
|
||||
bump
|
||||
)]
|
||||
pub global: Account<Global>,
|
||||
pub system_program: Program<System>,
|
||||
pub global: Account<'info, Global>,
|
||||
pub system_program: Program<'info, System>,
|
||||
}
|
||||
|
||||
pub fn handler(
|
||||
@@ -24,8 +25,8 @@ pub fn handler(
|
||||
expiry_seconds: i64,
|
||||
) -> Result<()> {
|
||||
let global = &mut ctx.accounts.global;
|
||||
global.admin = *ctx.accounts.admin.address();
|
||||
global.relayer = *ctx.accounts.admin.address();
|
||||
global.admin = ctx.accounts.admin.key();
|
||||
global.relayer = ctx.accounts.admin.key();
|
||||
global.counter = 0;
|
||||
global.min_amount = min_amount;
|
||||
global.max_amount = max_amount;
|
||||
|
||||
Reference in New Issue
Block a user