Update url

This commit is contained in:
nolash 2021-05-02 16:33:00 +02:00
parent 00db79d6f5
commit 4da58e70c7
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
8 changed files with 53 additions and 8 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
__pycache__
*.pyc
dist/
build/
gmon.out
*.egg-info

View File

@ -1 +1 @@
include **/data/GiftableToken.json **/data/GiftableToken.bin requirements.txt test_requirements.txt include **/data/ERC20.json **/data/GiftableToken.json **/data/GiftableToken.bin requirements.txt test_requirements.txt

View File

@ -0,0 +1,3 @@
import os
data_dir = os.path.realpath(os.path.dirname(__file__))

View File

@ -63,8 +63,8 @@ if args.vv:
elif args.v: elif args.v:
logg.setLevel(logging.INFO) logg.setLevel(logging.INFO)
block_last = args.w
block_all = args.ww block_all = args.ww
block_last = args.w or block_all
passphrase_env = 'ETH_PASSPHRASE' passphrase_env = 'ETH_PASSPHRASE'
if args.env_prefix != None: if args.env_prefix != None:

View File

@ -1,3 +1,4 @@
confini~=0.3.6rc3 confini~=0.3.6rc3
crypto-dev-signer~=0.4.14b2 crypto-dev-signer~=0.4.14b3
chainlib~=0.0.2a12 chainlib~=0.0.3a1
potaahto~=0.0.1a2

View File

@ -1,10 +1,10 @@
[metadata] [metadata]
name = giftable-erc20-token name = eth-erc20
version = 0.0.8a9 version = 0.0.9a1
description = Simple ERC20 contract with deployment script that lets any address mint and gift itself tokens. description = ERC20 interface and simple contract with deployment script that lets any address mint and gift itself tokens.
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no
url = https://gitlab.com/nolash/giftable-erc-token url = https://gitlab.com/nolash/eth-erc20
keywords = keywords =
ethereum ethereum
classifiers = classifiers =
@ -27,14 +27,20 @@ packages =
giftable_erc20_token giftable_erc20_token
giftable_erc20_token.runnable giftable_erc20_token.runnable
giftable_erc20_token.data giftable_erc20_token.data
eth_erc20
eth_erc20.data
eth_erc20.runnable
[options.package_data] [options.package_data]
* = * =
data/GiftableToken.json data/GiftableToken.json
data/GiftableToken.bin data/GiftableToken.bin
data/ERC20.json
[options.entry_points] [options.entry_points]
console_scripts = console_scripts =
giftable-token-deploy = giftable_erc20_token.runnable.deploy:main giftable-token-deploy = giftable_erc20_token.runnable.deploy:main
giftable-token-gift = giftable_erc20_token.runnable.gift:main giftable-token-gift = giftable_erc20_token.runnable.gift:main
giftable-token-minter = giftable_erc20_token.runnable.minter:main giftable-token-minter = giftable_erc20_token.runnable.minter:main
erc20-transfer = eth_erc20.runnable.transfer:main
erc20-balance = eth_erc20.runnable.balance:main

View File

@ -0,0 +1,3 @@
eth_tester==0.5.0b3
py-evm==0.3.0a20
pytest==6.0.1

View File

@ -7,16 +7,23 @@ contract GiftableToken {
address owner; address owner;
mapping(address => bool) minters; mapping(address => bool) minters;
// Implements ERC20
string public name; string public name;
// Implements ERC20
string public symbol; string public symbol;
// Implements ERC20
uint8 public decimals; uint8 public decimals;
// Implements ERC20
uint256 public totalSupply; uint256 public totalSupply;
// Implements ERC20
mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOf;
// Implements ERC20
mapping (address => mapping (address => uint256)) public allowance; mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed _from, address indexed _to, uint256 _value); event Transfer(address indexed _from, address indexed _to, uint256 _value);
event TransferFrom(address indexed _from, address indexed _to, address indexed _spender, uint256 _value); event TransferFrom(address indexed _from, address indexed _to, address indexed _spender, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Mint(address indexed _minter, address indexed _beneficiary, uint256 _value);
constructor(string memory _name, string memory _symbol, uint8 _decimals) public { constructor(string memory _name, string memory _symbol, uint8 _decimals) public {
owner = msg.sender; owner = msg.sender;
@ -32,6 +39,8 @@ contract GiftableToken {
balanceOf[_to] += _value; balanceOf[_to] += _value;
totalSupply += _value; totalSupply += _value;
emit Mint(msg.sender, _to, _value);
return true; return true;
} }
@ -51,6 +60,7 @@ contract GiftableToken {
return true; return true;
} }
// Implements ERC20
function transfer(address _to, uint256 _value) public returns (bool) { function transfer(address _to, uint256 _value) public returns (bool) {
require(balanceOf[msg.sender] >= _value); require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] -= _value; balanceOf[msg.sender] -= _value;
@ -59,6 +69,7 @@ contract GiftableToken {
return true; return true;
} }
// Implements ERC20
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(allowance[_from][msg.sender] >= _value); require(allowance[_from][msg.sender] >= _value);
require(balanceOf[_from] >= _value); require(balanceOf[_from] >= _value);
@ -69,9 +80,24 @@ contract GiftableToken {
return true; return true;
} }
// Implements ERC20
function approve(address _spender, uint256 _value) public returns (bool) { function approve(address _spender, uint256 _value) public returns (bool) {
allowance[msg.sender][_spender] += _value; allowance[msg.sender][_spender] += _value;
emit Approval(msg.sender, _spender, _value); emit Approval(msg.sender, _spender, _value);
return true; return true;
} }
// Implements EIP165
function supportsInterface(bytes4 _sum) {
if (_sum == 0xc6bb4b70) { // ERC20
return true;
}
if (_sum == 0x449a52f8) { // Minter
return true;
}
if (_sum == 0x01ffc9a7) { // EIP165
return true;
}
return false;
}
} }