In order to optimize your smart contracts, you have to use:
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 \
cosmwasm/workspace-optimizer:0.10.4
npx @cosmjs/cli@^0.23 --init contracts/cosmons/helpers.ts
For hackatom net, you need to use defaultOptions
in useOptions.
// Hackatom_V Net
const client = await useOptions(defaultOptions).setup(<YOUR PASSWORD>);
const partner = await useOptions(defaultOptions).setup(<YOUR PASSWORD>, "/Users/user/.hackatom2.key");
// localnet
const client = await useOptions(localnetOptions).setup(<YOUR PASSWORD>, "/Users/user/localnet.key");
const partner = await useOptions(localnetOptions).setup(<YOUR PASSWORD>, "/Users/user/localnet2.key");
const address = client.senderAddress;
const partnerAddr = partner.senderAddress;
const cw721 = CW721(client);
client.getAccount()
partner.getAccount()
You can skip this section if followed this transcript up until here.
const fred = "cosmos1rgd5jtgp22vq44xz4c69x5z9mu0q92ujcnqdgw";
const bob = "cosmos1exmd9ml0adgkuggd6knqcjgw4e3x84r4hhfr07";
Query accounts:
wasmcli query account $(wasmcli keys show -a fred)
wasmcli query account $(wasmcli keys show -a vhx)
const codeId = <your CodeID>; // wasmcli q wasm list-code & find your contract ID
const initMsg = { name: "Cosmons", symbol: "mons", minter: address };
const contract = await client.instantiate(codeId, initMsg, "Virtual Cosmons 1");
OR
const contract = client.getContracts(<your codeID>); // And check for your contractAddress
const mine = cw721.use(contract.contractAddress);
mine.mint("monster112a9lf95atqvyejqe22xnna8x4mfqd75tkq2kvwcjyysarcsb", address, "Cosmos", "Minted Cosmon!");
⚠️ Needs to be called beforetransferNft
.
mine.approve(address, "monster112a9lf95atqvyejqe22xnna8x4mfqd75tkq2kvwcjyysarcsb");
⚠️ transferNft
will not work after usingrevoke
.
mine.revoke(address, "monster112a9lf95atqvyejqe22xnna8x4mfqd75tkq2kvwcjyysarcsb");
⚠️ Needs to be called afterapprove
.
mine.transferNft(partnerAddr, "monster112a9lf95atqvyejqe22xnna8x4mfqd75tkq2kvwcjyysarcsb");
mine.nftInfo("monster112a9lf95atqvyejqe22xnna8x4mfqd75tkq2kvwcjyysarcsb")
mine.ownerOf("monster112a9lf95atqvyejqe22xnna8x4mfqd75tkq2kvwcjyysarcsb")
mine.numTokens()
mine.tokens(address, "", 10)
mine.allNftInfo("monster112a9lf95atqvyejqe22xnna8x4mfqd75tkq2kvwcjyysarcsb")
mine.allTokens("", 10)
Faucet is not supported.
This repo contains two license, Apache 2.0 and
AGPL 3.0. All crates in this repo may be licensed
as one or the other. Please check the NOTICE
in each crate or the
relevant Cargo.toml
file for clarity.
All specifications will always be Apache-2.0. All contracts that are meant to be building blocks will also be Apache-2.0. This is along the lines of Open Zepellin or other public references.
Contracts that are "ready to deploy" may be licensed under AGPL 3.0 to encourage anyone using them to contribute back any improvements they make. This is common practice for actual projects running on Ethereum, like Uniswap or Maker DAO.