Skip to content

Commit

Permalink
nft-launchpad contract config, new instantiate
Browse files Browse the repository at this point in the history
  • Loading branch information
WaDadidou committed Oct 16, 2024
1 parent 29939e6 commit 2a5d101
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 19 deletions.
4 changes: 2 additions & 2 deletions networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -11671,9 +11671,9 @@
},
{
"type": "NFTLaunchpad",
"launchpadContractAddress": "tori1apvccnnpduysm9236czxarzf8cme6f049ykf34ypu6eencx7gyhsve0fsf",
"launchpadContractAddress": "tori1dqy2areatyu6372d67a25t494x63n046qd83dyzrwl73yrnuky4qg8fqsh",
"launchpadEndpoint": "https://dapp-backend.testnet.teritori.com",
"codeId": 59,
"codeId": 61,
"defaultMintDenom": "utori"
}
],
Expand Down
4 changes: 2 additions & 2 deletions packages/networks/teritori-testnet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const nftsBurnerFeature: CosmWasmNFTsBurner = {
const cosmwasmLaunchpadFeature: CosmWasmLaunchpad = {
type: NetworkFeature.NFTLaunchpad,
launchpadContractAddress:
"tori1apvccnnpduysm9236czxarzf8cme6f049ykf34ypu6eencx7gyhsve0fsf",
"tori1dqy2areatyu6372d67a25t494x63n046qd83dyzrwl73yrnuky4qg8fqsh",
launchpadEndpoint: "https://dapp-backend.testnet.teritori.com",
codeId: 59,
codeId: 61,
defaultMintDenom: "utori",
};

Expand Down
48 changes: 36 additions & 12 deletions rust/cw-contracts/nft-launchpad/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
ADMIN=testnet-adm
ADMIN_ADDR=$(shell teritorid keys show $(ADMIN) --keyring-backend test --output json | jq -r .address)
NODE_FLAG=--node https://rpc.testnet.teritori.com:443
TX_FLAGS=--from $(ADMIN) --chain-id teritori-test-7 $(NODE_FLAG) --gas auto --gas-adjustment 1.3 -y -b sync --output json --keyring-backend test -o json
QUERY_FLAGS=$(NODE_FLAG) -o json
CODE_ID=59
CONFIG=$(shell cat config.json | jq -r '.owner="$(ADMIN_ADDR)" | tojson | @sh')
ADMIN_TESTNET=testnet-adm
ADMIN_ADDR_TESTNET=$(shell teritorid keys show $(ADMIN_TESTNET) --keyring-backend test --output json | jq -r .address)
NODE_FLAG_TESTNET=--node https://rpc.testnet.teritori.com:443
TX_FLAGS_TESTNET=--from $(ADMIN_TESTNET) --chain-id teritori-test-7 $(NODE_FLAG_TESTNET) --gas auto --gas-adjustment 1.3 -y -b sync --output json --keyring-backend test -o json
QUERY_FLAGS_TESTNET=$(NODE_FLAG_TESTNET) -o json
CODE_ID_TESTNET=61
CONFIG_TESTNET=$(shell cat config.json | jq -r '.owner="$(ADMIN_ADDR_TESTNET)" | tojson | @sh')

ADMIN_MAINNET=mainnet-adm
ADMIN_ADDR_MAINNET=$(shell teritorid keys show $(ADMIN_MAINNET) --output json | jq -r .address)
NODE_FLAG_MAINNET=--node https://rpc.mainnet.teritori.com:443
# --keyring-backend os by default
TX_FLAGS_MAINNET=--from $(ADMIN_MAINNET) --chain-id teritori-1 $(NODE_FLAG_MAINNET) --gas auto --gas-adjustment 1.3 -y -b sync --output json -o json
QUERY_FLAGS_MAINNET=$(NODE_FLAG_MAINNET) -o json
CODE_ID_MAINNET=
CONFIG_MAINNET=$(shell cat config-mainnet.json | jq -r '.owner="$(ADMIN_ADDR_MAINNET)" | tojson | @sh')

WORKSPACE_PATH := $(shell realpath $(shell dirname $(shell pwd))/../..)

# only informative
# CONTRACT_ADDRESS=tori1apvccnnpduysm9236czxarzf8cme6f049ykf34ypu6eencx7gyhsve0fsf
# CONTRACT_ADDRESS_TESTNET=tori1dqy2areatyu6372d67a25t494x63n046qd83dyzrwl73yrnuky4qg8fqsh
# CONTRACT_ADDRESS_MAINNET=

.PHONY: artifacts/nft_launchpad.wasm
artifacts/nft_launchpad.wasm:
Expand All @@ -21,11 +32,24 @@ artifacts/nft_launchpad.wasm:
.PHONY: deploy.testnet
deploy.testnet: artifacts/nft_launchpad.wasm
set -o pipefail; \
TXHASH=$$(teritorid tx wasm store $(WORKSPACE_PATH)/artifacts/nft_launchpad.wasm $(TX_FLAGS) | jq -r .txhash); \
while ! teritorid query tx $$TXHASH $(QUERY_FLAGS) 2>/dev/null | jq -r '.logs[0].events[] | select(.type=="store_code").attributes[] | select(.key=="code_id").value'; do sleep 1; done
TXHASH=$$(teritorid tx wasm store $(WORKSPACE_PATH)/artifacts/nft_launchpad.wasm $(TX_FLAGS_TESTNET) | jq -r .txhash); \
while ! teritorid query tx $$TXHASH $(QUERY_FLAGS_TESTNET) 2>/dev/null | jq -r '.logs[0].events[] | select(.type=="store_code").attributes[] | select(.key=="code_id").value'; do sleep 1; done

.PHONY: instantiate.testnet
instantiate.testnet: config.json
set -o pipefail; \
TXHASH=$$(teritorid tx wasm instantiate $(CODE_ID) $(CONFIG) --label NftLaunchpad --admin $(ADMIN_ADDR) $(TX_FLAGS) | jq -r .txhash); \
while ! teritorid query tx $$TXHASH $(QUERY_FLAGS) 2>/dev/null | jq -r '.logs[0].events[] | select(.type=="instantiate").attributes[] | select(.key=="_contract_address").value'; do sleep 1; done
TXHASH=$$(teritorid tx wasm instantiate $(CODE_ID_TESTNET) $(CONFIG_TESTNET) --label NftLaunchpad --admin $(ADMIN_ADDR_TESTNET) $(TX_FLAGS_TESTNET) | jq -r .txhash); \
while ! teritorid query tx $$TXHASH $(QUERY_FLAGS_TESTNET) 2>/dev/null | jq -r '.logs[0].events[] | select(.type=="instantiate").attributes[] | select(.key=="_contract_address").value'; do sleep 1; done

.PHONY: deploy.mainnet
deploy.mainnet: artifacts/nft_launchpad.wasm
set -o pipefail; \
TXHASH=$$(teritorid tx wasm store $(WORKSPACE_PATH)/artifacts/nft_launchpad.wasm $(TX_FLAGS_MAINNET) | jq -r .txhash); \
while ! teritorid query tx $$TXHASH $(QUERY_FLAGS_MAINNET) 2>/dev/null | jq -r '.logs[0].events[] | select(.type=="store_code").attributes[] | select(.key=="code_id").value'; do sleep 1; done

.PHONY: instantiate.mainnet
instantiate.mainnet: config-mainnet.json
set -o pipefail; \
TXHASH=$$(teritorid tx wasm instantiate $(CODE_ID_MAINNET) $(CONFIG_MAINNET) --label NftsBurner --admin $(ADMIN_ADDR_MAINNET) $(TX_FLAGS_MAINNET) | jq -r .txhash); \
while ! teritorid query tx $$TXHASH $(QUERY_FLAGS_MAINNET) 2>/dev/null | jq -r '.logs[0].events[] | select(.type=="instantiate").attributes[] | select(.key=="_contract_address").value'; do sleep 1; done

9 changes: 9 additions & 0 deletions rust/cw-contracts/nft-launchpad/config-mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"config": {
"name": "NFT Launchpad",
"supported_networks": ["teritori"],
"owner": "",
"deployer": "",
"nft_code_id": 0
}
}
7 changes: 4 additions & 3 deletions rust/cw-contracts/nft-launchpad/config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"config": {
"name": "NFT Launchpad",
"supported_networks": ["teritori", "teritori-testnet"],
"owner": "tori1kjvyqf4mttwrhfuq5gfj9xgxx9jdt92xnxzf770x853567ymx8cscrnw05",
"deployer": "tori1kjvyqf4mttwrhfuq5gfj9xgxx9jdt92xnxzf770x853567ymx8cscrnw05"
"supported_networks": ["teritori-testnet"],
"owner": "tori1llmym9upcpwnz7qte856ghlp5437ezz2gg7z0q",
"deployer": "tori1kjvyqf4mttwrhfuq5gfj9xgxx9jdt92xnxzf770x853567ymx8cscrnw05",
"nft_code_id": 60
}
}

0 comments on commit 2a5d101

Please sign in to comment.