Struct ADOContract

Source
pub struct ADOContract<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> ADOContract<'a>

Source

pub fn get_app_contract( &self, storage: &dyn Storage, ) -> Result<Option<Addr>, ContractError>

Source

pub fn execute_update_app_contract( &self, deps: DepsMut<'_>, info: MessageInfo, address: String, addresses: Option<Vec<AndrAddr>>, ) -> Result<Response, ContractError>

Source§

impl<'a> ADOContract<'a>

Source

pub fn instantiate( &self, storage: &mut dyn Storage, env: Env, api: &dyn Api, querier: &QuerierWrapper<'_>, info: MessageInfo, msg: InstantiateMsg, ) -> Result<Response, ContractError>

Source

pub fn execute( &self, ctx: ExecuteContext<'_>, msg: impl Serialize, ) -> Result<Response, ContractError>

Handles execution of ADO specific messages.

Source

pub fn migrate( &self, deps: DepsMut<'_>, contract_name: &str, contract_version: &str, ) -> Result<Response, ContractError>

Source

pub fn validate_andr_addresses( &self, deps: &Deps<'_>, addresses: Vec<AndrAddr>, ) -> Result<(), ContractError>

Validates all provided AndrAddr addresses.

Requires the VFS address to be set if any address is a VFS path. Automatically validates all stored modules.

Source

pub fn get_kernel_address( &self, storage: &dyn Storage, ) -> Result<Addr, ContractError>

Gets the stored address for the Kernel contract

Source

pub fn get_vfs_address( &self, storage: &dyn Storage, querier: &QuerierWrapper<'_>, ) -> Result<Addr, ContractError>

Gets the current address for the VFS contract.

Source

pub fn get_adodb_address( &self, storage: &dyn Storage, querier: &QuerierWrapper<'_>, ) -> Result<Addr, ContractError>

Gets the current address for the VFS contract.

Source

pub fn execute_amp_receive<M: DeserializeOwned>( &self, ctx: ExecuteContext<'_>, packet: AMPPkt, handler: fn(ExecuteContext<'_>, M) -> Result<Response, ContractError>, ) -> Result<Response, ContractError>

Handles receiving and verifies an AMPPkt from the Kernel before executing the appropriate messages.

Calls the provided handler with the AMP packet attached within the context.

Source

pub fn pay_fee( &self, storage: &dyn Storage, querier: &QuerierWrapper<'_>, action: String, payee: Addr, ) -> Result<SubMsg, ContractError>

Generates a message to pay a fee for a given action by the given payee

Fees are paid in the following fallthrough priority:

  1. ADO Contract
  2. App Contract for sending ADO
  3. Provided Payee

If any of the above cannot pay the fee the remainder is paid by the next in the list until no remainder remains. If there is still a remainder after all 3 payments then the fee cannot be paid and the message will error.

Source

pub fn update_kernel_address( &self, deps: DepsMut<'_>, info: MessageInfo, address: Addr, ) -> Result<Response, ContractError>

Updates the current kernel address used by the ADO Requires the sender to be the owner of the ADO

Source§

impl<'a> ADOContract<'a>

Source

pub fn execute_ownership( &self, deps: DepsMut<'_>, env: Env, info: MessageInfo, msg: OwnershipMessage, ) -> Result<Response, ContractError>

Source

pub fn update_owner( &self, deps: DepsMut<'_>, info: MessageInfo, new_owner: Addr, expiration: Option<MillisecondsExpiration>, ) -> Result<Response, ContractError>

Updates the current contract owner. Only executable by the current contract owner.

Source

pub fn revoke_ownership_offer( &self, deps: DepsMut<'_>, info: MessageInfo, ) -> Result<Response, ContractError>

Revokes the ownership offer. Only executable by the current contract owner.

Source

pub fn accept_ownership( &self, deps: DepsMut<'_>, env: Env, info: MessageInfo, ) -> Result<Response, ContractError>

Accepts the ownership of the contract. Only executable by the new contract owner.

Source

pub fn disown( &self, deps: DepsMut<'_>, info: MessageInfo, ) -> Result<Response, ContractError>

Disowns the contract. Only executable by the current contract owner.

Source

pub fn owner(&self, storage: &dyn Storage) -> Result<Addr, ContractError>

Helper function to query if a given address is the current contract owner.

Returns a boolean value indicating if the given address is the contract owner.

Source

pub fn is_contract_owner( &self, storage: &dyn Storage, addr: &str, ) -> Result<bool, ContractError>

Helper function to query if a given address is the current contract owner.

Returns a boolean value indicating if the given address is the contract owner.

Source

pub fn is_owner_or_operator( &self, storage: &dyn Storage, addr: &str, ) -> Result<bool, ContractError>

Helper function to query if a given address is the current contract owner or operator.

Returns a boolean value indicating if the given address is the contract owner or operator.

Source

pub fn ownership_request( &self, storage: &dyn Storage, ) -> Result<ContractPotentialOwnerResponse, ContractError>

Source§

impl<'a> ADOContract<'a>

Source

pub fn execute_permissioning( &self, ctx: ExecuteContext<'_>, msg: PermissioningMessage, ) -> Result<Response, ContractError>

Source

pub fn is_permissioned( &self, store: &mut dyn Storage, env: Env, action: impl Into<String>, actor: impl Into<String>, ) -> Result<(), ContractError>

Determines if the provided actor is authorised to perform the given action

Returns an error if the given action is not permissioned for the given actor

Source

pub fn is_permissioned_strict( &self, store: &mut dyn Storage, env: Env, action: impl Into<String>, actor: impl Into<String>, ) -> Result<(), ContractError>

Determines if the provided actor is authorised to perform the given action

Ignores the PERMISSIONED_ACTIONS map

Returns an error if the permission has expired or if no permission exists for a restricted ADO

Source

pub fn get_permission( store: &dyn Storage, action: impl Into<String>, actor: impl Into<String>, ) -> Result<Option<Permission>, ContractError>

Gets the permission for the given action and actor

Source

pub fn set_permission( store: &mut dyn Storage, action: impl Into<String>, actor: impl Into<String>, permission: Permission, ) -> Result<(), ContractError>

Sets the permission for the given action and actor

Source

pub fn remove_permission( store: &mut dyn Storage, action: impl Into<String>, actor: impl Into<String>, ) -> Result<(), ContractError>

Removes the permission for the given action and actor

Source

pub fn execute_set_permission( &self, ctx: ExecuteContext<'_>, actor: AndrAddr, action: impl Into<String>, permission: Permission, ) -> Result<Response, ContractError>

Execute handler for setting permission

Whitelisted/Limited permissions will only work for permissioned actions

Source

pub fn execute_remove_permission( &self, ctx: ExecuteContext<'_>, actor: AndrAddr, action: impl Into<String>, ) -> Result<Response, ContractError>

Execute handler for setting permission

Source

pub fn permission_action( &self, action: impl Into<String>, store: &mut dyn Storage, ) -> Result<(), ContractError>

Enables permissioning for a given action

Source

pub fn disable_action_permission( &self, action: impl Into<String>, store: &mut dyn Storage, )

Disables permissioning for a given action

Source

pub fn execute_permission_action( &self, ctx: ExecuteContext<'_>, action: impl Into<String>, ) -> Result<Response, ContractError>

Source

pub fn execute_disable_action_permission( &self, ctx: ExecuteContext<'_>, action: impl Into<String>, ) -> Result<Response, ContractError>

Source

pub fn query_permissions( &self, deps: Deps<'_>, actor: impl Into<String>, limit: Option<u32>, start_after: Option<String>, ) -> Result<Vec<PermissionInfo>, ContractError>

Queries all permissions for a given actor

Source

pub fn query_permissioned_actions( &self, deps: Deps<'_>, ) -> Result<Vec<String>, ContractError>

Source

pub fn query_permissioned_actors( &self, deps: Deps<'_>, action: impl Into<String>, start_after: Option<String>, limit: Option<u32>, order_by: Option<OrderBy>, ) -> Result<Vec<String>, ContractError>

Source§

impl<'a> ADOContract<'a>

Source

pub fn query( &self, deps: Deps<'_>, _env: Env, msg: impl Serialize, ) -> Result<Binary, ContractError>

Source§

impl<'a> ADOContract<'a>

Trait Implementations§

Source§

impl<'a> Default for ADOContract<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ADOContract<'a>

§

impl<'a> RefUnwindSafe for ADOContract<'a>

§

impl<'a> Send for ADOContract<'a>

§

impl<'a> Sync for ADOContract<'a>

§

impl<'a> Unpin for ADOContract<'a>

§

impl<'a> UnwindSafe for ADOContract<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.