Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit Fixes 12 : Miscellaneous comments #556

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions framework/contracts/account/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ pub fn instantiate(
ensure_eq!(
address,
env.contract.address,
AccountError::AbsAccInvalidAddr {
AccountError::AbstractAccountInvalidAddress {
abstract_account: address.to_string(),
contract: env.contract.address.to_string()
}
);
#[cfg(feature = "xion")]
{
let Some(mut add_auth) = authenticator else {
return Err(AccountError::AbsAccNoAuth {});
return Err(AccountError::AbstractAccountNoAuth {});
};
abstract_xion::execute::add_auth_method(deps.branch(), &env, &mut add_auth)?;

Expand All @@ -172,7 +172,7 @@ pub fn instantiate(
}
// No Auth possible - error
#[cfg(not(feature = "xion"))]
return Err(AccountError::AbsAccNoAuth {});
return Err(AccountError::AbstractAccountNoAuth {});
}
_ => (),
};
Expand Down
8 changes: 4 additions & 4 deletions framework/contracts/account/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub enum AccountError {
#[error("Cannot migrate {} twice", module_id)]
DuplicateModuleMigration { module_id: String },

#[error("{0} not upgradable")]
#[error("{0} not upgradeable")]
NotUpgradeable(ModuleInfo),

#[error("Cannot remove module because {0:?} depend(s) on it.")]
Expand Down Expand Up @@ -115,8 +115,8 @@ pub enum AccountError {
#[error("You can't chain admin calls")]
CantChainAdminCalls {},

#[error("Abstract Account Address don't match to the Contract address")]
AbsAccInvalidAddr {
#[error("Abstract Account Address ({abstract_account}) doesn't match to the Contract address ({contract}) ")]
AbstractAccountInvalidAddress {
abstract_account: String,
contract: String,
},
Expand All @@ -125,7 +125,7 @@ pub enum AccountError {
NoAuthMethods {},

#[error("Abstract Account don't have Authentication")]
AbsAccNoAuth {},
AbstractAccountNoAuth {},

#[cfg(feature = "xion")]
#[error(transparent)]
Expand Down
16 changes: 6 additions & 10 deletions framework/contracts/account/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,12 @@ pub fn migrate_from_xion_account(
None,
)];

if !install_modules.is_empty() {
let abstract_code_id =
native_addrs::abstract_code_id(&deps.querier, env.contract.address.clone())?;
// Install modules
let (install_msgs, install_attribute) =
_install_modules(deps, install_modules, vec![], abstract_code_id)?;
response = response
.add_submessages(install_msgs)
.add_attribute(install_attribute.key, install_attribute.value);
}
// Install IBC Client module
let (install_msgs, install_attribute) =
_install_modules(deps, install_modules, vec![], abstract_code_id)?;
response = response
.add_submessages(install_msgs)
.add_attribute(install_attribute.key, install_attribute.value);

Ok(response)
}
Expand Down
28 changes: 28 additions & 0 deletions framework/docs/src/3_framework/4_ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,34 @@ Suppose you share an account with your friends and want to use a multisig govern

With this configuration, any proposal will require approval from stakeholders with a combined voting weight of at least 60% to be executed. This ensures a more democratic decision-making process and reduces the risk of a single stakeholder making unilateral decisions.

## NFT

NFT governance is a structure that represents an account which ownership depends on the ownership of an NFT. This admin of the Account is the owner of the specific token. When this token is transfered, the account ownership is transferred automatically with it.

```mermaid
graph TD
subgraph NFT
A[Single Account] --> |Owns| T1[Token1]
end
A-->|Controls| C(Abstract Account Linked to Token1)

```

## Xion Abstract Account

This XION Abstract Account governance leverages <a href="https://xion.burnt.com/" target="_blank" >Xion</a>'s techonology to authenticate user calls using other methods than the standard Wallet/Private/Public Key authentication. With this governance type, users are able to extend the XION base functionalities to work directly with Abstract.

You can find more details on the <a href="https://github.com/burnt-labs/abstract-account/blob/2c933a7b2a8dacc0ae5bf4344159a7d4ab080135/README.md" target="_blank">Xion Abstract Account page</a>.

```mermaid
graph TD
subgraph NFT
A[Single Account] --> |Owns| T1[Token1]
end
A-->|Controls| C(Abstract Account Linked to Token1)

```

## Sub-Accounts

A Sub-Account is an Abstract Account that is owned by another Abstract Account. They are important to users as they allow users to safely experiment with different apps without the concern of those apps accessing funds from their main account or other apps.
Expand Down
5 changes: 4 additions & 1 deletion framework/packages/abstract-std/src/objects/gov_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ pub enum GovernanceDetails<T: AddressLike> {
// Account address
account: T,
},
/// An external governance source
/// An external governance source. This could be a cw3 contract for instance
/// The External Governance source still leverages one address that is admin of the contract
External {
/// The external contract address
governance_address: T,
/// Governance type used for doing extra off-chain queries depending on the type.
governance_type: String,
},
/// This account is linked to an NFT collection.
/// The owern of the specified token_id is the owner of the account
NFT {
collection_addr: T,
token_id: String,
Expand Down
Loading