LogoLogo
  • Persistence Hub
    • 👓Overview
    • 🌐Persistence Ecosystem
  • Begin & Explore
    • 🔏Wallet Setup
    • 📓Getting Your Persistence Address
    • 💰Acquiring $XPRT Tokens
  • Products
    • 🦾Persistence DEX (V1)
      • 📘Introduction
      • 📖Guides
        • 👨‍💼Managing Assets
        • 💱Trading Assets
        • 🚰Providing Liquidity
        • ⛓️Bonding/Unbonding Tokens
        • 🎉Claiming Rewards
        • 🏗️Creating New Pool
          • 🌀Metastable Pool
          • ⚖️Weighted Pool
          • 🧊Stable Swap Pool
      • 🏊‍♂️Pools
      • ⚡Instant LP Unbonding
      • 🎁Tradooor Rebate Program
      • 💰Fees
      • 🏆Rewards
      • ⚙️Technical Architecture
    • Bitcoin Cross-Chain Swaps (V2)
      • 🌟Introduction
      • 📚Fundamentals
        • 💱BTCfi
        • 🌉Bitcoin Layer 2s
        • Interoperability for BTCfi
        • 💡Intents for Blockchain Interoperability
      • 🔀Traditional Bridges vs. Intent-Based Swaps
      • ⚙️Product Mechanism
  • 💂Security
    • 📖Audits
  • Participate & Explore
    • $XPRT Token
      • 🛒Acquire
      • 📈Stake
      • 🏛️Governance
    • 🖥️Alternative Frontends
      • 🔃Hosting IPFS Versions with Pinata
      • 🤖IPFS Automation
    • 💼Wallets
    • 🔍Explorers
    • 💸Grants
  • Persistence Core-1 Chain
    • 🟢Running Nodes
      • Run a Local Node
      • Run a Testnet Node
      • Run a Mainnet Node
      • Node operations
        • State Sync
        • Run in the background
        • Cosmovisor upgrades
        • Manual upgrades
      • Seed & Peers
    • Public Infrastructure
      • Persistence Testnet
      • Endpoints
      • Snapshots & Archival Nodes
      • Faucets
      • Chain Registry
    • 🛡️Validators
      • Validate on Testnet
      • Validate on Mainnet
      • Validator Communication
    • 📡Relayers
      • IBC Channels
      • IBC Relayers
      • Relay on Mainnet
      • Relay on Testnet
    • 🫗Liquid Staking Module
      • For Validators
    • 📄Smart Contracts
      • Overview
      • Uploading a Contract
    • 👨‍💻Developer Tools
      • Persistence JS
      • Persistence SDK
    • ⚒️Community Tools
  • Community & Support
    • 🇹🇰Foundation Delegations
      • ➡️Round 1 - Closed
      • ➡️Round 2 - Closed
      • ⭐Bonus Delegation
      • ➡️Round 3 - Delegation Period Over
    • ⭕Coin-type Migration from 750 to 118
      • Persistence Wallet
      • Keplr Wallet
      • Ledger Hardware Wallet
      • Cosmostation Wallet
      • Coin98 Super Wallet
      • Math Wallet
      • Leap Wallet
      • Citadel Wallet
    • 🌎Geofencing on Persistence
    • 😍Connect & Follow
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Persistence Core-1 Chain
  2. Smart Contracts

Uploading a Contract

These are the steps to upload and instantiate a contract

  • Submit the upload proposal

  • Wait for it to pass

  • Submit proposal for instantiating the contract

  • Wait for the proposal to pass

  • The contract is now instantiated and ready to be interacted with.

See the list of codes that was uploaded previously.

persistenceCore query wasm list-code

To upload the contract via proposal

persistenceCore tx gov submit-proposal wasm-store "<path/to/the/compiled/wasm>" \
  --title "title" \
  --description "description" \
  --deposit 10000uxprt \
  --run-as $KEY \
  --instantiate-nobody "true" \
  --keyring-backend test \
  --from $KEY --gas auto --fees 10000uxprt -y \
  --chain-id core-1 \
  -b block -o json --gas-adjustment 1.1
  
echo $RESP 

The $KEY can be any valid persistenceAddress. Make sure it has some tokens.

If the contract is uploaded successfully, i.e., the above proposal is passed, then the contract will be instantiated via another gov-proposal

Get the $CODE_ID from wasm list-code after the proposal passes and proceed towards instantiation

persistenceCore tx gov submit-proposal instantiate-contract $CODE_ID "$INIT" \
  --admin="$KEY" \
  --from $KEY \
  --deposit 10000uxprt \
  --label "label" \
  --title "title" \
  --description "description" \
  --gas-adjustment 1.1 \
  --fees "10000uxprt" \
  --gas "auto" \
  --run-as $KEY \
  -y --chain-id core-1 -b block -o json

The $KEY can be any valid persistenceAddress. Make sure it has some tokens.

The $INIT variable has to be in a json structure with all the variables needed for the contract example (init variable for the cw20 contract) :

INIT=$(cat <<EOF
{
  "name": "My first token",
  "symbol": "FRST",
  "decimals": 6,
  "initial_balances": [{
    "address": "$KEY",
    "amount": "123456789000"
  }]
}
EOF
)

After the proposal passes, the contract will be instantiated and can be interacted with!!

For more info check out the following link :

PreviousOverviewNextDeveloper Tools

Last updated 5 months ago

Was this helpful?

📄
Smart Contracts Over Governance