fix: распаковать источник из обёртки smart-updown в корень ветки
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
use anchor_lang::prelude::*;
|
||||
|
||||
use crate::{
|
||||
constants::GLOBAL_SEED,
|
||||
error::SmartUpdownError,
|
||||
state::Global,
|
||||
};
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct Update {
|
||||
pub admin: Signer,
|
||||
#[account(
|
||||
mut,
|
||||
seeds = [GLOBAL_SEED],
|
||||
bump
|
||||
)]
|
||||
pub global: Account<Global>,
|
||||
}
|
||||
|
||||
pub fn handler(
|
||||
ctx: &mut Context<Update>,
|
||||
new_relayer: Address,
|
||||
min_amount: u64,
|
||||
max_amount: u64,
|
||||
multiplier_bps: u64,
|
||||
paused: u64,
|
||||
expiry_seconds: i64,
|
||||
) -> Result<()> {
|
||||
require!(
|
||||
anchor_lang::address_eq(ctx.accounts.admin.address(), &ctx.accounts.global.admin),
|
||||
SmartUpdownError::NotAdmin
|
||||
);
|
||||
let global = &mut ctx.accounts.global;
|
||||
global.relayer = new_relayer;
|
||||
global.min_amount = min_amount;
|
||||
global.max_amount = max_amount;
|
||||
global.multiplier_bps = multiplier_bps;
|
||||
global.paused = paused;
|
||||
global.expiry_seconds = expiry_seconds;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user