Struct andromeda_std::ado_contract::state::ADOContract
source · pub struct ADOContract<'a> { /* private fields */ }
Implementations§
source§impl<'a> ADOContract<'a>
impl<'a> ADOContract<'a>
pub fn get_app_contract( &self, storage: &dyn Storage ) -> Result<Option<Addr>, ContractError>
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>
impl<'a> ADOContract<'a>
pub fn instantiate( &self, storage: &mut dyn Storage, env: Env, api: &dyn Api, info: MessageInfo, msg: InstantiateMsg ) -> Result<Response, ContractError>
sourcepub fn execute(
&self,
ctx: ExecuteContext<'_>,
msg: impl Serialize
) -> Result<Response, ContractError>
pub fn execute( &self, ctx: ExecuteContext<'_>, msg: impl Serialize ) -> Result<Response, ContractError>
Handles execution of ADO specific messages.
sourcepub fn validate_andr_addresses(
&self,
deps: &Deps<'_>,
addresses: Vec<AndrAddr>
) -> Result<(), ContractError>
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.
sourcepub fn get_kernel_address(
&self,
storage: &dyn Storage
) -> Result<Addr, ContractError>
pub fn get_kernel_address( &self, storage: &dyn Storage ) -> Result<Addr, ContractError>
Gets the stored address for the Kernel contract
sourcepub fn get_vfs_address(
&self,
storage: &dyn Storage,
querier: &QuerierWrapper<'_>
) -> Result<Addr, ContractError>
pub fn get_vfs_address( &self, storage: &dyn Storage, querier: &QuerierWrapper<'_> ) -> Result<Addr, ContractError>
Gets the current address for the VFS contract.
sourcepub fn get_adodb_address(
&self,
storage: &dyn Storage,
querier: &QuerierWrapper<'_>
) -> Result<Addr, ContractError>
pub fn get_adodb_address( &self, storage: &dyn Storage, querier: &QuerierWrapper<'_> ) -> Result<Addr, ContractError>
Gets the current address for the VFS contract.
sourcepub fn execute_update_version(
&self,
deps: DepsMut<'_>
) -> Result<Response, ContractError>
pub fn execute_update_version( &self, deps: DepsMut<'_> ) -> Result<Response, ContractError>
Updates the current version of the contract.
sourcepub fn execute_amp_receive<E: DeserializeOwned>(
&self,
ctx: ExecuteContext<'_>,
packet: AMPPkt,
handler: fn(_: ExecuteContext<'_>, _: E) -> Result<Response, ContractError>
) -> Result<Response, ContractError>
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.
sourcepub fn pay_fee(
&self,
storage: &dyn Storage,
querier: &QuerierWrapper<'_>,
action: String,
payee: Addr
) -> Result<SubMsg, ContractError>
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:
- ADO Contract
- App Contract for sending ADO
- 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>
impl<'a> ADOContract<'a>
sourcepub fn execute_update_owner(
&self,
deps: DepsMut<'_>,
info: MessageInfo,
new_owner: String
) -> Result<Response, ContractError>
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.
sourcepub fn execute_update_operators(
&self,
deps: DepsMut<'_>,
info: MessageInfo,
operators: Vec<String>
) -> Result<Response, ContractError>
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.
sourcepub fn is_operator(&self, storage: &dyn Storage, addr: &str) -> bool
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.
sourcepub fn is_contract_owner(
&self,
storage: &dyn Storage,
addr: &str
) -> Result<bool, ContractError>
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.
sourcepub fn is_owner_or_operator(
&self,
storage: &dyn Storage,
addr: &str
) -> Result<bool, ContractError>
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>
impl<'a> ADOContract<'a>
sourcepub fn is_permissioned(
&self,
store: &mut dyn Storage,
env: Env,
action: impl Into<String>,
actor: impl Into<String>
) -> Result<(), ContractError>
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
sourcepub fn is_permissioned_strict(
&self,
store: &mut dyn Storage,
env: Env,
action: impl Into<String>,
actor: impl Into<String>
) -> Result<(), ContractError>
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
sourcepub fn get_permission(
store: &dyn Storage,
action: impl Into<String>,
actor: impl Into<String>
) -> Result<Option<Permission>, ContractError>
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
sourcepub fn set_permission(
store: &mut dyn Storage,
action: impl Into<String>,
actor: impl Into<String>,
permission: Permission
) -> Result<(), ContractError>
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
sourcepub fn remove_permission(
store: &mut dyn Storage,
action: impl Into<String>,
actor: impl Into<String>
) -> Result<(), ContractError>
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
sourcepub fn execute_set_permission(
&self,
ctx: ExecuteContext<'_>,
actor: AndrAddr,
action: impl Into<String>,
permission: Permission
) -> Result<Response, ContractError>
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
sourcepub fn execute_remove_permission(
&self,
ctx: ExecuteContext<'_>,
actor: AndrAddr,
action: impl Into<String>
) -> Result<Response, ContractError>
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
sourcepub fn permission_action(
&self,
action: impl Into<String>,
store: &mut dyn Storage
) -> Result<(), ContractError>
pub fn permission_action( &self, action: impl Into<String>, store: &mut dyn Storage ) -> Result<(), ContractError>
Enables permissioning for a given action
sourcepub fn disable_action_permission(
&self,
action: impl Into<String>,
store: &mut dyn Storage
)
pub fn disable_action_permission( &self, action: impl Into<String>, store: &mut dyn Storage )
Disables permissioning for a given action
pub fn execute_permission_action( &self, ctx: ExecuteContext<'_>, action: impl Into<String> ) -> Result<Response, ContractError>
pub fn execute_disable_action_permission( &self, ctx: ExecuteContext<'_>, action: impl Into<String> ) -> Result<Response, ContractError>
sourcepub fn query_permissions(
&self,
deps: Deps<'_>,
actor: impl Into<String>,
limit: Option<u32>,
start_after: Option<String>
) -> Result<Vec<PermissionInfo>, ContractError>
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
pub fn query_permissioned_actions( &self, deps: Deps<'_> ) -> Result<Vec<String>, ContractError>
source§impl<'a> ADOContract<'a>
impl<'a> ADOContract<'a>
source§impl<'a> ADOContract<'a>
impl<'a> ADOContract<'a>
pub fn query_contract_owner( &self, deps: Deps<'_> ) -> Result<ContractOwnerResponse, ContractError>
pub fn query_is_operator( &self, deps: Deps<'_>, addr: &str ) -> Result<IsOperatorResponse, ContractError>
pub fn query_kernel_address( &self, deps: Deps<'_> ) -> Result<KernelAddressResponse, ContractError>
pub fn query_operators( &self, deps: Deps<'_> ) -> Result<OperatorsResponse, ContractError>
pub fn query_original_publisher( &self, deps: Deps<'_> ) -> Result<PublisherResponse, ContractError>
pub fn query_block_height_upon_creation( &self, deps: Deps<'_> ) -> Result<BlockHeightResponse, ContractError>
pub fn query_type(&self, deps: Deps<'_>) -> Result<TypeResponse, ContractError>
pub fn query_version( &self, deps: Deps<'_> ) -> Result<VersionResponse, ContractError>
Trait Implementations§
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§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
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