Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/cargo/cw721-base-91ac132
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 17, 2023
2 parents 9894524 + c4f0eda commit 930dd94
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 38 deletions.
64 changes: 32 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [
# Cosmwasm related dependencies
cosmwasm-std = "1.1.9"
cosmwasm-storage = "1.1.9"
cosmwasm-schema = "1.2.2"
cosmwasm-schema = "1.2.7"
cw-storage-plus = "0.16.0"
cw-utils = "0.16.0"
cw2 = "0.16.0"
Expand All @@ -16,8 +16,8 @@ cw-multi-test = "0.15.1"
desmos-bindings = "1.1.1"
# Misc dependencies
schemars = "0.8.12"
serde = "1.0.159"
thiserror = "1.0.40"
serde = "1.0.160"
thiserror = "1.0.43"

[profile.release]
opt-level = 3
Expand Down
2 changes: 1 addition & 1 deletion contracts/poap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ serde = { workspace = true, default-features = false, features = ["derive"] }
thiserror.workspace = true
desmos-bindings = { workspace = true, default-features = false, features = ["query", "msg"]}
cw721-base = { git = "https://github.com/desmos-labs/cw-nfts", features = ["library"], branch = "paul/update-custom-msg-query" }
url = "2.3.1"
url = "2.4.0"
cw721-poap = { path = "../cw721-poap", version = "0.1.0", features = ["library"]}
cw721 = { git = "https://github.com/desmos-labs/cw-nfts", branch = "paul/update-custom-msg-query" }
cosmwasm-schema.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions contracts/remarkables/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ desmos-bindings = { workspace = true, default-features = false, features = ["que
cw721-base = { git = "https://github.com/desmos-labs/cw-nfts", features = ["library"], branch = "paul/update-custom-msg-query" }
cw-utils.workspace = true
cw721 = { git = "https://github.com/desmos-labs/cw-nfts", branch = "paul/update-custom-msg-query" }
url = "2.3.1"
url = "2.4.0"
cw721-remarkables = { path = "../cw721-remarkables", version = "0.1.0", features = ["library"]}
cosmwasm-schema.workspace = true

[dev-dependencies]
cw-multi-test.workspace = true
desmos-bindings = { workspace = true, default-features = false, features = ["mocks"] }
anyhow = "1.0.70"
anyhow = "1.0.71"
122 changes: 122 additions & 0 deletions docs/architecture/adr-006-poap-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# ADR 006: POAP v2 Contract

## Changelog

- Jul 11, 2023: Initial draft;

## Status

PROPOSED Not Implemented

## Abstract

This ADR defines the new architecture of a POAP v2 Smart Contract that will replace the
current `cw721-poap`, `poap-manager`, and `poap` smart contracts.

## Context

The name POAP stands for Proof of Attendance Protocol, which is a simple NFT that attests to the fact that a user has
participated in a particular event.

Currently, we have implemented the ability to create and manage POAPs with three smart
contracts: `cw721-poap`, `poap-manager`, and `poap`. Although this division works and makes sense under the Single
Responsibility Principle, there are several downsides to it. First, users can easily upload and instantiate multiple
instances of each of those contracts, leading to an unnecessary amount of contracts on the chain. Second, it makes it
harder for newcomers to understand the interactions between the three contracts. Lastly, having multiple smart contracts
for something as simple as a POAP seems excessive, as ideally, a POAP should have minimal operations.

## Decision

The decision is to merge all POAP-related operations into a single smart contract called `poap`, replacing all existing
POAP-related smart contracts.

## Specifications

To ensure compatibility with the [`cw721`](https://github.com/CosmWasm/cw-nfts/blob/main/packages/cw721) standard, we
will create a smart contract that extends
the [`cw721-base`](https://github.com/CosmWasm/cw-nfts/tree/main/contracts/cw721-base) contract and implements the
necessary interfaces. By doing this, we can enable the transfer of POAPs in the future, if desired by the
administrators, and ensure proper display in end clients. The following specifications outline the custom messages that
the `poap` contract should support.

### Messages

#### Instantiate

To instantiate this smart contract, the user needs to provide:

| Variable | Type | Description |
|:-------------------:|:-------:|:--------------------------------------------------------------------------------------------------------------------------------------------|
| `admin` | Address | Identifies the user that controls the contract |
| `poap_name` | String | Identifies the name of the minted NFTs |
| `poap_symbol` | String | Identifies the symbol of the minted NFTs |
| `poap_metadata_uri` | String | Identifies the URI where users can view the associated metadata for the POAPs, ideally following the ERC-721 metadata scheme in a JSON file |

The user can also provide the following:

| Variable | Type | Default | Description |
|:----------------------:|:---------:|:---------:|:----------------------------------------------------------------------------------------------------------------------|
| `minter` | Address | Undefined | Additional address that is allowed to mint tokens on behalf of other users |
| `poap_is_transferable` | Boolean | `False` | Specifies whether each POAP can be transferred from one user to another |
| `poap_is_mintable` | Boolean | `True` | Indicates whether users can mint the POAPs |
| `poap_mint_start_time` | Timestamp | Undefined | Identifies the timestamp at which the minting of the POAP will be enabled. If not set, the minting is always enabled. |
| `poap_mint_end_time` | Timestamp | Undefined | Identifies the timestamp at which the minting of the POAP will be disabled. If not set, the minting will never end. |

#### Execute

The `MsgExecute` should allow the following operations:

##### User operations

Operations allowed for any user:

1. Mint a new POAP if the minting conditions are met.
2. Transfer a POAP they own to another user if transferring is allowed.
3. Burn a POAP they own.

##### Minter operations

If set, the `minter` associated with the contract should be allowed to perform the following:

1. Mint POAPs for a single user (`mintToSingleUser`).
2. Mint POAPs for multiple users (`mintToManyUsers`).

> **Note**
> The `minter` is not subject to the POAP minting conditions. This means that they act like an admin and can mint
> tokens for other users even if the minting of the POAP is currently disabled.
##### Admin operations

The admin of the contract should be allowed to perform the following:

1. Update the `minter` address.
2. Update the POAP-related limitations (transferability, mintability).

## Consequences

### Positive

* By consolidating everything into a single smart contract, managing POAP instances becomes easier for users.
* Most open issues regarding the POAP system can be resolved, making it more versatile.

### Negative

* Users of the current POAP smart contracts may need to migrate to the new contract to access future support for new
features.

### Neutral

(None known)

## References

* [Cw721 Standard](https://github.com/CosmWasm/cw-nfts/blob/main/packages/cw721)
* [Cw721 Base Contract](https://github.com/CosmWasm/cw-nfts/tree/main/contracts/cw721-base)
* [Issue #182](https://github.com/desmos-labs/desmos-contracts/issues/182)
* [Issue #183](https://github.com/desmos-labs/desmos-contracts/issues/183)
* [Issue #184](https://github.com/desmos-labs/desmos-contracts/issues/184)
* [Issue #185](https://github.com/desmos-labs/desmos-contracts/issues/185)
* [Issue #186](https://github.com/desmos-labs/desmos-contracts/issues/186)
* [Issue #187](https://github.com/desmos-labs/desmos-contracts/issues/187)
* [Issue #188](https://github.com/desmos-labs/desmos-contracts/issues/188)
* [Issue #189](https://github.com/desmos-labs/desmos-contracts/issues/189)

0 comments on commit 930dd94

Please sign in to comment.