Skip to content

nachomazzara/web3playground

Repository files navigation

Ethereum EVM Compatible Playground Automagically typed

Test your contracts by creating your custom code snippets by using Web3 1.X.X or Ethers 5.0.X ready to be used and automagically typed.

Table of content

How it works

  • Paste the address of the contract you want to try.
  • Choose a name for the variable.
  • If the contract is upgradeable by using the proxy pattern, select the checkbox.
  • Code. ( - Right click to rename the files)

Screen Shot 2019-11-24 at 19 48 21

Share

If you want to share what you did or you have an issue and need help, you can upload and share it. It is using IPFS to make it fully decentralized.

  • Click on Save & Share
  • Copy & share the link 🚀

Examples

  • Get the name of a contract:

    async function main() {
      const name = await contract.methods.name().call()
      return name
    }
  • Get NFTs owners:

    async function main() {
      const tokenIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
      const owners = []
    
      for (let i = 0; i < tokenIds.length; i++) {
        const owner = await contract.methods.ownerOf(i).call()
        owners.push(owner)
      }
    
      return owners
    }
  • Transfer tokens:

    async function main() {
      const to = '0x...'
      const value = 1e18
    
      const txHash = await contract.methods.transfer(to, value).send()
    
      return txHash
    }
  • Get ETH balance:

    async function main() {
      const user = '0x..'
      const ethBalance = await web3.eth.getBalance(user)
      return ethBalance
    }

Methods are typed!!

Screen Shot 2019-11-24 at 19 42 47

FAQ

  • Is only javascript available?

    Yes, the snippet runs in the browser.

  • Which proxy implementations are supported?

    So far, the ones detected by topics as:

    • Event Upgrade(address,bytes) = 0xe74baeef5988edac1159d9177ca52f0f3d68f624a1996f77467eb3ebfb316537.

    • Event Upgraded(address): 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b.

    • EIP-1167 MinimalProxy.

    • Implementation made by OpenZeppelin. Searching for the storage slot 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3

    • EIP-1967 Standard Proxy Storage Slots).

  • Which chains are supported?

    Every RCP call is made to the network selected in your provider.

  • Which wallets are supported?

    I 've tested it with a few. Also mobile. If you have a wallet and it is not supported, please let me know and I will add it.

  • Can I refresh the browser?

    Yes! Contracts and code are stored at localstorage if any. Also, you can save it to IPFS.

  • Can I contribute?

    Yes! please, It will be awesome.

  • Multiple snippet supports?

    Yeah!!!!!! 🚀

Donate ❤️

About

Web3 & Smart contracts Playground

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published