Skip to content

Commit

Permalink
Merge pull request #24 from shobhit9070/shobhitdev
Browse files Browse the repository at this point in the history
A python program to create your own Cryptocurrency #13 30
  • Loading branch information
gantavyamalviya authored Oct 8, 2022
2 parents f1b1cd6 + 154dd47 commit 30b3bc6
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Python-ERC20/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.sol linguist-language=Solidity
*.vy linguist-language=Python
6 changes: 6 additions & 0 deletions Python-ERC20/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__pycache__
.env
.history
.hypothesis/
build/
reports/
9 changes: 9 additions & 0 deletions Python-ERC20/brownie-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- OpenZeppelin/[email protected]
compiler:
solc:
remappings:
- "@openzeppelin=OpenZeppelin/[email protected]"
dotenv: .env
wallets:
from_key: ${PRIVATE_KEY} #enter you own private key
13 changes: 13 additions & 0 deletions Python-ERC20/contracts/OurToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract OurToken is ERC20 {
constructor(uint256 initialSupply)
ERC20("#NameOFyouToken", "SymbolOfyourToken")
{
_mint(msg.sender, initialSupply);
}
}
11 changes: 11 additions & 0 deletions Python-ERC20/scripts/1_deploy_scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from brownie import OurToken
from scripts.helpul_scripts import get_account
from web3 import Web3

initial_supply = Web3.toWei(1000, "ether") #enter the inital supply you want for your token


def main():
account = get_account()
our_token = OurToken.deploy(initial_supply, {"from": account})
print(our_token.name())
Empty file.
21 changes: 21 additions & 0 deletions Python-ERC20/scripts/helpul_scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from brownie import accounts, network, config

# list of test networks for deploying the token
LOCAL_BLOCKCHAIN_ENVIRONMENTS = [
"development",
"ganache",
"hardhat",
"local-ganache",
"mainnet-fork",
]


def get_account(index=None, id=None):
if index:
return accounts[index]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
print(accounts[0].balance())
return accounts[0]
if id:
return accounts.load(id)
return accounts.add(config["wallets"]["from_key"])

0 comments on commit 30b3bc6

Please sign in to comment.