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

CW-1155 (and royalties extension) #162

Open
wants to merge 59 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
2b1ba1b
feat: add cw1155-base
ALPAC-4 Aug 17, 2022
26122c8
feat: add cw1155-metadata-onchain
ALPAC-4 Aug 18, 2022
78746b0
feat: add jobs for cw1155
ALPAC-4 Aug 18, 2022
8fe5edb
fix: fix spaceing
ALPAC-4 Aug 18, 2022
b70c8dc
fix: add jobs to test and add package_cw1155
ALPAC-4 Aug 18, 2022
5e3fd48
add schema
ALPAC-4 Aug 18, 2022
753cb6b
fix: add package schema, fix typo
ALPAC-4 Aug 18, 2022
adeb7cf
trivial
apolloshab Apr 30, 2024
d822a4f
fix: split up transfer event into relevant action events.
apolloshab May 1, 2024
42a4499
fix: bring back ApprovedForAll and IsApprovedForAll queries (part of …
apolloshab May 2, 2024
159c79e
Cw1155 Approve/Revoke single (#3)
apolloshab May 3, 2024
ad05092
refactor: moves cw1155 messages to package, renames messages to close…
apolloshab May 3, 2024
823639f
fix: mint logic
apolloshab May 3, 2024
71a1f2a
fix: rename events to be in format *_single and *_batch
apolloshab May 3, 2024
5875ad0
fix: schema files
apolloshab May 3, 2024
e107869
feat: implement mint_batch
apolloshab May 3, 2024
ed56d0a
feat: implements contract_info, minter, and ownership queries.
apolloshab May 3, 2024
d8e7f76
feat: query all_token_infos
apolloshab May 4, 2024
0f49674
feat: store and query total supply (sum of all token balances)
apolloshab May 4, 2024
e42a811
fix: use library feature in cw721-base import
apolloshab May 6, 2024
b2c060c
fix: store total supply in base instantiate.
apolloshab May 6, 2024
56e4bc3
fix: cw1155-metadata tests
apolloshab May 6, 2024
6635fa3
feat: cw1155 on-chain royalties extension
apolloshab May 6, 2024
00c7b19
fix: existing tests/imports
apolloshab May 6, 2024
8f9afd2
fix: generic usage
apolloshab May 6, 2024
c048017
chore: lint
apolloshab May 6, 2024
be21d01
chore: clippy
apolloshab May 6, 2024
65ab7d4
fix: lint 2, add circle ci config for cw1155-royalties
apolloshab May 6, 2024
09f471d
fix: circle ci
apolloshab May 6, 2024
68960bb
fix: circle ci lint
apolloshab May 7, 2024
85e5d47
fix: move cosmwasm-schema to deps in metadata extension
apolloshab May 7, 2024
6f5e9f5
fix: clippy
apolloshab May 7, 2024
4c7600e
adds custom execute extension and response generics to Cw1155Contract…
apolloshab May 22, 2024
c00a913
impl cw_ownable_execute on cw1155.
apolloshab May 23, 2024
1d3b795
fix: cargo schema
apolloshab May 23, 2024
32c6e41
fix: cargo schema package
apolloshab May 23, 2024
cfa0c08
chore: merge queries num_tokens/supply
apolloshab May 23, 2024
3751bf6
fix query BalanceOfBatch
apolloshab Jun 5, 2024
3609e4a
make state mod public
apolloshab Jul 1, 2024
5acfcbf
rename AllBalancesResponse to BalancesResponse and return as response…
apolloshab Jul 3, 2024
d1e6c9d
remove query AllTokenInfo
apolloshab Jul 3, 2024
07105d8
transfer funds along with send/batch_send
apolloshab Jul 3, 2024
46136ba
Merge upstream (#4)
apolloshab Jul 8, 2024
1e1108d
Merge branch 'main' of github.com:CosmWasm/cw-nfts into cw1155
apolloshab Jul 9, 2024
f142b3b
add more tests
apolloshab Jul 9, 2024
9dbbc6e
add sender/owner to transfer/mint/burn events
apolloshab Jul 23, 2024
49d70aa
implement update_metadata() for updating exension/token_uri. not on b…
apolloshab Jul 23, 2024
e076bd1
clippy
apolloshab Jul 23, 2024
de3e709
change events to be attributes under wasm like cw721 has
apolloshab Jul 24, 2024
f0e2812
use same collection key as cw721
apolloshab Jul 24, 2024
45fc627
zero amount check
apolloshab Jul 24, 2024
5b88809
use rust version 1.75
apolloshab Jul 25, 2024
3ba9341
add Cw2981QueryExtensionMsg for convenience (possibly also to add bac…
apolloshab Aug 9, 2024
1ac8336
fixes cw2981 extension query msg
apolloshab Aug 9, 2024
2d0420f
fix cw2981 entry mod
apolloshab Aug 9, 2024
501bfcf
adds query OwnersOf - gets balances of owners of a token id, and also…
apolloshab Aug 16, 2024
76a30e0
error instead of take min when transferring tokens with amount > than…
apolloshab Aug 16, 2024
76700c1
Merge branch 'main' of github.com:CosmWasm/cw-nfts into cw1155
apolloshab Aug 23, 2024
58e692b
bump rust version in ci
apolloshab Aug 23, 2024
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
112 changes: 112 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ workflows:
version: 2
test:
jobs:
- contract_cw1155_base
- contract_cw1155_royalties
- contract_cw721_base
- contract_cw721_expiration
- contract_cw721_fixed_price
- contract_cw721_receiver_tester
- package_cw721
- package_cw1155
- lint
- wasm-build
deploy:
Expand Down Expand Up @@ -189,6 +192,115 @@ jobs:
- target
key: cargocache-v2-cw721:1.64.0-{{ checksum "~/project/Cargo.lock" }}

contract_cw1155_base:
docker:
- image: rust:1.78.0
working_directory: ~/project/contracts/cw1155-base
steps:
- checkout:
path: ~/project
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-cw1155-base-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
RUST_BACKTRACE: 1
command: cargo unit-test --locked
- run:
name: Build and run schema generator
command: cargo schema --locked
- run:
name: Ensure checked-in schemas are up-to-date
command: |
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
git status && git --no-pager diff
exit 1
fi
- save_cache:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-cw1155-base-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}

contract_cw1155_royalties:
docker:
- image: rust:1.78.0
working_directory: ~/project/contracts/cw1155-royalties
steps:
- checkout:
path: ~/project
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-cw1155-royalties-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
RUST_BACKTRACE: 1
command: cargo unit-test --locked
- run:
name: Build and run schema generator
command: cargo schema --locked
- run:
name: Ensure checked-in schemas are up-to-date
command: |
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
git status && git --no-pager diff
exit 1
fi
- save_cache:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-cw1155-royalties-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}

package_cw1155:
docker:
- image: rust:1.78.0
working_directory: ~/project/packages/cw1155
steps:
- checkout:
path: ~/project
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version; rustup target list --installed
- restore_cache:
keys:
- cargocache-v2-cw1155:1.78.0-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Build library for native target
command: cargo build --locked
- run:
name: Run unit tests
command: cargo test --locked
- run:
name: Build and run schema generator
command: cargo schema --locked
- run:
name: Ensure schemas are up-to-date
command: |
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
git status && git --no-pager diff
exit 1
fi
- save_cache:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-v2-cw1155:1.78.0-{{ checksum "~/project/Cargo.lock" }}

lint:
docker:
- image: rust:1.78.0
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ artifacts/
# code coverage
tarpaulin-report.*

# raw json schema files
**/raw/*.json
# json schema files
**/schema/**/*.json
48 changes: 48 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ cw721-base-016 = { git = "https://github.com/CosmWasm/cw-nfts", tag = "v0.16.0"
cw721-metadata-onchain-016 = { git = "https://github.com/CosmWasm/cw-nfts", tag = "v0.16.0", package = "cw721-metadata-onchain" } # needed for testing legacy migration
cw721-base-017 = { git = "https://github.com/CosmWasm/cw-nfts", tag = "v0.17.0", package = "cw721-base" } # needed for testing legacy migration
cw721-base-018 = { git = "https://github.com/CosmWasm/cw-nfts", tag = "v0.18.0", package = "cw721-base" } # needed for testing legacy migration
cw1155 = { path = "./packages/cw1155", version = "*" }
cw1155-base = { path = "./contracts/cw1155-base", version = "*" }
cw-multi-test = { version = "^0.20", features = ["cosmwasm_1_2"] }
cw-ownable = { git = "https://github.com/public-awesome/cw-plus-plus.git", rev = "28c1a09bfc6b4f1942fefe3eb0b50faf9d3b1523"} # TODO: switch to official https://github.com/larry0x/cw-plus-plus once merged
cw-paginate-storage = { version = "^2.4", git = "https://github.com/DA0-DA0/dao-contracts.git" }
Expand Down
10 changes: 5 additions & 5 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ skip_core_tasks = true

[tasks.fmt]
command = "cargo"
args = ["fmt", "--all", "--check"]
args = ["fmt", "--all", "--check"]

[tasks.test]
command = "cargo"
args = ["test", "--locked"]
args = ["test", "--locked"]

[tasks.lint]
command = "cargo"
args = ["clippy", "--tests", "--", "-D", "warnings"]
args = ["clippy", "--tests", "--", "-D", "warnings"]

[tasks.build]
command = "cargo"
args = ["build", "--release", "--locked", "--target", "wasm32-unknown-unknown"]
args = ["build", "--release", "--locked", "--target", "wasm32-unknown-unknown"]

[tasks.optimize]
# https://hub.docker.com/r/cosmwasm/workspace-optimizer/tags https://hub.docker.com/r/cosmwasm/workspace-optimizer-arm64/tags
Expand All @@ -32,7 +32,7 @@ fi
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
${image}:0.16.0
${image}:0.15.1
"""

[tasks.schema]
Expand Down
5 changes: 5 additions & 0 deletions contracts/cw1155-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/cw1155-base/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "cw1155-base"
authors = ["shab <dirtyshab@protonmail.com>"]
description = "Basic implementation cw1155"
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
documentation = { workspace = true }

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"artifacts/*",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[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]
cw-utils = { workspace = true }
cw2 = { workspace = true }
cw1155 = { workspace = true }
cw721 = { workspace = true }
cw721-base = { workspace = true, features = ["library"] }
cw-ownable = { workspace = true }
cw-storage-plus = { workspace = true }
cosmwasm-std = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true }
cosmwasm-schema = { workspace = true }
12 changes: 12 additions & 0 deletions contracts/cw1155-base/examples/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use cosmwasm_schema::write_api;
use cw1155::msg::Cw1155InstantiateMsg;

use cw1155_base::{Cw1155BaseExecuteMsg, Cw1155BaseQueryMsg};

fn main() {
write_api! {
instantiate: Cw1155InstantiateMsg,
execute: Cw1155BaseExecuteMsg,
query: Cw1155BaseQueryMsg,
}
}
Loading