Cancels the scheduled operation identified by (caller, target, function, args). canceller must be the operation's scheduler (caller), an
effective ADMIN_ROLE member, or an effective member of the guardian
role of the function's required role. Returns the canceled nonce.
AccessManagerError::OperationNotScheduled] - No pending operation
exists for the given parameters.AccessManagerError::UnauthorizedCancel] - canceller is not allowed
to cancel the operation.fn cancel(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
function: soroban_sdk::Symbol,
args: soroban_sdk::Vec,
caller: soroban_sdk::Address,
canceller: soroban_sdk::Address,
) -> u32
Relays a call to function on target with args, on behalf of
caller, returning the target's return value.
caller must currently be allowed to call the function (see
[AccessManager::can_call]). Because the manager is the owner/admin of
target, the target authorizes the relayed call. If the caller holds the
required role behind a non-zero execution delay, the call must have been
scheduled via [AccessManager::schedule] and its delay must have elapsed;
the matching scheduled operation is consumed.
AccessManagerError::TargetClosed] - The target is closed.AccessManagerError::Unauthorized] - The caller lacks the role.AccessManagerError::OperationNotScheduled] - The caller has an
execution delay but no matching scheduled operation.AccessManagerError::OperationNotReady] - The scheduled operation's
delay has not yet elapsed.AccessManagerError::OperationExpired] - The scheduled operation has
expired and must be scheduled again.fn execute(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
function: soroban_sdk::Symbol,
args: soroban_sdk::Vec,
caller: soroban_sdk::Address,
) -> soroban_sdk::Val
Returns whether caller may call function on target right now, and
the execution delay that applies.
fn can_call(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
target: soroban_sdk::Address,
function: soroban_sdk::Symbol,
) -> CanCall
Returns whether account is an effective member of role and the
execution delay attached to that membership.
fn has_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
account: soroban_sdk::Address,
) -> RoleStatus
Schedules a delayed call to function on target with args, on behalf
of caller, so it can later be run through [AccessManager::execute]
once the caller's execution delay has elapsed.
when is the desired execution timestamp; pass 0 to schedule at the
earliest permitted time (now + execution_delay). Returns the operation
id and its nonce.
AccessManagerError::TargetClosed] - The target is closed.AccessManagerError::Unauthorized] - The caller is not a member of
the required role, or holds it with no execution delay (in which case
it can call [AccessManager::execute] directly without scheduling).AccessManagerError::InvalidScheduleTime] - when is earlier than
now + execution_delay.AccessManagerError::OperationAlreadyScheduled] - An identical
operation is already scheduled and still pending.fn schedule(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
function: soroban_sdk::Symbol,
args: soroban_sdk::Vec,
when: u64,
caller: soroban_sdk::Address,
) -> (soroban_sdk::BytesN<32>, u32)
Returns the latest nonce assigned to operation id (0 if it was never
scheduled).
fn get_nonce(env: soroban_sdk::Env, id: soroban_sdk::BytesN<32>) -> u32
The super-role.
fn admin_role(env: soroban_sdk::Env) -> soroban_sdk::Symbol
Returns the raw membership record for (account, role), if any. The
membership may exist but not yet be effective (its since is in the
future) when granted under a grant delay.
fn get_access(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
account: soroban_sdk::Address,
) -> Option
Grants role to account with the given execution_delay.
caller must be an effective member of role's admin role. The grant
becomes effective after the role's grant delay; for an account that is
already a member, only the execution delay is updated.
PUBLIC_ROLE cannot be granted (everyone holds it implicitly).
fn grant_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
account: soroban_sdk::Address,
execution_delay: u64,
caller: soroban_sdk::Address,
)
The open role implicitly held by every account.
fn public_role(env: soroban_sdk::Env) -> soroban_sdk::Symbol
Revokes role from account. caller must be an effective member of
role's admin role. PUBLIC_ROLE cannot be revoked.
fn revoke_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
account: soroban_sdk::Address,
caller: soroban_sdk::Address,
)
Returns the timestamp at which the operation id becomes executable, or
0 if it is not currently scheduled (never scheduled, already executed,
canceled, or expired).
fn get_schedule(env: soroban_sdk::Env, id: soroban_sdk::BytesN<32>) -> u64
Initializes the manager, granting admin the ADMIN_ROLE effective
immediately and with no execution delay.
fn __constructor(env: soroban_sdk::Env, admin: soroban_sdk::Address)
Renounces role for the caller's own account. account must equal
caller.
fn renounce_role(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
account: soroban_sdk::Address,
caller: soroban_sdk::Address,
)
fn get_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
) -> soroban_sdk::Symbol
Returns the operation id (a hash over caller, target, function and
args) used to schedule, execute and cancel a delayed call.
fn hash_operation(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
target: soroban_sdk::Address,
function: soroban_sdk::Symbol,
args: soroban_sdk::Vec,
) -> soroban_sdk::BytesN<32>
Sets the admin role of role (the role allowed to grant/revoke it).
caller must be an effective ADMIN_ROLE member.
fn set_role_admin(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
admin_role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Sets the grant delay (seconds) of role. caller must be an effective
ADMIN_ROLE member.
fn set_grant_delay(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
delay: u32,
caller: soroban_sdk::Address,
)
fn is_target_closed(env: soroban_sdk::Env, target: soroban_sdk::Address) -> bool
fn get_role_guardian(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
) -> soroban_sdk::Symbol
Sets the guardian role of role. caller must be an effective
ADMIN_ROLE member.
fn set_role_guardian(
env: soroban_sdk::Env,
role: soroban_sdk::Symbol,
guardian: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)
Opens or closes target. A closed target rejects every call routed
through [AccessManager::execute]. caller must be an effective
ADMIN_ROLE member.
fn set_target_closed(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
closed: bool,
caller: soroban_sdk::Address,
)
fn get_role_grant_delay(env: soroban_sdk::Env, role: soroban_sdk::Symbol) -> u32
fn get_target_admin_delay(env: soroban_sdk::Env, target: soroban_sdk::Address) -> u32
Sets the admin delay (seconds) of target. Stored for parity with the
EVM contract; reserved for a future scheduling implementation. caller
must be an effective ADMIN_ROLE member.
fn set_target_admin_delay(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
delay: u32,
caller: soroban_sdk::Address,
)
fn get_target_function_role(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
function: soroban_sdk::Symbol,
) -> soroban_sdk::Symbol
Sets the role required to call each function in functions on target.
caller must be an effective ADMIN_ROLE member.
fn set_target_function_role(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
functions: soroban_sdk::Vec,
role: soroban_sdk::Symbol,
caller: soroban_sdk::Address,
)