All Projects → ewasm → wrc20-examples

ewasm / wrc20-examples

Licence: MIT license
This repository contains examples of WRC20 tokens written in different languages.

Projects that are alternatives of or similar to wrc20-examples

dala-smart-contracts
Smart contracts for the Dala token sale and ERC20 token
Stars: ✭ 19 (+58.33%)
Mutual labels:  ethereum-contract, erc20
niftygate
Drop-in Access Control via NFT Ownership
Stars: ✭ 61 (+408.33%)
Mutual labels:  ethereum-contract, erc20
Basic Attention Token Crowdsale
Basic Attention Token
Stars: ✭ 160 (+1233.33%)
Mutual labels:  ethereum-contract, erc20
bitdegree-token-crowdsale
Token Website
Stars: ✭ 26 (+116.67%)
Mutual labels:  ethereum-contract, erc20
Eden Smart Contracts
EDEN - EDN Smart Token & Smart Contracts
Stars: ✭ 109 (+808.33%)
Mutual labels:  ethereum-contract, erc20
Ico Contracts
Ethereum smart contracts that have been used during successful ICOs
Stars: ✭ 160 (+1233.33%)
Mutual labels:  ethereum-contract, erc20
Tokenbalance
Simple Ethereum API to get your ERC20 Token Balance along with useful information
Stars: ✭ 163 (+1258.33%)
Mutual labels:  ethereum-contract, erc20
contracts
Off-the-shelf Solidity smart contracts
Stars: ✭ 100 (+733.33%)
Mutual labels:  erc20
ddash
DDASH - Ethereum Operating System for Knowledge Creation and Sharing
Stars: ✭ 26 (+116.67%)
Mutual labels:  ethereum-contract
Optino
Fully collateralised vanilla and bounded (capped call and floored put) crypto options
Stars: ✭ 16 (+33.33%)
Mutual labels:  erc20
tokensale
Blockport tokensale
Stars: ✭ 20 (+66.67%)
Mutual labels:  erc20
SmartHold-contracts
Ethereum Smart Contracts for locking your Ether and ERC20 tokens based on time and price conditions
Stars: ✭ 23 (+91.67%)
Mutual labels:  erc20
defi-dapps-solidity-smart-contracts
This is a Web 3 Smart Contract learning and teaching repo which will be used to teach students all across Pakistan.
Stars: ✭ 241 (+1908.33%)
Mutual labels:  erc20
gas-reporting
Reference documentation on every gas price API and all the different formats
Stars: ✭ 85 (+608.33%)
Mutual labels:  erc20
cheezyverse
Cheeze Wizards is the world's first battle royale on the blockchain (with cheese!)
Stars: ✭ 38 (+216.67%)
Mutual labels:  ethereum-contract
nft-swap-sdk
Ethereum's missing p2p NFT and token swap library for web3 developers. Written in TypeScript. Powered by 0x.
Stars: ✭ 200 (+1566.67%)
Mutual labels:  erc20
zeneth
🏵️ Let Your ETH Chill — Gasless Ethereum account abstraction with Flashbots
Stars: ✭ 112 (+833.33%)
Mutual labels:  erc20
web3jdemo
功能强大的web3j以太坊用例,支持批量生成钱包,批量不同账户转账,查询余额等,监控,定时任务,交易mint等方法,持续更新中... ...
Stars: ✭ 262 (+2083.33%)
Mutual labels:  ethereum-contract
storj-wallet
Storj Wallet for Windows, Mac and Linux. Send and Receive Storj ERC20 Token and Ethereum (unofficial)
Stars: ✭ 13 (+8.33%)
Mutual labels:  erc20
ethereum-erc20
Fungible token implementation for the Ethereum blockchain.
Stars: ✭ 27 (+125%)
Mutual labels:  erc20

WRC-20 challenge examples

This repository contains examples of WRC20 tokens written in different languages.

Joining the challenge

Have a look at this gist, implement the logic for the following contract (pseudocode) in your favorite language:

// main ewasm entry point
function main() { 
  if (eei_calldatasize() < 4)
    eei_revert(0, 0)
  let selector = eei_calldatacopy(0, 4)
  switch selector {
    case 0x9993021a:
      do_balance()
    case 0x5d359fbd:
      do_transfer()
    default:
      eei_revert(0, 0)
  }
}

function do_balance() {
  if (eei_calldatasize() != 24)
    eei_revert(0, 0)

  let address = eei_calldatacopy(4, 20)
  // make sure that address is 160 bits here,
  // but storage key is 256 bits so need to pad it somehow
  let balance = eei_storageload(address)
  eei_return(balance)
}

function do_transfer() {
  if (eei_calldatasize() != 32)
    eei_revert(0, 0)

  let sender = eei_sender()
  let recipient = eei_calldatacopy(4, 20)
  let value = eei_calldatacopy(24, 8)
  let sender_balance = eei_storageload(sender)
  let recipient_balance = eei_storageload(recipient)
  
  if (sender_balance < value)
    eei_revert(0, 0)

  sender_balance -= value
  recipient_balance += value

  eei_storagestore(sender, sender_balance)
  eei_storagestore(recipient, recipient_balance)
}

Then simply put it in a directory named after your language and send us a PR.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].