From 822b69de131f58d6fcb1ad24644da9dc73fab83e Mon Sep 17 00:00:00 2001 From: Ash Date: Tue, 5 Nov 2024 18:47:58 +0700 Subject: [PATCH 1/2] remove import --- README.md | 2 +- contracts/account/Cargo.toml | 1 - contracts/account/src/contract.rs | 41 ++++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 75e0ac4..1efeff4 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,5 @@ docker run --rm -v "$(pwd)":/code \ --mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/optimizer:0.16.0 + cosmwasm/optimizer:0.16.1 ``` \ No newline at end of file diff --git a/contracts/account/Cargo.toml b/contracts/account/Cargo.toml index 8c353a6..e3c1218 100644 --- a/contracts/account/Cargo.toml +++ b/contracts/account/Cargo.toml @@ -12,7 +12,6 @@ crate-type = ["cdylib", "rlib"] library = [] [dependencies] -absacc = { git = "https://github.com/burnt-labs/abstract-account.git", rev = "4e376f2f399f17e50016a932d4e5af7336d952d7" } cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } cw2 = { workspace = true } diff --git a/contracts/account/src/contract.rs b/contracts/account/src/contract.rs index bcec851..653ae35 100644 --- a/contracts/account/src/contract.rs +++ b/contracts/account/src/contract.rs @@ -1,4 +1,4 @@ -pub use absacc::AccountSudoMsg; +use cosmwasm_schema::cw_serde; use cosmwasm_std::{to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; use crate::error::ContractError; @@ -22,6 +22,45 @@ pub fn instantiate( execute::init(deps, env, &mut msg.authenticator.clone()) } +#[cw_serde] +pub struct Any { + pub type_url: String, + pub value: Binary, +} + +/// Any contract must implement this sudo message (both variants) in order to +/// qualify as an abstract account. +#[cw_serde] +pub enum AccountSudoMsg { + /// Called by the AnteHandler's BeforeTxDecorator before a tx is executed. + BeforeTx { + /// Messages the tx contains + msgs: Vec, + + /// The tx serialized into binary format. + /// + /// If the tx authentication requires a signature, this is the bytes to + /// be signed. + tx_bytes: Binary, + + /// The credential to prove this tx is authenticated. + /// + /// This is taken from the tx's "signature" field, but in the case of + /// AbstractAccounts, this is not necessarily a cryptographic signature. + /// The contract is free to interpret this as any data type. + cred_bytes: Option, + + /// Whether the tx is being run in the simulation mode. + simulate: bool, + }, + + /// Called by the PostHandler's AfterTxDecorator after the tx is executed. + AfterTx { + /// Whether the tx is being run in the simulation mode. + simulate: bool, + }, +} + #[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] pub fn sudo(deps: DepsMut, env: Env, msg: AccountSudoMsg) -> ContractResult { match msg { From 424c413e738fedcf07234a63b97a956f5734f14b Mon Sep 17 00:00:00 2001 From: Ash Date: Tue, 5 Nov 2024 23:07:44 +0700 Subject: [PATCH 2/2] nit --- contracts/account/src/contract.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/contracts/account/src/contract.rs b/contracts/account/src/contract.rs index 653ae35..15a7f6a 100644 --- a/contracts/account/src/contract.rs +++ b/contracts/account/src/contract.rs @@ -1,5 +1,7 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; +use cosmwasm_std::{ + to_json_binary, AnyMsg, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult, +}; use crate::error::ContractError; use crate::execute::{add_auth_method, assert_self, remove_auth_method}; @@ -22,12 +24,6 @@ pub fn instantiate( execute::init(deps, env, &mut msg.authenticator.clone()) } -#[cw_serde] -pub struct Any { - pub type_url: String, - pub value: Binary, -} - /// Any contract must implement this sudo message (both variants) in order to /// qualify as an abstract account. #[cw_serde] @@ -35,7 +31,7 @@ pub enum AccountSudoMsg { /// Called by the AnteHandler's BeforeTxDecorator before a tx is executed. BeforeTx { /// Messages the tx contains - msgs: Vec, + msgs: Vec, /// The tx serialized into binary format. ///