mirror of
https://github.com/chaintool-py/eth-erc20.git
synced 2026-05-14 03:18:42 +02:00
Rewrite contract, new license, adds settable minters
This commit is contained in:
45
python/LICENSE
Normal file
45
python/LICENSE
Normal file
@@ -0,0 +1,45 @@
|
||||
Bprotocol Foundation (Bancor) LICENSE
|
||||
|
||||
1. SUBJECT TO THE PROVISIONS SET FORTH HEREIN, INCLUDING “EFFECTIVE DATE”, YOU CAN
|
||||
USE THIS CODE, FILE AND/OR SOFTWARE (“SOFTWARE”) ONLY IN CONNECTION WITH THE
|
||||
BANCOR LIQUIDITY NETWORK AND/OR THE USE OF BNT ("PERMITTED USE"). ANY OTHER USE IS
|
||||
PROHIBITED UNLESS THE USER SHALL RECEIVE AN EXPLICIT PRIOR WRITTEN APPROVAL FROM
|
||||
BPROTOCOL FOUNDATION (BANCOR) TO DO SO (PLEASE CONTACT license@bancor.network IN
|
||||
THIS REGARD), WHICH APPROVAL, IF GIVEN, MAY REQUIRE THE OBTAINMENT OF SEPARATE
|
||||
LICENSE UNDER A DIFFERENT LICENSING MODEL. USING THIS SOFTWARE NOT IN THE FRAME OF
|
||||
SUCH PERMITTED USE MAY, AMONG OTHERS, ALSO BREACH PATENT RIGHTS CONCERNING PATENTS
|
||||
WHICH ARE EMBODIED/INCORPORATED/USED IN THIS SOFTWARE.
|
||||
|
||||
2. ANY SUCH PERMITTED USE SHOULD ALSO COMPLY WITH THE TERMS BELOW.
|
||||
|
||||
3. Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
A. Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
B. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
C. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
EFFECTIVE DATE: THIS LICENSE SHALL APPLY ONLY TO SOFTWARE (OR ANY VERSION THEREOF),
|
||||
THAT HAS BEEN PUBLISHED AFTER THE DATE AND TIME THIS LICENSE HAS BEEN FIRST PUBLISHED
|
||||
(“EFFECTIVE DATE”); Any previous versions published prior to the effective date (“Older Versions”)
|
||||
shall remain licensed under the Apache License, Version 2.0 (the "Older Versions License");
|
||||
You may obtain a copy of the Older Version License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
you may not use this file except in compliance with the Older Version License. Unless
|
||||
required by applicable law or agreed to in writing, Older Versions distributed under the
|
||||
Older Version License are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
OF ANY KIND, either express or implied. See the Older Version License for the specific
|
||||
language governing permissions and limitations under the Older Version License.
|
||||
@@ -24,11 +24,11 @@ logging.getLogger('urllib3').setLevel(logging.WARNING)
|
||||
|
||||
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('-g', '--gift', dest='g', action='store_true', help='If set, tokens will be gifted to all accounts in provider wallet')
|
||||
argparser.add_argument('-n', '--name', dest='n', default='Giftable Token', type=str, help='Token name')
|
||||
argparser.add_argument('-s', '--symbol', dest='s', default='GFT', type=str, help='Token symbol')
|
||||
argparser.add_argument('-d', '--decimals', dest='d', default=18, type=int, help='Token decimals')
|
||||
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('-v', action='store_true', help='Be verbose')
|
||||
argparser.add_argument('amount', type=int, help='Initial token supply (will be owned by contract creator)')
|
||||
@@ -51,25 +51,34 @@ def main():
|
||||
w3.eth.defaultAccount = w3.eth.accounts[0]
|
||||
|
||||
c = w3.eth.contract(abi=abi, bytecode=bytecode)
|
||||
tx_hash = c.constructor(args.n, args.s, args.d, args.amount).transact()
|
||||
tx_hash = c.constructor(args.n, args.s, args.d).transact()
|
||||
rcpt = w3.eth.getTransactionReceipt(tx_hash)
|
||||
address = rcpt.contractAddress
|
||||
c = w3.eth.contract(abi=abi, address=address)
|
||||
|
||||
logg.debug('construct tx {} address {}'.format(tx_hash.hex(), address))
|
||||
|
||||
balance = c.functions.balanceOf(w3.eth.defaultAccount).call()
|
||||
logg.info('balance {}: {}'.format(w3.eth.defaultAccount, balance))
|
||||
logg.info('balance {}: {} {}'.format(w3.eth.defaultAccount, balance, tx_hash))
|
||||
|
||||
|
||||
if args.a != None:
|
||||
for a in args.a:
|
||||
if a == w3.eth.defaultAccount:
|
||||
continue
|
||||
tx_hash = c.functions.gift(a, args.amount).transact()
|
||||
tx_hash_mint = c.functions.mint(args.amount).transact()
|
||||
tx_hash_transfer = c.functions.transfer(a, args.amount).transact()
|
||||
rcpt = w3.eth.getTransactionReceipt(tx_hash)
|
||||
balance = c.functions.balanceOf(a).call()
|
||||
logg.info('balance {}: {}'.format(a, balance))
|
||||
|
||||
if args.m != None:
|
||||
for a in args.m:
|
||||
if a == w3.eth.defaultAccount:
|
||||
continue
|
||||
tx_hash_minter = c.functions.addMinter(a).transact()
|
||||
logg.info('minter {}'.format(a))
|
||||
|
||||
print(address)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user