commit b11cbcd5af908b51a739c51ed52e5bcf20df7846
parent 27ca5a9e9067808f9b733afe231ee49fa7a50b63
Author: Louis Holbrook <accounts-gitlab@holbrook.no>
Date: Sun, 4 Apr 2021 12:47:32 +0000
Merge branch 'lash/hunt-rlp-error' into 'master'
Lash/hunt rlp error
See merge request nolash/giftable-erc20-token!1
Diffstat:
15 files changed, 315 insertions(+), 159 deletions(-)
diff --git a/python/CHANGELOG b/python/CHANGELOG
@@ -1,6 +1,8 @@
* 0.0.7-unreleased
- Implement keystore signing.
- Change makefile to compile contract for Byzantium.
+ - Change mint method name to mintTo
+ - Add add minter executable script
* 0.0.6
- Rename contracts-dir flag to abi-dir
- Use package data dir as default abi dir
diff --git a/python/giftable_erc20_token/__init__.py b/python/giftable_erc20_token/__init__.py
@@ -0,0 +1 @@
+from .factory import GiftableToken
diff --git a/python/giftable_erc20_token/data/GiftableToken.bin b/python/giftable_erc20_token/data/GiftableToken.bin
@@ -1 +1 @@
-60806040523480156200001157600080fd5b50604051620014d8380380620014d883398181016040528101906200003791906200025d565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600290805190602001906200008f92919062000124565b508160039080519060200190620000a892919062000124565b5080600460006101000a81548160ff021916908360ff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050506200043d565b82805462000132906200038f565b90600052602060002090601f016020900481019282620001565760008555620001a2565b82601f106200017157805160ff1916838001178555620001a2565b82800160010185558215620001a2579182015b82811115620001a157825182559160200191906001019062000184565b5b509050620001b19190620001b5565b5090565b5b80821115620001d0576000816000905550600101620001b6565b5090565b6000620001eb620001e58462000319565b620002e5565b9050828152602081018484840111156200020457600080fd5b6200021184828562000359565b509392505050565b600082601f8301126200022b57600080fd5b81516200023d848260208601620001d4565b91505092915050565b600081519050620002578162000423565b92915050565b6000806000606084860312156200027357600080fd5b600084015167ffffffffffffffff8111156200028e57600080fd5b6200029c8682870162000219565b935050602084015167ffffffffffffffff811115620002ba57600080fd5b620002c88682870162000219565b9250506040620002db8682870162000246565b9150509250925092565b6000604051905081810181811067ffffffffffffffff821117156200030f576200030e620003f4565b5b8060405250919050565b600067ffffffffffffffff821115620003375762000336620003f4565b5b601f19601f8301169050602081019050919050565b600060ff82169050919050565b60005b83811015620003795780820151818401526020810190506200035c565b8381111562000389576000848401525b50505050565b60006002820490506001821680620003a857607f821691505b60208210811415620003bf57620003be620003c5565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200042e816200034c565b81146200043a57600080fd5b50565b61108b806200044d6000396000f3fe608060405234801561001057600080fd5b50600436106100d1576000357c01000000000000000000000000000000000000000000000000000000009004806370a082311161008e57806370a08231146101c057806395d89b41146101f0578063983b2d561461020e578063a0712d681461023e578063a9059cbb1461026e578063dd62ed3e1461029e576100d1565b806306fdde03146100d6578063095ea7b3146100f457806318160ddd1461012457806323b872dd146101425780633092afd514610172578063313ce567146101a2575b600080fd5b6100de6102ce565b6040516100eb9190610e00565b60405180910390f35b61010e60048036038101906101099190610d1a565b61035c565b60405161011b9190610de5565b60405180910390f35b61012c610460565b6040516101399190610e22565b60405180910390f35b61015c60048036038101906101579190610ccb565b610466565b6040516101699190610de5565b60405180910390f35b61018c60048036038101906101879190610c66565b610778565b6040516101999190610de5565b60405180910390f35b6101aa61086a565b6040516101b79190610e3d565b60405180910390f35b6101da60048036038101906101d59190610c66565b61087d565b6040516101e79190610e22565b60405180910390f35b6101f8610895565b6040516102059190610e00565b60405180910390f35b61022860048036038101906102239190610c66565b610923565b6040516102359190610de5565b60405180910390f35b61025860048036038101906102539190610d56565b6109de565b6040516102659190610de5565b60405180910390f35b61028860048036038101906102839190610d1a565b610aae565b6040516102959190610de5565b60405180910390f35b6102b860048036038101906102b39190610c8f565b610c17565b6040516102c59190610e22565b60405180910390f35b600280546102db90610f86565b80601f016020809104026020016040519081016040528092919081815260200182805461030790610f86565b80156103545780601f1061032957610100808354040283529160200191610354565b820191906000526020600020905b81548152906001019060200180831161033757829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546103ea9190610e74565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161044e9190610e22565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156104f157600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561053d57600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105c59190610eca565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106949190610eca565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106ea9190610e74565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f939856040516107659190610e22565b60405180910390a4600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061080057508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61080957600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600460009054906101000a900460ff1681565b60066020528060005260406000206000915090505481565b600380546108a290610f86565b80601f01602080910402602001604051908101604052809291908181526020018280546108ce90610f86565b801561091b5780601f106108f05761010080835404028352916020019161091b565b820191906000526020600020905b8154815290600101906020018083116108fe57829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461097e57600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610a3657600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610a859190610e74565b925050819055508160056000828254610a9e9190610e74565b9250508190555060019050919050565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610afc57600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b4b9190610eca565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ba19190610e74565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c059190610e22565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600081359050610c4b81611027565b92915050565b600081359050610c608161103e565b92915050565b600060208284031215610c7857600080fd5b6000610c8684828501610c3c565b91505092915050565b60008060408385031215610ca257600080fd5b6000610cb085828601610c3c565b9250506020610cc185828601610c3c565b9150509250929050565b600080600060608486031215610ce057600080fd5b6000610cee86828701610c3c565b9350506020610cff86828701610c3c565b9250506040610d1086828701610c51565b9150509250925092565b60008060408385031215610d2d57600080fd5b6000610d3b85828601610c3c565b9250506020610d4c85828601610c51565b9150509250929050565b600060208284031215610d6857600080fd5b6000610d7684828501610c51565b91505092915050565b610d8881610f10565b82525050565b6000610d9982610e58565b610da38185610e63565b9350610db3818560208601610f53565b610dbc81611016565b840191505092915050565b610dd081610f3c565b82525050565b610ddf81610f46565b82525050565b6000602082019050610dfa6000830184610d7f565b92915050565b60006020820190508181036000830152610e1a8184610d8e565b905092915050565b6000602082019050610e376000830184610dc7565b92915050565b6000602082019050610e526000830184610dd6565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610e7f82610f3c565b9150610e8a83610f3c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610ebf57610ebe610fb8565b5b828201905092915050565b6000610ed582610f3c565b9150610ee083610f3c565b925082821015610ef357610ef2610fb8565b5b828203905092915050565b6000610f0982610f1c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015610f71578082015181840152602081019050610f56565b83811115610f80576000848401525b50505050565b60006002820490506001821680610f9e57607f821691505b60208210811415610fb257610fb1610fe7565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b61103081610efe565b811461103b57600080fd5b50565b61104781610f3c565b811461105257600080fd5b5056fea2646970667358221220aa98bfe5caceca50ca9e4451ff4bd48deb23fefba3bba4226d2b922d94c342a964736f6c63430008000033
-\ No newline at end of file
+60806040523480156200001157600080fd5b50604051620014ef380380620014ef83398181016040528101906200003791906200025d565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600290805190602001906200008f92919062000124565b508160039080519060200190620000a892919062000124565b5080600460006101000a81548160ff021916908360ff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050506200047c565b828054620001329062000387565b90600052602060002090601f016020900481019282620001565760008555620001a2565b82601f106200017157805160ff1916838001178555620001a2565b82800160010185558215620001a2579182015b82811115620001a157825182559160200191906001019062000184565b5b509050620001b19190620001b5565b5090565b5b80821115620001d0576000816000905550600101620001b6565b5090565b6000620001eb620001e5846200030e565b620002e5565b9050828152602081018484840111156200020457600080fd5b6200021184828562000351565b509392505050565b600082601f8301126200022b57600080fd5b81516200023d848260208601620001d4565b91505092915050565b600081519050620002578162000462565b92915050565b6000806000606084860312156200027357600080fd5b600084015167ffffffffffffffff8111156200028e57600080fd5b6200029c8682870162000219565b935050602084015167ffffffffffffffff811115620002ba57600080fd5b620002c88682870162000219565b9250506040620002db8682870162000246565b9150509250925092565b6000620002f162000304565b9050620002ff8282620003bd565b919050565b6000604051905090565b600067ffffffffffffffff8211156200032c576200032b62000422565b5b620003378262000451565b9050602081019050919050565b600060ff82169050919050565b60005b838110156200037157808201518184015260208101905062000354565b8381111562000381576000848401525b50505050565b60006002820490506001821680620003a057607f821691505b60208210811415620003b757620003b6620003f3565b5b50919050565b620003c88262000451565b810181811067ffffffffffffffff82111715620003ea57620003e962000422565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6200046d8162000344565b81146200047957600080fd5b50565b611063806200048c6000396000f3fe608060405234801561001057600080fd5b50600436106100d1576000357c010000000000000000000000000000000000000000000000000000000090048063449a52f81161008e578063449a52f8146101c057806370a08231146101f057806395d89b4114610220578063983b2d561461023e578063a9059cbb1461026e578063dd62ed3e1461029e576100d1565b806306fdde03146100d6578063095ea7b3146100f457806318160ddd1461012457806323b872dd146101425780633092afd514610172578063313ce567146101a2575b600080fd5b6100de6102ce565b6040516100eb9190610dd8565b60405180910390f35b61010e60048036038101906101099190610d1b565b61035c565b60405161011b9190610dbd565b60405180910390f35b61012c610460565b6040516101399190610dfa565b60405180910390f35b61015c60048036038101906101579190610ccc565b610466565b6040516101699190610dbd565b60405180910390f35b61018c60048036038101906101879190610c67565b610778565b6040516101999190610dbd565b60405180910390f35b6101aa61086a565b6040516101b79190610e15565b60405180910390f35b6101da60048036038101906101d59190610d1b565b61087d565b6040516101e79190610dbd565b60405180910390f35b61020a60048036038101906102059190610c67565b61094e565b6040516102179190610dfa565b60405180910390f35b610228610966565b6040516102359190610dd8565b60405180910390f35b61025860048036038101906102539190610c67565b6109f4565b6040516102659190610dbd565b60405180910390f35b61028860048036038101906102839190610d1b565b610aaf565b6040516102959190610dbd565b60405180910390f35b6102b860048036038101906102b39190610c90565b610c18565b6040516102c59190610dfa565b60405180910390f35b600280546102db90610f5e565b80601f016020809104026020016040519081016040528092919081815260200182805461030790610f5e565b80156103545780601f1061032957610100808354040283529160200191610354565b820191906000526020600020905b81548152906001019060200180831161033757829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546103ea9190610e4c565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161044e9190610dfa565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156104f157600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561053d57600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105c59190610ea2565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106949190610ea2565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106ea9190610e4c565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f939856040516107659190610dfa565b60405180910390a4600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061080057508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61080957600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600460009054906101000a900460ff1681565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166108d557600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109249190610e4c565b92505081905550816005600082825461093d9190610e4c565b925050819055506001905092915050565b60066020528060005260406000206000915090505481565b6003805461097390610f5e565b80601f016020809104026020016040519081016040528092919081815260200182805461099f90610f5e565b80156109ec5780601f106109c1576101008083540402835291602001916109ec565b820191906000526020600020905b8154815290600101906020018083116109cf57829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a4f57600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610afd57600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b4c9190610ea2565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ba29190610e4c565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c069190610dfa565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600081359050610c4c81610fff565b92915050565b600081359050610c6181611016565b92915050565b600060208284031215610c7957600080fd5b6000610c8784828501610c3d565b91505092915050565b60008060408385031215610ca357600080fd5b6000610cb185828601610c3d565b9250506020610cc285828601610c3d565b9150509250929050565b600080600060608486031215610ce157600080fd5b6000610cef86828701610c3d565b9350506020610d0086828701610c3d565b9250506040610d1186828701610c52565b9150509250925092565b60008060408385031215610d2e57600080fd5b6000610d3c85828601610c3d565b9250506020610d4d85828601610c52565b9150509250929050565b610d6081610ee8565b82525050565b6000610d7182610e30565b610d7b8185610e3b565b9350610d8b818560208601610f2b565b610d9481610fee565b840191505092915050565b610da881610f14565b82525050565b610db781610f1e565b82525050565b6000602082019050610dd26000830184610d57565b92915050565b60006020820190508181036000830152610df28184610d66565b905092915050565b6000602082019050610e0f6000830184610d9f565b92915050565b6000602082019050610e2a6000830184610dae565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610e5782610f14565b9150610e6283610f14565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610e9757610e96610f90565b5b828201905092915050565b6000610ead82610f14565b9150610eb883610f14565b925082821015610ecb57610eca610f90565b5b828203905092915050565b6000610ee182610ef4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015610f49578082015181840152602081019050610f2e565b83811115610f58576000848401525b50505050565b60006002820490506001821680610f7657607f821691505b60208210811415610f8a57610f89610fbf565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b61100881610ed6565b811461101357600080fd5b50565b61101f81610f14565b811461102a57600080fd5b5056fea2646970667358221220d03175765e6a0d5359f40b7022325f34ef08d464c486b4e35a0b1c8927da82f164736f6c63430008020033
+\ No newline at end of file
diff --git a/python/giftable_erc20_token/data/GiftableToken.json b/python/giftable_erc20_token/data/GiftableToken.json
@@ -1 +1 @@
-[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"removeMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
+[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"removeMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
diff --git a/python/giftable_erc20_token/factory.py b/python/giftable_erc20_token/factory.py
@@ -0,0 +1,84 @@
+# standard imports
+import os
+import logging
+
+# external imports
+from chainlib.eth.tx import (
+ TxFactory,
+ TxFormat,
+ )
+from chainlib.hash import keccak256_string_to_hex
+from chainlib.eth.contract import (
+ ABIContractEncoder,
+ ABIContractType,
+ )
+
+# local imports
+from giftable_erc20_token.data import data_dir
+
+logg = logging.getLogger(__name__)
+
+
+class GiftableToken(TxFactory):
+
+ __abi = None
+ __bytecode = None
+
+ def constructor(self, sender_address, name, symbol, decimals, tx_format=TxFormat.JSONRPC):
+ code = GiftableToken.bytecode()
+ enc = ABIContractEncoder()
+ enc.string(name)
+ enc.string(symbol)
+ enc.uint256(decimals)
+ code += enc.get()
+ tx = self.template(sender_address, None, use_nonce=True)
+ tx = self.set_code(tx, code)
+ return self.finalize(tx, tx_format)
+
+
+ @staticmethod
+ def gas(code=None):
+ return 1500000
+
+ @staticmethod
+ def abi():
+ if GiftableToken.__abi == None:
+ f = open(os.path.join(data_dir, 'GiftableToken.json'), 'r')
+ GiftableToken.__abi = json.load(f)
+ f.close()
+ return GiftableToken.__abi
+
+
+ @staticmethod
+ def bytecode():
+ if GiftableToken.__bytecode == None:
+ f = open(os.path.join(data_dir, 'GiftableToken.bin'))
+ GiftableToken.__bytecode = f.read()
+ f.close()
+ return GiftableToken.__bytecode
+
+
+ def add_minter(self, contract_address, sender_address, address, tx_format=TxFormat.JSONRPC):
+ enc = ABIContractEncoder()
+ enc.method('addMinter')
+ enc.typ(ABIContractType.ADDRESS)
+ enc.address(address)
+ data = enc.get()
+ tx = self.template(sender_address, contract_address, use_nonce=True)
+ tx = self.set_code(tx, data)
+ tx = self.finalize(tx, tx_format)
+ return tx
+
+
+ def mint_to(self, contract_address, sender_address, address, value, tx_format=TxFormat.JSONRPC):
+ enc = ABIContractEncoder()
+ enc.method('mintTo')
+ enc.typ(ABIContractType.ADDRESS)
+ enc.typ(ABIContractType.UINT256)
+ enc.address(address)
+ enc.uint256(value)
+ data = enc.get()
+ tx = self.template(sender_address, contract_address, use_nonce=True)
+ tx = self.set_code(tx, data)
+ tx = self.finalize(tx, tx_format)
+ return tx
diff --git a/python/giftable_erc20_token/runnable/deploy.py b/python/giftable_erc20_token/runnable/deploy.py
@@ -1,4 +1,4 @@
-"""Deploys giftable token, and optionally gifts a set amount to all accounts in wallet
+"""Deploys giftable token
.. moduleauthor:: Louis Holbrook <dev@holbrook.no>
.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
@@ -16,18 +16,21 @@ import logging
import time
from enum import Enum
-# third-party imports
-import web3
+# external imports
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
-from crypto_dev_signer.keystore import DictKeystore
-from crypto_dev_signer.eth.helper import EthTxExecutor
+from crypto_dev_signer.keystore.dict import DictKeystore
+from chainlib.chain import ChainSpec
+from chainlib.eth.nonce import RPCNonceOracle
+from chainlib.eth.gas import RPCGasOracle
+from chainlib.eth.connection import EthHTTPConnection
+from chainlib.eth.tx import receipt
+
+# local imports
+from giftable_erc20_token import GiftableToken
logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger()
-logging.getLogger('web3').setLevel(logging.WARNING)
-logging.getLogger('urllib3').setLevel(logging.WARNING)
-
script_dir = os.path.dirname(__file__)
data_dir = os.path.join(script_dir, '..', 'data')
@@ -36,106 +39,66 @@ 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('-w', action='store_true', help='Wait for the last transaction to be confirmed')
argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed')
-argparser.add_argument('-e', action='store_true', help='Treat all transactions as essential')
-argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string')
+argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='evm:ethereum:1', help='Chain specification string')
argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing')
-argparser.add_argument('--name', dest='n', default='Giftable Token', type=str, help='Token name')
-argparser.add_argument('--symbol', dest='s', default='GFT', type=str, help='Token symbol')
-argparser.add_argument('--decimals', dest='d', default=18, type=int, help='Token decimals')
-argparser.add_argument('--account', action='append', type=str, help='Account to fund')
-argparser.add_argument('--minter', action='append', type=str, help='Minter to add')
-argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir))
+argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration')
+argparser.add_argument('--name', default='Giftable Token', type=str, help='Token name')
+argparser.add_argument('--symbol', default='GFT', type=str, help='Token symbol')
+argparser.add_argument('--decimals', default=18, type=int, help='Token decimals')
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)')
+argparser.add_argument('-vv', action='store_true', help='Be more verbose')
args = argparser.parse_args()
-if args.v:
+if args.vv:
logg.setLevel(logging.DEBUG)
+elif args.v:
+ logg.setLevel(logging.INFO)
block_last = args.w
block_all = args.ww
-w3 = web3.Web3(web3.Web3.HTTPProvider(args.p))
+passphrase_env = 'ETH_PASSPHRASE'
+if args.env_prefix != None:
+ passphrase_env = args.env_prefix + '_' + passphrase_env
+passphrase = os.environ.get(passphrase_env)
+if passphrase == None:
+ logg.warning('no passphrase given')
+ passphrase=''
signer_address = None
keystore = DictKeystore()
if args.y != None:
logg.debug('loading keystore file {}'.format(args.y))
- signer_address = keystore.import_keystore_file(args.y)
+ signer_address = keystore.import_keystore_file(args.y, password=passphrase)
logg.debug('now have key for signer address {}'.format(signer_address))
signer = EIP155Signer(keystore)
-chain_pair = args.i.split(':')
-chain_id = int(chain_pair[1])
+chain_spec = ChainSpec.from_chain_str(args.i)
-helper = EthTxExecutor(
- w3,
- signer_address,
- signer,
- chain_id,
- block=args.ww,
- )
+rpc = EthHTTPConnection(args.p)
+nonce_oracle = RPCNonceOracle(signer_address, rpc)
+gas_oracle = RPCGasOracle(rpc, code_callback=GiftableToken.gas)
+token_name = args.name
+token_symbol = args.symbol
+token_decimals = args.decimals
-def main():
-
- f = open(os.path.join(args.abi_dir, 'GiftableToken.json'), 'r')
- abi = json.load(f)
- f.close()
-
- f = open(os.path.join(args.abi_dir, 'GiftableToken.bin'), 'r')
- bytecode = f.read()
- f.close()
-
- c = w3.eth.contract(abi=abi, bytecode=bytecode)
- (tx_hash, rcpt) = helper.sign_and_send(
- [
- c.constructor(args.n, args.s, args.d).buildTransaction
- ],
- force_wait=True,
- )
- logg.debug('tx hash {} rcpt {}'.format(tx_hash, rcpt))
-
- address = rcpt.contractAddress
- logg.debug('token contract mined {} {} {} {}'.format(address, args.n, args.s, args.d))
- c = w3.eth.contract(abi=abi, address=address)
-
- balance = c.functions.balanceOf(signer_address).call()
- logg.info('balance {}: {} {}'.format(signer_address, balance, tx_hash))
-
- if args.minter != None:
- for a in args.minter:
- if a == signer_address:
- continue
- (tx_hash, rcpt) = helper.sign_and_send(
- [
- c.functions.addMinter(a).buildTransaction,
- ],
- )
-
- if args.account != None:
- mint_total = len(args.account) * args.amount
- tx = c.functions.mint(mint_total)
- (tx_hash, rcpt) = helper.sign_and_send(
- [
- c.functions.mint(mint_total).buildTransaction,
- ],
- force_wait=True,
- )
-
- for a in args.account:
- (tx_hash, rcpt) = helper.sign_and_send(
- [
- c.functions.transfer(a, args.amount).buildTransaction,
- ],
- )
+def main():
+ c = GiftableToken(chain_spec, signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
+ (tx_hash_hex, o) = c.constructor(signer_address, token_name, token_symbol, token_decimals)
+ rpc.do(o)
if block_last:
- helper.wait_for()
-
- print(address)
-
- sys.exit(0)
+ r = rpc.wait(tx_hash_hex)
+ if r['status'] == 0:
+ sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you')
+ sys.exit(1)
+ # TODO: pass through translator for keys (evm tester uses underscore instead of camelcase)
+ address = r['contractAddress']
+
+ print(address)
+ else:
+ print(tx_hash_hex)
if __name__ == '__main__':
diff --git a/python/giftable_erc20_token/runnable/gift.py b/python/giftable_erc20_token/runnable/gift.py
@@ -16,18 +16,20 @@ import logging
import time
# third-party imports
-import web3
-from eth_keys import keys
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
-from crypto_dev_signer.keystore import DictKeystore
-from crypto_dev_signer.eth.helper import EthTxExecutor
+from crypto_dev_signer.keystore.dict import DictKeystore
+from chainlib.eth.tx import receipt
+from chainlib.chain import ChainSpec
+from chainlib.eth.nonce import RPCNonceOracle
+from chainlib.eth.gas import RPCGasOracle
+from chainlib.eth.connection import EthHTTPConnection
+
+# local imports
+from giftable_erc20_token import GiftableToken
logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger()
-logging.getLogger('web3').setLevel(logging.WARNING)
-logging.getLogger('urllib3').setLevel(logging.WARNING)
-
script_dir = os.path.dirname(__file__)
data_dir = os.path.join(script_dir, '..', 'data')
@@ -36,82 +38,66 @@ argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8
argparser.add_argument('-e', action='store_true', help='Treat all transactions as essential')
argparser.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed')
argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed')
-argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string')
+argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='evm:ethereum:1', help='Chain specification string')
argparser.add_argument('-a', '--token-address', required='True', dest='a', type=str, help='Giftable token address')
argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing')
-argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir))
argparser.add_argument('-v', action='store_true', help='Be verbose')
+argparser.add_argument('-vv', action='store_true', help='Be more verbose')
+argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration')
argparser.add_argument('--recipient', type=str, help='Recipient account address. If not set, tokens will be gifted to the keystore account')
-argparser.add_argument('amount', type=int, help='Amount of tokens to mint and gift')
+argparser.add_argument('value', type=int, help='Value of tokens to mint and gift')
args = argparser.parse_args()
-if args.v:
+if args.vv:
logg.setLevel(logging.DEBUG)
+elif args.v:
+ logg.setLevel(logging.INFO)
-block_last = args.w
block_all = args.ww
+block_last = args.w or block_all
-w3 = web3.Web3(web3.Web3.HTTPProvider(args.p))
+passphrase_env = 'ETH_PASSPHRASE'
+if args.env_prefix != None:
+ passphrase_env = args.env_prefix + '_' + passphrase_env
+passphrase = os.environ.get(passphrase_env)
+if passphrase == None:
+ logg.warning('no passphrase given')
+ passphrase=''
signer_address = None
keystore = DictKeystore()
if args.y != None:
logg.debug('loading keystore file {}'.format(args.y))
- signer_address = keystore.import_keystore_file(args.y)
+ signer_address = keystore.import_keystore_file(args.y, password=passphrase)
logg.debug('now have key for signer address {}'.format(signer_address))
signer = EIP155Signer(keystore)
-chain_pair = args.i.split(':')
-chain_id = int(chain_pair[1])
-
-helper = EthTxExecutor(
- w3,
- signer_address,
- signer,
- chain_id,
- block=args.ww,
- )
-
-
-def main():
-
- f = open(os.path.join(args.abi_dir, 'GiftableToken.json'), 'r')
- abi = json.load(f)
- f.close()
-
- gas_price = w3.eth.gasPrice
+chain_spec = ChainSpec.from_chain_str(args.i)
- last_tx = None
+rpc = EthHTTPConnection(args.p)
+nonce_oracle = RPCNonceOracle(signer_address, rpc)
+gas_oracle = RPCGasOracle(rpc, code_callback=GiftableToken.gas)
- nonce = w3.eth.getTransactionCount(signer_address, 'pending')
-
- c = w3.eth.contract(abi=abi, address=args.a)
-
- recipient = signer_address
- if args.recipient != None:
- recipient = args.recipient
-
- (tx_hash, rcpt) = helper.sign_and_send(
- [
- c.functions.mint(args.amount).buildTransaction,
- ],
- )
-
- logg.info('mint to {} tx {}'.format(signer_address, tx_hash)) #.hex()))
-
- (tx_hash, rcpt) = helper.sign_and_send(
- [
- c.functions.transfer(recipient, args.amount).buildTransaction,
- ],
- )
-
- logg.info('transfer to {} tx {}'.format(recipient, tx_hash))
+token_address = args.a
+recipient_address = args.recipient
+if recipient_address == None:
+ recipient_address = signer_address
+token_value = args.value
+def main():
+ c = GiftableToken(chain_spec, signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
+ (tx_hash_hex, o) = c.mint_to(token_address, signer_address, recipient_address, token_value)
+ rpc.do(o)
if block_last:
- helper.wait_for()
+ r = rpc.wait(tx_hash_hex)
+ if r['status'] == 0:
+ sys.stderr.write('EVM revert. Wish I had more to tell you')
+ sys.exit(1)
+
+ logg.info('mint to {} tx {}'.format(recipient_address, tx_hash_hex))
- print(tx_hash)
+ print(tx_hash_hex)
sys.exit(0)
diff --git a/python/giftable_erc20_token/runnable/minter.py b/python/giftable_erc20_token/runnable/minter.py
@@ -0,0 +1,99 @@
+"""Add minter to token contact
+
+.. moduleauthor:: Louis Holbrook <dev@holbrook.no>
+.. pgp:: 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
+
+"""
+
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# standard imports
+import sys
+import os
+import json
+import argparse
+import logging
+import time
+
+# third-party imports
+from chainlib.eth.connection import EthHTTPConnection
+from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
+from crypto_dev_signer.keystore.dict import DictKeystore
+from chainlib.eth.nonce import RPCNonceOracle
+from chainlib.eth.gas import RPCGasOracle
+from chainlib.chain import ChainSpec
+from chainlib.eth.tx import receipt
+
+# local imports
+from giftable_erc20_token import GiftableToken
+
+logging.basicConfig(level=logging.WARNING)
+logg = logging.getLogger()
+
+script_dir = os.path.dirname(__file__)
+data_dir = os.path.join(script_dir, '..', 'data')
+
+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('-w', action='store_true', help='Wait for the last transaction to be confirmed')
+argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed')
+argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='evm:ethereum:1', help='Chain specification string')
+argparser.add_argument('-a', '--token-address', required='True', dest='a', type=str, help='Giftable token address')
+argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing')
+argparser.add_argument('-v', action='store_true', help='Be verbose')
+argparser.add_argument('-vv', action='store_true', help='Be more verbose')
+argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration')
+argparser.add_argument('minter_address', type=str, help='Minter address to add')
+args = argparser.parse_args()
+
+if args.vv:
+ logg.setLevel(logging.DEBUG)
+elif args.v:
+ logg.setLevel(logging.INFO)
+
+block_all = args.ww
+block_last = args.w or block_all
+
+passphrase_env = 'ETH_PASSPHRASE'
+if args.env_prefix != None:
+ passphrase_env = args.env_prefix + '_' + passphrase_env
+passphrase = os.environ.get(passphrase_env)
+if passphrase == None:
+ logg.warning('no passphrase given')
+ passphrase=''
+
+signer_address = None
+keystore = DictKeystore()
+if args.y != None:
+ logg.debug('loading keystore file {}'.format(args.y))
+ signer_address = keystore.import_keystore_file(args.y, password=passphrase)
+ logg.debug('now have key for signer address {}'.format(signer_address))
+signer = EIP155Signer(keystore)
+
+chain_spec = ChainSpec.from_chain_str(args.i)
+
+rpc = EthHTTPConnection(args.p)
+nonce_oracle = RPCNonceOracle(signer_address, rpc)
+gas_oracle = RPCGasOracle(rpc, code_callback=GiftableToken.gas)
+
+token_address = args.a
+minter_address = args.minter_address
+
+
+def main():
+ c = GiftableToken(chain_spec, signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
+ (tx_hash_hex, o) = c.add_minter(token_address, signer_address, minter_address)
+ rpc.do(o)
+ if block_last:
+ r = rpc.wait(tx_hash_hex)
+ if r['status'] == 0:
+ sys.stderr.write('EVM revert. Wish I had more to tell you')
+ sys.exit(1)
+
+ logg.info('add minter {} to {} tx {}'.format(minter_address, token_address, tx_hash_hex))
+
+ print(tx_hash_hex)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/python/requirements.txt b/python/requirements.txt
@@ -1 +1,3 @@
-web3==5.12.2
+confini~=0.3.6rc3
+crypto-dev-signer~=0.4.14a17
+chainlib~=0.0.2a1
diff --git a/python/setup.cfg b/python/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = giftable-erc20-token
-version = 0.0.7b1
+version = 0.0.8a7
description = Simple ERC20 contract with deployment script that lets any address mint and gift itself tokens.
author = Louis Holbrook
author_email = dev@holbrook.no
@@ -26,9 +26,7 @@ python_requires = >= 3.6
packages =
giftable_erc20_token
giftable_erc20_token.runnable
-install_requires =
- web3==5.12.2
- crypto-dev-signer~=0.4.13b1
+ giftable_erc20_token.data
[options.package_data]
* =
@@ -39,3 +37,4 @@ install_requires =
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
diff --git a/python/setup.py b/python/setup.py
@@ -1,5 +1,24 @@
from setuptools import setup
+requirements = []
+f = open('requirements.txt', 'r')
+while True:
+ l = f.readline()
+ if l == '':
+ break
+ requirements.append(l.rstrip())
+f.close()
+
+test_requirements = []
+f = open('test_requirements.txt', 'r')
+while True:
+ l = f.readline()
+ if l == '':
+ break
+ test_requirements.append(l.rstrip())
+f.close()
+
+
setup(
package_data={
'': [
@@ -8,4 +27,6 @@ setup(
],
},
include_package_data=True,
+ install_requires=requirements,
+ tests_require=test_requirements,
)
diff --git a/solidity/GiftableToken.bin b/solidity/GiftableToken.bin
@@ -1 +1 @@
-60806040523480156200001157600080fd5b50604051620014d8380380620014d883398181016040528101906200003791906200025d565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600290805190602001906200008f92919062000124565b508160039080519060200190620000a892919062000124565b5080600460006101000a81548160ff021916908360ff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050506200043d565b82805462000132906200038f565b90600052602060002090601f016020900481019282620001565760008555620001a2565b82601f106200017157805160ff1916838001178555620001a2565b82800160010185558215620001a2579182015b82811115620001a157825182559160200191906001019062000184565b5b509050620001b19190620001b5565b5090565b5b80821115620001d0576000816000905550600101620001b6565b5090565b6000620001eb620001e58462000319565b620002e5565b9050828152602081018484840111156200020457600080fd5b6200021184828562000359565b509392505050565b600082601f8301126200022b57600080fd5b81516200023d848260208601620001d4565b91505092915050565b600081519050620002578162000423565b92915050565b6000806000606084860312156200027357600080fd5b600084015167ffffffffffffffff8111156200028e57600080fd5b6200029c8682870162000219565b935050602084015167ffffffffffffffff811115620002ba57600080fd5b620002c88682870162000219565b9250506040620002db8682870162000246565b9150509250925092565b6000604051905081810181811067ffffffffffffffff821117156200030f576200030e620003f4565b5b8060405250919050565b600067ffffffffffffffff821115620003375762000336620003f4565b5b601f19601f8301169050602081019050919050565b600060ff82169050919050565b60005b83811015620003795780820151818401526020810190506200035c565b8381111562000389576000848401525b50505050565b60006002820490506001821680620003a857607f821691505b60208210811415620003bf57620003be620003c5565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200042e816200034c565b81146200043a57600080fd5b50565b61108b806200044d6000396000f3fe608060405234801561001057600080fd5b50600436106100d1576000357c01000000000000000000000000000000000000000000000000000000009004806370a082311161008e57806370a08231146101c057806395d89b41146101f0578063983b2d561461020e578063a0712d681461023e578063a9059cbb1461026e578063dd62ed3e1461029e576100d1565b806306fdde03146100d6578063095ea7b3146100f457806318160ddd1461012457806323b872dd146101425780633092afd514610172578063313ce567146101a2575b600080fd5b6100de6102ce565b6040516100eb9190610e00565b60405180910390f35b61010e60048036038101906101099190610d1a565b61035c565b60405161011b9190610de5565b60405180910390f35b61012c610460565b6040516101399190610e22565b60405180910390f35b61015c60048036038101906101579190610ccb565b610466565b6040516101699190610de5565b60405180910390f35b61018c60048036038101906101879190610c66565b610778565b6040516101999190610de5565b60405180910390f35b6101aa61086a565b6040516101b79190610e3d565b60405180910390f35b6101da60048036038101906101d59190610c66565b61087d565b6040516101e79190610e22565b60405180910390f35b6101f8610895565b6040516102059190610e00565b60405180910390f35b61022860048036038101906102239190610c66565b610923565b6040516102359190610de5565b60405180910390f35b61025860048036038101906102539190610d56565b6109de565b6040516102659190610de5565b60405180910390f35b61028860048036038101906102839190610d1a565b610aae565b6040516102959190610de5565b60405180910390f35b6102b860048036038101906102b39190610c8f565b610c17565b6040516102c59190610e22565b60405180910390f35b600280546102db90610f86565b80601f016020809104026020016040519081016040528092919081815260200182805461030790610f86565b80156103545780601f1061032957610100808354040283529160200191610354565b820191906000526020600020905b81548152906001019060200180831161033757829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546103ea9190610e74565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161044e9190610e22565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156104f157600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561053d57600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105c59190610eca565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106949190610eca565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106ea9190610e74565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f939856040516107659190610e22565b60405180910390a4600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061080057508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61080957600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600460009054906101000a900460ff1681565b60066020528060005260406000206000915090505481565b600380546108a290610f86565b80601f01602080910402602001604051908101604052809291908181526020018280546108ce90610f86565b801561091b5780601f106108f05761010080835404028352916020019161091b565b820191906000526020600020905b8154815290600101906020018083116108fe57829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461097e57600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610a3657600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610a859190610e74565b925050819055508160056000828254610a9e9190610e74565b9250508190555060019050919050565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610afc57600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b4b9190610eca565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ba19190610e74565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c059190610e22565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600081359050610c4b81611027565b92915050565b600081359050610c608161103e565b92915050565b600060208284031215610c7857600080fd5b6000610c8684828501610c3c565b91505092915050565b60008060408385031215610ca257600080fd5b6000610cb085828601610c3c565b9250506020610cc185828601610c3c565b9150509250929050565b600080600060608486031215610ce057600080fd5b6000610cee86828701610c3c565b9350506020610cff86828701610c3c565b9250506040610d1086828701610c51565b9150509250925092565b60008060408385031215610d2d57600080fd5b6000610d3b85828601610c3c565b9250506020610d4c85828601610c51565b9150509250929050565b600060208284031215610d6857600080fd5b6000610d7684828501610c51565b91505092915050565b610d8881610f10565b82525050565b6000610d9982610e58565b610da38185610e63565b9350610db3818560208601610f53565b610dbc81611016565b840191505092915050565b610dd081610f3c565b82525050565b610ddf81610f46565b82525050565b6000602082019050610dfa6000830184610d7f565b92915050565b60006020820190508181036000830152610e1a8184610d8e565b905092915050565b6000602082019050610e376000830184610dc7565b92915050565b6000602082019050610e526000830184610dd6565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610e7f82610f3c565b9150610e8a83610f3c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610ebf57610ebe610fb8565b5b828201905092915050565b6000610ed582610f3c565b9150610ee083610f3c565b925082821015610ef357610ef2610fb8565b5b828203905092915050565b6000610f0982610f1c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015610f71578082015181840152602081019050610f56565b83811115610f80576000848401525b50505050565b60006002820490506001821680610f9e57607f821691505b60208210811415610fb257610fb1610fe7565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b61103081610efe565b811461103b57600080fd5b50565b61104781610f3c565b811461105257600080fd5b5056fea2646970667358221220aa98bfe5caceca50ca9e4451ff4bd48deb23fefba3bba4226d2b922d94c342a964736f6c63430008000033
-\ No newline at end of file
+60806040523480156200001157600080fd5b50604051620014ef380380620014ef83398181016040528101906200003791906200025d565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600290805190602001906200008f92919062000124565b508160039080519060200190620000a892919062000124565b5080600460006101000a81548160ff021916908360ff16021790555060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050506200047c565b828054620001329062000387565b90600052602060002090601f016020900481019282620001565760008555620001a2565b82601f106200017157805160ff1916838001178555620001a2565b82800160010185558215620001a2579182015b82811115620001a157825182559160200191906001019062000184565b5b509050620001b19190620001b5565b5090565b5b80821115620001d0576000816000905550600101620001b6565b5090565b6000620001eb620001e5846200030e565b620002e5565b9050828152602081018484840111156200020457600080fd5b6200021184828562000351565b509392505050565b600082601f8301126200022b57600080fd5b81516200023d848260208601620001d4565b91505092915050565b600081519050620002578162000462565b92915050565b6000806000606084860312156200027357600080fd5b600084015167ffffffffffffffff8111156200028e57600080fd5b6200029c8682870162000219565b935050602084015167ffffffffffffffff811115620002ba57600080fd5b620002c88682870162000219565b9250506040620002db8682870162000246565b9150509250925092565b6000620002f162000304565b9050620002ff8282620003bd565b919050565b6000604051905090565b600067ffffffffffffffff8211156200032c576200032b62000422565b5b620003378262000451565b9050602081019050919050565b600060ff82169050919050565b60005b838110156200037157808201518184015260208101905062000354565b8381111562000381576000848401525b50505050565b60006002820490506001821680620003a057607f821691505b60208210811415620003b757620003b6620003f3565b5b50919050565b620003c88262000451565b810181811067ffffffffffffffff82111715620003ea57620003e962000422565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6200046d8162000344565b81146200047957600080fd5b50565b611063806200048c6000396000f3fe608060405234801561001057600080fd5b50600436106100d1576000357c010000000000000000000000000000000000000000000000000000000090048063449a52f81161008e578063449a52f8146101c057806370a08231146101f057806395d89b4114610220578063983b2d561461023e578063a9059cbb1461026e578063dd62ed3e1461029e576100d1565b806306fdde03146100d6578063095ea7b3146100f457806318160ddd1461012457806323b872dd146101425780633092afd514610172578063313ce567146101a2575b600080fd5b6100de6102ce565b6040516100eb9190610dd8565b60405180910390f35b61010e60048036038101906101099190610d1b565b61035c565b60405161011b9190610dbd565b60405180910390f35b61012c610460565b6040516101399190610dfa565b60405180910390f35b61015c60048036038101906101579190610ccc565b610466565b6040516101699190610dbd565b60405180910390f35b61018c60048036038101906101879190610c67565b610778565b6040516101999190610dbd565b60405180910390f35b6101aa61086a565b6040516101b79190610e15565b60405180910390f35b6101da60048036038101906101d59190610d1b565b61087d565b6040516101e79190610dbd565b60405180910390f35b61020a60048036038101906102059190610c67565b61094e565b6040516102179190610dfa565b60405180910390f35b610228610966565b6040516102359190610dd8565b60405180910390f35b61025860048036038101906102539190610c67565b6109f4565b6040516102659190610dbd565b60405180910390f35b61028860048036038101906102839190610d1b565b610aaf565b6040516102959190610dbd565b60405180910390f35b6102b860048036038101906102b39190610c90565b610c18565b6040516102c59190610dfa565b60405180910390f35b600280546102db90610f5e565b80601f016020809104026020016040519081016040528092919081815260200182805461030790610f5e565b80156103545780601f1061032957610100808354040283529160200191610354565b820191906000526020600020905b81548152906001019060200180831161033757829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546103ea9190610e4c565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161044e9190610dfa565b60405180910390a36001905092915050565b60055481565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156104f157600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561053d57600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105c59190610ea2565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106949190610ea2565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106ea9190610e4c565b925050819055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f5f7542858008eeb041631f30e6109ae94b83a58e9a58261dd2c42c508850f939856040516107659190610dfa565b60405180910390a4600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061080057508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61080957600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600460009054906101000a900460ff1681565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166108d557600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109249190610e4c565b92505081905550816005600082825461093d9190610e4c565b925050819055506001905092915050565b60066020528060005260406000206000915090505481565b6003805461097390610f5e565b80601f016020809104026020016040519081016040528092919081815260200182805461099f90610f5e565b80156109ec5780601f106109c1576101008083540402835291602001916109ec565b820191906000526020600020905b8154815290600101906020018083116109cf57829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a4f57600080fd5b60018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610afd57600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b4c9190610ea2565b9250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ba29190610e4c565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c069190610dfa565b60405180910390a36001905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600081359050610c4c81610fff565b92915050565b600081359050610c6181611016565b92915050565b600060208284031215610c7957600080fd5b6000610c8784828501610c3d565b91505092915050565b60008060408385031215610ca357600080fd5b6000610cb185828601610c3d565b9250506020610cc285828601610c3d565b9150509250929050565b600080600060608486031215610ce157600080fd5b6000610cef86828701610c3d565b9350506020610d0086828701610c3d565b9250506040610d1186828701610c52565b9150509250925092565b60008060408385031215610d2e57600080fd5b6000610d3c85828601610c3d565b9250506020610d4d85828601610c52565b9150509250929050565b610d6081610ee8565b82525050565b6000610d7182610e30565b610d7b8185610e3b565b9350610d8b818560208601610f2b565b610d9481610fee565b840191505092915050565b610da881610f14565b82525050565b610db781610f1e565b82525050565b6000602082019050610dd26000830184610d57565b92915050565b60006020820190508181036000830152610df28184610d66565b905092915050565b6000602082019050610e0f6000830184610d9f565b92915050565b6000602082019050610e2a6000830184610dae565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610e5782610f14565b9150610e6283610f14565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610e9757610e96610f90565b5b828201905092915050565b6000610ead82610f14565b9150610eb883610f14565b925082821015610ecb57610eca610f90565b5b828203905092915050565b6000610ee182610ef4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015610f49578082015181840152602081019050610f2e565b83811115610f58576000848401525b50505050565b60006002820490506001821680610f7657607f821691505b60208210811415610f8a57610f89610fbf565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b61100881610ed6565b811461101357600080fd5b50565b61101f81610f14565b811461102a57600080fd5b5056fea2646970667358221220d03175765e6a0d5359f40b7022325f34ef08d464c486b4e35a0b1c8927da82f164736f6c63430008020033
+\ No newline at end of file
diff --git a/solidity/GiftableToken.json b/solidity/GiftableToken.json
@@ -1 +1 @@
-[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"removeMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
+[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"TransferFrom","type":"event"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"removeMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
diff --git a/solidity/GiftableToken.sol b/solidity/GiftableToken.sol
@@ -26,10 +26,10 @@ contract GiftableToken {
minters[msg.sender] = true;
}
- function mint(uint256 _value) public returns (bool) {
+ function mintTo(address _to, uint256 _value) public returns (bool) {
require(minters[msg.sender]);
- balanceOf[msg.sender] += _value;
+ balanceOf[_to] += _value;
totalSupply += _value;
return true;
diff --git a/solidity/Makefile b/solidity/Makefile
@@ -1,4 +1,3 @@
-#SOLC = /home/lash/build/solidity/build/solc/solc
SOLC = /usr/bin/solc
all: