DA0-DA0 / dao-contracts

CosmWasm smart contracts for Interchain DAOs.
https://docs.daodao.zone
BSD 3-Clause "New" or "Revised" License
202 stars 132 forks source link

Remaining Audit Fixes & Factory Pattern #750

Closed JakeHartnell closed 8 months ago

JakeHartnell commented 9 months ago

Addresses a few of the remaining audit fixes, but more importantly solves a blocker for both Stargaze NFT DAOs as well as potentially future Token Factory DAOs. The Stargaze team requested that NFT creation honor would honor the fairburn mechanism.

This is made possible by the factory pattern: creating Token or NFT DAO tokens by calling into a factory contract that does validation as well as returning required information to implement the voting module.

For example, as a user I want to sell a collection on Stargaze and use that collection and the proceeds from it to create and fund a DAO (with the DAO as the creator of the collection).

This "factory pattern" feature is intended to work with minters such as Stargaze minters or the WIP Augmented Bonding Curve tokens (or potentially other tokens such as LP tokens) which require a more complicated setup process. For these types of projects, the token is created through another contract that manages its issuance, the factory pattern is designed to support this. Factory contracts MUST set TokenFactoryCallback or NftFactoryCallback in the response.

An important note on security: as validation SHOULD happen in the factory contracts, it's important to rely only trusted factory contracts.

Overview of changes:

codecov[bot] commented 9 months ago

Codecov Report

Patch coverage: 55.09% and project coverage change: -0.30% :warning:

Comparison is base (3518a28) 96.65% compared to head (9b9df6a) 96.35%. Report is 1 commits behind head on development.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## development #750 +/- ## =============================================== - Coverage 96.65% 96.35% -0.30% =============================================== Files 186 203 +17 Lines 48253 49499 +1246 =============================================== + Hits 46637 47697 +1060 - Misses 1616 1802 +186 ``` | [Files Changed](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0) | Coverage Δ | | |---|---|---| | [...tracts/test/dao-proposal-hook-counter/src/error.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXByb3Bvc2FsLWhvb2stY291bnRlci9zcmMvZXJyb3IucnM=) | `0.00% <ø> (ø)` | | | [...ontracts/test/dao-proposal-hook-counter/src/msg.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXByb3Bvc2FsLWhvb2stY291bnRlci9zcmMvbXNnLnJz) | `66.66% <ø> (ø)` | | | [...tracts/test/dao-proposal-hook-counter/src/state.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXByb3Bvc2FsLWhvb2stY291bnRlci9zcmMvc3RhdGUucnM=) | `100.00% <ø> (ø)` | | | [contracts/test/dao-proposal-sudo/src/contract.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXByb3Bvc2FsLXN1ZG8vc3JjL2NvbnRyYWN0LnJz) | `68.51% <ø> (ø)` | | | [contracts/test/dao-proposal-sudo/src/error.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXByb3Bvc2FsLXN1ZG8vc3JjL2Vycm9yLnJz) | `0.00% <ø> (ø)` | | | [contracts/test/dao-proposal-sudo/src/msg.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXByb3Bvc2FsLXN1ZG8vc3JjL21zZy5ycw==) | `40.00% <ø> (ø)` | | | [...ontracts/test/dao-test-custom-factory/src/error.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXRlc3QtY3VzdG9tLWZhY3Rvcnkvc3JjL2Vycm9yLnJz) | `0.00% <0.00%> (ø)` | | | [...racts/test/dao-voting-cw20-balance/src/contract.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXZvdGluZy1jdzIwLWJhbGFuY2Uvc3JjL2NvbnRyYWN0LnJz) | `92.59% <ø> (ø)` | | | [...ontracts/test/dao-voting-cw20-balance/src/error.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXZvdGluZy1jdzIwLWJhbGFuY2Uvc3JjL2Vycm9yLnJz) | `100.00% <ø> (ø)` | | | [contracts/test/dao-voting-cw20-balance/src/msg.rs](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0#diff-Y29udHJhY3RzL3Rlc3QvZGFvLXZvdGluZy1jdzIwLWJhbGFuY2Uvc3JjL21zZy5ycw==) | `50.00% <ø> (ø)` | | | ... and [30 more](https://app.codecov.io/gh/DA0-DA0/dao-contracts/pull/750?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DA0-DA0) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] commented 9 months ago

Welcome to Codecov :tada:

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered :open_umbrella: