commit 706a1fcd65b4811662672258f52de05cbce9b3ac
parent 6ab532e741cf610af0f283ad0ae702cd73687663
Author: nolash <dev@holbrook.no>
Date: Fri, 11 Dec 2020 16:42:47 +0100
Rename --contracts-dir to --abi-dir
Diffstat:
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/python/giftable_erc20_token/runnable/deploy.py b/python/giftable_erc20_token/runnable/deploy.py
@@ -30,7 +30,7 @@ argparser.add_argument('-d', '--decimals', dest='d', default=18, type=int, help=
argparser.add_argument('-o', '--owner', dest='o', type=str, help='Reserve owner account')
argparser.add_argument('-a', '--account', dest='a', action='append', type=str, help='Account to fund')
argparser.add_argument('-m', '--minter', dest='m', action='append', type=str, help='Minter to add')
-argparser.add_argument('--contracts-dir', dest='contracts_dir', type=str, default='.', help='Directory containing bytecode and abi')
+argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default='.', help='Directory containing bytecode and abi')
argparser.add_argument('-v', action='store_true', help='Be verbose')
argparser.add_argument('amount', type=int, help='Initial token supply (will be owned by contract creator)')
args = argparser.parse_args()
@@ -41,11 +41,11 @@ if args.v:
def main():
w3 = web3.Web3(web3.Web3.HTTPProvider(args.p))
- f = open(os.path.join(args.contracts_dir, 'GiftableToken.abi.json'), 'r')
+ f = open(os.path.join(args.abi_dir, 'GiftableToken.abi.json'), 'r')
abi = json.load(f)
f.close()
- f = open(os.path.join(args.contracts_dir, 'GiftableToken.bin'), 'r')
+ f = open(os.path.join(args.abi_dir, 'GiftableToken.bin'), 'r')
bytecode = f.read()
f.close()
diff --git a/python/giftable_erc20_token/runnable/gift.py b/python/giftable_erc20_token/runnable/gift.py
@@ -26,7 +26,7 @@ argparser = argparse.ArgumentParser()
argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)')
argparser.add_argument('-t', '--token-address', required='True', dest='t', type=str, help='Giftable token address')
argparser.add_argument('-m', '--minter-address', dest='m', type=str, help='Minter account address')
-argparser.add_argument('--contracts-dir', dest='contracts_dir', type=str, default='.', help='Directory containing bytecode and abi')
+argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default='.', help='Directory containing bytecode and abi')
argparser.add_argument('-v', action='store_true', help='Be verbose')
argparser.add_argument('-r', '--recipient-address', dest='r', type=str, help='Recipient account address')
argparser.add_argument('amount', type=int, help='Amount of tokens to mint and gift')
@@ -38,7 +38,7 @@ if args.v:
def main():
w3 = web3.Web3(web3.Web3.HTTPProvider(args.p))
- f = open(os.path.join(args.contracts_dir, 'GiftableToken.abi.json'), 'r')
+ f = open(os.path.join(args.abi_dir, 'GiftableToken.abi.json'), 'r')
abi = json.load(f)
f.close()
diff --git a/solidity/GiftableToken.sol b/solidity/GiftableToken.sol
@@ -12,7 +12,7 @@ contract GiftableToken {
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
- mapping (address => mapping (address => uint256)) public allowances;
+ 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);
@@ -60,9 +60,9 @@ contract GiftableToken {
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
- require(allowances[_from][msg.sender] >= _value);
+ require(allowance[_from][msg.sender] >= _value);
require(balanceOf[_from] >= _value);
- allowances[_from][msg.sender] = allowances[_from][msg.sender] - _value;
+ allowance[_from][msg.sender] = allowance[_from][msg.sender] - _value;
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit TransferFrom(_from, _to, msg.sender, _value);
@@ -70,7 +70,7 @@ contract GiftableToken {
}
function approve(address _spender, uint256 _value) public returns (bool) {
- allowances[msg.sender][_spender] += _value;
+ allowance[msg.sender][_spender] += _value;
emit Approval(msg.sender, _spender, _value);
return true;
}