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

WIP: CW5144-base and CW5144 Package #128

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cosmwasm-std = "1.2.1"
cw2 = { git = "https://github.com/mars-protocol/cw-plus", rev = "1a3a944" }
cw20 = "1.0.1"
cw721 = { version = "0.17.0", path = "./packages/cw721" }
cw5144 = {version = "0.17.0", path = "./packages/cw5144" }
cw721-base = { version = "0.17.0", path = "./contracts/cw721-base" }
cw721-base-016 = { version = "0.16.0", package = "cw721-base" }
cw-multi-test = "0.16.2"
Expand Down
5 changes: 5 additions & 0 deletions contracts/cw5144-base/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
38 changes: 38 additions & 0 deletions contracts/cw5144-base/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "cw5144-base"
description = "Basic implementation of Sould Bound Tokens"
authors = [
"Georges Chouchani <georges@athenaconsulting.io>",
]
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
documentation = { workspace = true }
rust-version = { workspace = true }

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-ownable = { workspace = true }
cw-storage-plus = { workspace = true }
cw-utils = { workspace = true }
cw2 = { workspace = true }
cw5144 = { workspace = true }
cw721-base-016 = { workspace = true, features = ["library"] }
schemars = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
cw-multi-test = { workspace = true }
33 changes: 33 additions & 0 deletions contracts/cw5144-base/MIGRATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## 0.16 -> 0.17

The minter has been replaced by an owner which is updatable via the
two-step ownership transfer process of
[cw_ownable](https://crates.io/crates/cw-ownable). To retreive the
owner, `QueryMsg::Ownership {}` may be executed.

`QueryMsg::Minter {}` has not bee removed, though after version 0.16
the response type has made the minter field optional as it may be
unset. For all intents and purposes, whenever the word minter is used,
it means owner, and owner in turn means minter, minter iff owner.

Before 0.16:

```rust
pub struct MinterResponse {
pub minter: String,
}
```

After 0.16:

```rust
pub struct MinterResponse {
pub minter: Option<String>,
}
```

NFTs on version 0.16 may migrate to the new version. For an example of
doing so, see
[this](https://github.com/CosmWasm/cw-nfts/blob/zeke/updatable-minter/contracts/cw721-base/src/multi_tests.rs#L83)
integration test.

14 changes: 14 additions & 0 deletions contracts/cw5144-base/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Cw721_base
Copyright (C) 2020-2021 Confio OÜ

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
18 changes: 18 additions & 0 deletions contracts/cw5144-base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# CW5144 Base

This is a basic implementation of a Soul Bound Token CW5144 contract,
created from the (ERC-5144 specification)[https://eips.ethereum.org/EIPS/eip-5114].

It is used to create a non-fungible soul bound token that cannot be transferred or altered with and
is bound to another NFT (which is called here a `soul`).

Therefor, in this contract, the owner of an SBT is an NFT rather than a address/contract, which
is specified using the contract address and the token_id of a certain NFT. The reason is that if a
`soul` moves from one address to another, all its SBTs are still attached to it, while it is not the case
if the owner of an SBT was an address.






12 changes: 12 additions & 0 deletions contracts/cw5144-base/examples/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use cosmwasm_schema::write_api;
use cosmwasm_std::Empty;

use cw5144_base::{ExecuteMsg, InstantiateMsg, QueryMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg,
execute: ExecuteMsg<Empty, Empty>,
query: QueryMsg<Empty>,
}
}