CosmWasm / cw-plus

Production Quality contracts under open source licenses
Apache License 2.0
506 stars 351 forks source link

Unable to upload cw20_base wasm file on terra-station #716

Closed Odelya closed 1 year ago

Odelya commented 2 years ago

I am trying to upload an optimized version of cw20_base contract to my localterra like this:

 const terra = new LCDClient({URL: 'http://localhost:1317', chainID: 'localterra',});
  const wallet = terra.wallet(mk);
  const storeCode = new MsgStoreCode(
    wallet.key.accAddress,
    fs.readFileSync('../artifacts/cs20_base.wasm').toString('base64'),
  );

  const storeCodeTx = await wallet.createAndSignTx({msgs: [storeCode]});

However, I am getting:

*code: 3, message: 'failed to execute message; message index: 0: Error calling the VM: Error during static Wasm validation: Wasm contract has unknown interfaceversion marker export (see https://github.com/CosmWasm/cosmwasm/blob/main/packages/vm/README.md): store wasm contract failed: invalid request',**

is it working with terra network? if so, how?

Odelya commented 2 years ago

I checkout to tag v0.9.2 which depends on cosmwasm-std version = "0.16.0" and now it works. It could be related to that library. What do you suggest to do?

octalmage commented 2 years ago

Terra is on CosmWasm 0.16 which means you’ll need to use branch 0.9.x

taitruong commented 2 years ago

I am all new to this and have the same issue. Trying this example: https://github.com/terran6/nft-on-terra

My Cargo.toml file uses cw-plus v0.9.2 and CosmWasm 0.16.0. It looks like this: https://github.com/terran6/nft-on-terra/blob/master/contracts/cw721-metadata-onchain/Cargo.toml

 ...
name = "cw721-metadata-onchain"
version = "0.9.2"
authors = ["Ethan Frey <ethanfrey@users.noreply.github.com>"]
edition = "2018"
description = "Example extending CW721 NFT to store metadata on chain"
license = "Apache-2.0"
repository = "https://github.com/CosmWasm/cw-plus"
homepage = "https://cosmwasm.com"
documentation = "https://docs.cosmwasm.com"
...
[lib]
crate-type = ["cdylib", "rlib"]

[package.metadata.scripts]
optimize = """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/rust-optimizer:0.12.5
"""

[features]
backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cw721 = { version = "0.9.2" }
cw721-base = {version = "0.9.2", features = ["library"] }
cosmwasm-std = { version = "0.16.0" }
schemars = "0.8.1"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.23" }

[dev-dependencies]
cosmwasm-schema = { version = "0.16.0" }`
ethanfrey commented 1 year ago

Terra (both classic and terra2) are using cosmwasm 1.0 afaik. Closing this