-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathadmin.rs
More file actions
39 lines (34 loc) · 1.18 KB
/
Copy pathadmin.rs
File metadata and controls
39 lines (34 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ============================================================
// Admin Operations
// ============================================================
use soroban_sdk::{Address, Env};
use crate::storage::config;
use crate::types::errors::Error;
use crate::types::state::VerifyingKey;
use crate::utils::validation;
/// Pause the pool.
pub fn pause(env: Env, admin: Address) -> Result<(), Error> {
admin.require_auth();
let mut pool_config = config::load(&env)?;
validation::require_admin(&admin, &pool_config)?;
pool_config.paused = true;
config::save(&env, &pool_config);
Ok(())
}
/// Unpause the pool.
pub fn unpause(env: Env, admin: Address) -> Result<(), Error> {
admin.require_auth();
let mut pool_config = config::load(&env)?;
validation::require_admin(&admin, &pool_config)?;
pool_config.paused = false;
config::save(&env, &pool_config);
Ok(())
}
/// Update the verifying key.
pub fn set_verifying_key(env: Env, admin: Address, vk: VerifyingKey) -> Result<(), Error> {
admin.require_auth();
let pool_config = config::load(&env)?;
validation::require_admin(&admin, &pool_config)?;
config::save_verifying_key(&env, &vk);
Ok(())
}