mirror of
https://github.com/chaintool-py/eth-erc20.git
synced 2024-11-21 17:26:47 +01:00
Update url
This commit is contained in:
parent
00db79d6f5
commit
4da58e70c7
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
__pycache__
|
||||
*.pyc
|
||||
dist/
|
||||
build/
|
||||
gmon.out
|
||||
*.egg-info
|
@ -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
|
||||
|
3
python/giftable_erc20_token/data/__init__.py
Normal file
3
python/giftable_erc20_token/data/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
import os
|
||||
|
||||
data_dir = os.path.realpath(os.path.dirname(__file__))
|
@ -63,8 +63,8 @@ if args.vv:
|
||||
elif args.v:
|
||||
logg.setLevel(logging.INFO)
|
||||
|
||||
block_last = args.w
|
||||
block_all = args.ww
|
||||
block_last = args.w or block_all
|
||||
|
||||
passphrase_env = 'ETH_PASSPHRASE'
|
||||
if args.env_prefix != None:
|
||||
|
@ -1,3 +1,4 @@
|
||||
confini~=0.3.6rc3
|
||||
crypto-dev-signer~=0.4.14b2
|
||||
chainlib~=0.0.2a12
|
||||
crypto-dev-signer~=0.4.14b3
|
||||
chainlib~=0.0.3a1
|
||||
potaahto~=0.0.1a2
|
||||
|
@ -1,10 +1,10 @@
|
||||
[metadata]
|
||||
name = giftable-erc20-token
|
||||
version = 0.0.8a9
|
||||
description = Simple ERC20 contract with deployment script that lets any address mint and gift itself tokens.
|
||||
name = eth-erc20
|
||||
version = 0.0.9a1
|
||||
description = ERC20 interface and simple contract with deployment script that lets any address mint and gift itself tokens.
|
||||
author = Louis Holbrook
|
||||
author_email = dev@holbrook.no
|
||||
url = https://gitlab.com/nolash/giftable-erc-token
|
||||
url = https://gitlab.com/nolash/eth-erc20
|
||||
keywords =
|
||||
ethereum
|
||||
classifiers =
|
||||
@ -27,14 +27,20 @@ packages =
|
||||
giftable_erc20_token
|
||||
giftable_erc20_token.runnable
|
||||
giftable_erc20_token.data
|
||||
eth_erc20
|
||||
eth_erc20.data
|
||||
eth_erc20.runnable
|
||||
|
||||
[options.package_data]
|
||||
* =
|
||||
data/GiftableToken.json
|
||||
data/GiftableToken.bin
|
||||
data/ERC20.json
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
giftable-token-deploy = giftable_erc20_token.runnable.deploy:main
|
||||
giftable-token-gift = giftable_erc20_token.runnable.gift:main
|
||||
giftable-token-minter = giftable_erc20_token.runnable.minter:main
|
||||
erc20-transfer = eth_erc20.runnable.transfer:main
|
||||
erc20-balance = eth_erc20.runnable.balance:main
|
||||
|
3
python/test_requirements.txt
Normal file
3
python/test_requirements.txt
Normal file
@ -0,0 +1,3 @@
|
||||
eth_tester==0.5.0b3
|
||||
py-evm==0.3.0a20
|
||||
pytest==6.0.1
|
@ -7,16 +7,23 @@ contract GiftableToken {
|
||||
address owner;
|
||||
mapping(address => bool) minters;
|
||||
|
||||
// Implements ERC20
|
||||
string public name;
|
||||
// Implements ERC20
|
||||
string public symbol;
|
||||
// Implements ERC20
|
||||
uint8 public decimals;
|
||||
// Implements ERC20
|
||||
uint256 public totalSupply;
|
||||
// Implements ERC20
|
||||
mapping (address => uint256) public balanceOf;
|
||||
// Implements ERC20
|
||||
mapping (address => mapping (address => uint256)) public allowance;
|
||||
|
||||
event Transfer(address indexed _from, address indexed _to, 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 Mint(address indexed _minter, address indexed _beneficiary, uint256 _value);
|
||||
|
||||
constructor(string memory _name, string memory _symbol, uint8 _decimals) public {
|
||||
owner = msg.sender;
|
||||
@ -32,6 +39,8 @@ contract GiftableToken {
|
||||
balanceOf[_to] += _value;
|
||||
totalSupply += _value;
|
||||
|
||||
emit Mint(msg.sender, _to, _value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -51,6 +60,7 @@ contract GiftableToken {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Implements ERC20
|
||||
function transfer(address _to, uint256 _value) public returns (bool) {
|
||||
require(balanceOf[msg.sender] >= _value);
|
||||
balanceOf[msg.sender] -= _value;
|
||||
@ -59,6 +69,7 @@ contract GiftableToken {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Implements ERC20
|
||||
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
|
||||
require(allowance[_from][msg.sender] >= _value);
|
||||
require(balanceOf[_from] >= _value);
|
||||
@ -69,9 +80,24 @@ contract GiftableToken {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Implements ERC20
|
||||
function approve(address _spender, uint256 _value) public returns (bool) {
|
||||
allowance[msg.sender][_spender] += _value;
|
||||
emit Approval(msg.sender, _spender, _value);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user