Skip to content

Commit

Permalink
feat: bring cosmwasm nft marketplace contract in monorepo
Browse files Browse the repository at this point in the history
history of previously called teritori-vault repo:

commit 75a692533b9188587ebfa909c5576376b8d65999
Author: yieldoption <[email protected]>
Date:   Thu Nov 3 23:26:23 2022 -0400

    gas optimization for nft vault contract (#6)

commit 0794cc77e08e1bc72c7d914ea391208dba25b9ca
Author: yieldoption <[email protected]>
Date:   Thu Nov 3 12:16:51 2022 -0400

    fix royalty query (#5)

commit f48c7fe8869f2d83dc61308ceb37c64d3bb7e4c6
Merge: 6d528f0 b11d308
Author: n0izn0iz <[email protected]>
Date:   Thu Oct 6 18:14:13 2022 +0200

    Merge pull request #4 from TERITORI/feature/royalty

    feature / royalty

commit b11d3082666d4a4df3dcef08a4e69d327ebf3be9
Author: yieldoption <[email protected]>
Date:   Wed Oct 5 22:02:29 2022 -0400

    cargo fmt

commit 6f284d07f205e3256d0a7db0c6da458f20aa38f3
Author: yieldoption <[email protected]>
Date:   Wed Oct 5 22:00:09 2022 -0400

    add cosmwasm binary

commit 01e4bbdef8968af5c94d3708202ea372bf2bb424
Author: yieldoption <[email protected]>
Date:   Wed Oct 5 21:58:16 2022 -0400

    update schema

commit 6ada5b2346d12f27a7680a69fc93df016898e0cc
Author: yieldoption <[email protected]>
Date:   Wed Oct 5 21:58:06 2022 -0400

    implement royalty feature

commit 6d528f06ee0d0a98daa5301578e495cf5386a62e
Merge: e3a2d0e 68b85a8
Author: n0izn0iz <[email protected]>
Date:   Tue Oct 4 16:24:19 2022 +0200

    Merge pull request #3 from TERITORI/ci

    chore: add ci checks

commit 68b85a80fdd602c22296eb6d8fe6703e7df6e943
Author: Norman Meier <[email protected]>
Date:   Tue Oct 4 16:20:25 2022 +0200

    chore: add ci checks

    Signed-off-by: Norman Meier <[email protected]>

commit e3a2d0e8f943445a44b085d1bbbac8f65d7e0d76
Author: yieldoption <[email protected]>
Date:   Mon Sep 26 22:37:32 2022 -0400

    add tests for nft vault contract

commit a04e44fe54ed798d96659098914af72a0c36d8f5
Merge: 8aad97c 48f7ba2
Author: n0izn0iz <[email protected]>
Date:   Tue Sep 13 01:00:08 2022 +0200

    Merge pull request #2 from TERITORI/schema-and-deploy

    chore: generate schema and deploy

commit 48f7ba2b07f6dcf220ff79b4ee9088e24b4b2c63
Author: Norman Meier <[email protected]>
Date:   Mon Sep 12 22:13:25 2022 +0200

    chore: generate schema and deploy

    Signed-off-by: Norman Meier <[email protected]>

commit 8aad97ceb33e93f5c605e930074019a80ed5abb1
Author: sarawut <[email protected]>
Date:   Wed Jun 8 19:24:19 2022 +0700

    upgrade cosmwasm version

commit aef4da7c70376056cef6e2dc9f2a6a758a9012c7
Merge: c610270 c80a675
Author: Yannis <[email protected]>
Date:   Thu Mar 10 18:04:51 2022 +0100

    Merge pull request #1 from POPSmartContract/fixed

    fix receivenft hook, save process

commit c80a675f2c92b2dea0f82e7a1ca050908ccfff26
Author: unknown <[email protected]>
Date:   Thu Mar 10 12:01:30 2022 -0500

    fix receivenft hook, save process

commit c6102700dd3a51706bd2f2a1ba1a1b2be5ca2cdf
Author: devstar <[email protected]>
Date:   Wed Mar 2 00:15:54 2022 +0700

    set initial price for deposit, transfer nft when buy

commit 20f335c01e44779ce8781d83d2a62bdad3272d42
Author: devstar <[email protected]>
Date:   Thu Feb 24 21:20:28 2022 +0700

    add fee withdraw function, query_all_nft_list in vault

commit 9963a9d7f413aed5942ee873283be6d0762ec533
Author: devstar <[email protected]>
Date:   Tue Feb 22 01:00:06 2022 +0700

    complete buy function, add more queries

commit 2fbcdcf01d2b335baff30783d444e6df2098d016
Author: devstar <[email protected]>
Date:   Thu Feb 10 20:08:30 2022 +0700

    initial vault contract
  • Loading branch information
n0izn0iz committed Feb 22, 2024
1 parent f05460c commit c234397
Show file tree
Hide file tree
Showing 37 changed files with 2,760 additions and 67 deletions.
14 changes: 10 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
/cosmwasm-contracts/*/schema/**/* linguist-generated
/packages/contracts-clients/**/* linguist-generated
/packages/api/**/* linguist-generated
/go/pkg/*pb/**/* linguist-generated
/packages/evm-contracts-clients/**/*.ts linguist-generated
/.expo-shared/assets.json linguist-generated
3 changes: 2 additions & 1 deletion .github/workflows/gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
with:
go-version: "1.19"

- uses: dtolnay/rust-toolchain@stable

- uses: bufbuild/[email protected]
with:
version: 1.28.0
Expand All @@ -33,7 +35,6 @@ jobs:
with:
ssh-private-key: |
${{ secrets.NFTS_DEPLOY_KEY }}
${{ secrets.VAULT_DEPLOY_KEY }}
${{ secrets.FOOTER_DEPLOY_KEY }}
${{ secrets.TNS_DEPLOY_KEY }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:

- uses: dtolnay/rust-toolchain@stable

- name: Build
run: make build.rust

- name: Test
run: make test.rust

Expand Down
72 changes: 36 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ BUNKER_MINTER_PACKAGE=teritori-bunker-minter
GO?=go
GOFMT?=$(shell $(GO) env GOROOT)/bin/gofmt

COSMWASM_CONTRACTS_DIR=cosmwasm-contracts
INTERNAL_COSMWASM_CONTRACTS=$(wildcard $(COSMWASM_CONTRACTS_DIR)/*)

TOKEN_REPO=teritori-nfts
TOKEN_PACKAGE=teritori-nft
SQUAD_STAKING_PACKAGE=teritori-squad-staking
Expand All @@ -15,9 +18,6 @@ NAME_SERVICE_PACKAGE=teritori-name-service
RIOTER_FOOTER_REPO=rioters-footer-nft
RIOTER_FOOTER_PACKAGE=rioter-footer-nft

VAULT_REPO=teritori-vault
VAULT_PACKAGE=teritori-nft-vault

ADDR_LIST_REPO=cw_addr_list
ADDR_LIST_PACKAGE=cw-address-list

Expand Down Expand Up @@ -89,26 +89,13 @@ docker.backend:
docker build . -f go/cmd/teritori-dapp-backend/Dockerfile -t teritori/teritori-dapp-backend:$(shell git rev-parse --short HEAD)

.PHONY: generate.contracts-clients
generate.contracts-clients: $(CONTRACTS_CLIENTS_DIR)/$(BUNKER_MINTER_PACKAGE) $(CONTRACTS_CLIENTS_DIR)/$(NAME_SERVICE_PACKAGE) $(CONTRACTS_CLIENTS_DIR)/$(RIOTER_FOOTER_PACKAGE) $(CONTRACTS_CLIENTS_DIR)/$(TOKEN_PACKAGE) $(CONTRACTS_CLIENTS_DIR)/$(VAULT_PACKAGE) $(CONTRACTS_CLIENTS_DIR)/cw721-membership
generate.contracts-clients: generate.internal-contracts-clients $(CONTRACTS_CLIENTS_DIR)/$(BUNKER_MINTER_PACKAGE) $(CONTRACTS_CLIENTS_DIR)/$(NAME_SERVICE_PACKAGE) $(CONTRACTS_CLIENTS_DIR)/$(RIOTER_FOOTER_PACKAGE) $(CONTRACTS_CLIENTS_DIR)/$(TOKEN_PACKAGE)

.PHONY: generate.go-networks
generate.go-networks: node_modules validate-networks
npx tsx packages/scripts/generateGoNetworks.ts | $(GOFMT) > go/pkg/networks/networks.gen.go
npx tsx packages/scripts/codegen/generateGoNetworkFeatures.ts | $(GOFMT) > go/pkg/networks/features.gen.go

.PHONY/: $(CONTRACTS_CLIENTS_DIR)/cw721-membership
$(CONTRACTS_CLIENTS_DIR)/cw721-membership: node_modules
rm -fr $@
cd cosmwasm-contracts/cw721-membership && cargo schema
npx cosmwasm-ts-codegen generate \
--plugin client \
--schema cosmwasm-contracts/cw721-membership/schema \
--out $@ \
--name cw721-membership \
--no-bundle
npx tsx packages/scripts/makeTypescriptIndex $@
touch $@

.PHONY: $(CONTRACTS_CLIENTS_DIR)/$(BUNKER_MINTER_PACKAGE)
$(CONTRACTS_CLIENTS_DIR)/$(BUNKER_MINTER_PACKAGE): node_modules
rm -fr $(CANDYMACHINE_REPO)
Expand Down Expand Up @@ -216,23 +203,6 @@ $(CONTRACTS_CLIENTS_DIR)/$(BREEDING_PACKAGE): node_modules
go fmt ./go/pkg/contracts/breeding_minter_types
rm -fr $(CANDYMACHINE_REPO)

.PHONY: $(CONTRACTS_CLIENTS_DIR)/$(VAULT_PACKAGE)
$(CONTRACTS_CLIENTS_DIR)/$(VAULT_PACKAGE): node_modules
rm -fr $(VAULT_REPO)
git clone [email protected]:TERITORI/$(VAULT_REPO).git
cd $(VAULT_REPO) && git checkout 75a692533b9188587ebfa909c5576376b8d65999
rm -fr $@
npx cosmwasm-ts-codegen generate \
--plugin client \
--schema $(VAULT_REPO)/contracts/nft-vault/schema \
--out $@ \
--name $(VAULT_PACKAGE) \
--no-bundle
mkdir -p go/pkg/contracts/vault_types
go run github.com/a-h/generate/cmd/[email protected] -i $(VAULT_REPO)/contracts/nft-vault/schema/execute_msg.json -o go/pkg/contracts/vault_types/execute_msg.go -p vault_types
go fmt ./go/pkg/contracts/vault_types
rm -fr $(VAULT_REPO)

.PHONY: $(CONTRACTS_CLIENTS_DIR)/$(ADDR_LIST_PACKAGE)
$(CONTRACTS_CLIENTS_DIR)/$(ADDR_LIST_PACKAGE): node_modules
rm -fr $(ADDR_LIST_REPO)
Expand Down Expand Up @@ -404,8 +374,38 @@ bump-app-build-number:

.PHONY: test.rust
test.rust:
cd cosmwasm-contracts/cw721-membership && cargo test
for file in $(INTERNAL_COSMWASM_CONTRACTS); do \
echo "> Testing $${file}" ; \
cd $${file} ; \
cargo test ; \
cd - ; \
done

.PHONY: build.rust
build.rust:
cd cosmwasm-contracts/cw721-membership && cargo wasm
for file in $(INTERNAL_COSMWASM_CONTRACTS); do \
echo "> Building $${file}" ; \
cd $${file} ; \
cargo wasm ; \
cd - ; \
done

.PHONY: generate.internal-contracts-clients
generate.internal-contracts-clients: node_modules
for indir in $(INTERNAL_COSMWASM_CONTRACTS) ; do \
echo "> Generating client for $${indir}" ; \
rm -fr $${indir}/schema ; \
(cd $${indir} && cargo schema && cd -) || exit 1 ; \
pkgname="$$(basename $${indir})" ; \
outdir="$(CONTRACTS_CLIENTS_DIR)/$${pkgname}" ; \
rm -fr $${outdir} ; \
npx cosmwasm-ts-codegen generate \
--plugin client \
--schema $${indir}/schema \
--out $${outdir} \
--name $${pkgname} \
--no-bundle \
|| exit 1 ;\
npx tsx packages/scripts/makeTypescriptIndex $${outdir} || exit 1 ; \
done

6 changes: 6 additions & 0 deletions cosmwasm-contracts/nft-marketplace/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
integration-test = "test --test integration"
schema = "run --example schema"
11 changes: 11 additions & 0 deletions cosmwasm-contracts/nft-marketplace/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.rs]
indent_size = 4
15 changes: 15 additions & 0 deletions cosmwasm-contracts/nft-marketplace/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build results
/target

# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327)
.cargo-ok

# Text file backups
**/*.rs.bk

# macOS
.DS_Store

# IDEs
*.iml
.idea
Loading

0 comments on commit c234397

Please sign in to comment.