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, 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 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_update_version( &self, deps: DepsMut<'_> ) -> Result<Response, ContractError>

Updates the current version of the contract.

source

pub fn execute_amp_receive<E: DeserializeOwned>( &self, ctx: ExecuteContext<'_>, packet: AMPPkt, handler: fn(_: ExecuteContext<'_>, _: E) -> 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§

impl<'a> ADOContract<'a>

source

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

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

source

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

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

source

pub fn is_operator(&self, storage: &dyn Storage, addr: &str) -> bool

Helper function to query if a given address is a operator.

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

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§

impl<'a> ADOContract<'a>

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

TODO: Add permission for execute context

source

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

Execute handler for setting permission TODO: Add permission for execute context

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§

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> 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> Twhere 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 Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.