Giter VIP home page Giter VIP logo

pekoe-token's Introduction

PekoeToken repo

⚠️ WIP

Independent repo with Pekoe Tokens for 🌿PEKOE🌿 tips service.

Specs

Development Guide

Brownie: https://eth-brownie.readthedocs.io/en/stable/

Brownie x Hardhat installation

cd pekoe
python3 -m pip install pipx
python3 -m pipx ensurepath
python3 -m pipx install eth-brownie
npm install --save-dev hardhat

Brownie cheatsheet

brownie pm install OpenZeppelin/[email protected]
brownie pm list
brownie compile

Brownie x Hardhat console cheatsheet

brownie console --network hardhat

Commands:

  • interacting with accounts
accounts
accounts[0]
dir(accounts[0])  # available actions, e.g. accounts[0].balance() or accounts[0].transfer(accounts[1], "10 ether")
accounts.add()
# multiple transactions (without waiting for transaction completion)
transactions = [
    accounts[0].transfer(accounts[i], "1 ether", required_confs=0, silent=True) for i in range(1, 4)
]
[tx.status for tx in transactions]
  • interacting with contracts
Pekoe.deploy(1e23, {'from': accounts[1]})
Pekoe
# callable methods in Solidity are view or pure
dir(Pekoe[0])
  • interacting with blockchain
chain
web3.eth.blockNumber # height of chain
chain[-1] == web3.eth.get_block('latest')
# history
history
history.filter(sender=accounts[0], value="1 ether")
# mining
chain.mine(5)
web3.eth.blockNumber
# time travel
chain.time()
chain.sleep(1000)
chain.time()
# snapshots
chain.snapshot()
chain.revert()
chain.reset()  # genesis state
# undo/redo
chain.undo()
chain.redo()
  • inspecting transactions
tx = Pekoe[0].transfer(accounts[1], 1e18, {'from': accounts[0]})
tx.info()
tx.events
tx.internal_transfers
  • working with networks
brownie networks list

Deploy to Infura x Sepolia

  • set WEB3_INFURA_PROJECT_ID env variable with API key from Infura project
  • add Sepolia network
brownie networks list
brownie networks add Ethereum sepolia host="https://rpc.sepolia.org/" chainid=11155111
  • connect
brownie console --network sepolia
network.show_active()
network.is_connected()
  • let's create a deployment account. check is there are any local accounts:
brownie accounts list

and create

brownie accounts generate deployment_account
brownie console --network sepolia
account = accounts.load('deployment_account')
web3.fromWei(account.balance(), 'ether')
  • finally, deploy contract
brownie run deploy.py --network sepolia

Interact with contract in Sepolia

brownie console --network sepolia
pekoe = Pekoe.at('0xD25bbC0E9F39D472af6F3f988C22f3481709Ed58')
accounts.add()
deployment_account = accounts.load('deployment_account')
tx = pekoe.transfer(accounts[0], 1e18, {'from': deployment_account})

and check transaction on https://sepolia.etherscan.io/ using transaction address

pekoe-token's People

Watchers

Kostas Georgiou avatar Mark Prikhno avatar

pekoe-token's Issues

Deploy Smart Contract to testnet

Deploy Smart Contract to Sepolia testnet (the closest to mainnet, and the only one I've managed to find proper faucets for + not deprecated)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.