Skip to content

Instantly share code, notes, and snippets.

@cgcardona
Last active June 29, 2020 00:07
Show Gist options
  • Save cgcardona/6066064ca32caaa44fa352f25bf2e087 to your computer and use it in GitHub Desktop.
Save cgcardona/6066064ca32caaa44fa352f25bf2e087 to your computer and use it in GitHub Desktop.

Smart Contract Flow

Setup

Software

./ava --version
avalanche/0.5.7 [database=v0.5.0, network=testnet/denali]

go version
go version go1.13.12 darwin/amd64

Fire up local network

First, fire up avash.

  • branch: master
  • commit: 6f609a0219ded433e49a26277a56845459de5678
cd path/to/avash
./avash
runscript scripts/five_node_staking.lua

Add Custom RPC to Metamask

Next, install Metamask.

Now, add your local network to Metamask. Networks -> Custom RPC -> New Network

Import the whale account

Now, import the local network C Chain whale. In metamask "Import Account"

  • Private Key
  • 0xabd71b35d559563fea757f0f5edbde286fb8c043105b15abb7cd57189306d7d1

This will give you a balance of 1,000,000,000 C-AVA

Remix

Next, go to Remix. In the Deploy and Run tab set ENVIRONMENT to "Injected Web3". This will prompt you to connect Remix to Metamask. Next, Open Storage.sol in the File Explorers tab. Now, in the Solidity Compiler tab click Compile 1_Storage.sol

Back in the Deploy and Run tab click Deploy. Even if you get the failure popup just click through and approve the tx with metamask. In the same tab under the "Deployed Contracts" heading open the Storage contract and paste 31415927 in to the store input field. Confirm and pay the tx with metamask. Lastly, click the retrieve button to get the value from the blockchain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment