def bond_exchange_contract(payment_gateway_address, personalinfo_address, exchange_regulator_service_address): deployer = eth_account['deployer'] issuer = eth_account['issuer'] trader = eth_account['trader'] web3.eth.defaultAccount = deployer['account_address'] storage_address, _ = Contract.deploy_contract( 'ExchangeStorage', [], deployer['account_address']) args = [ payment_gateway_address, personalinfo_address, storage_address, exchange_regulator_service_address ] contract_address, abi = Contract.deploy_contract( 'IbetStraightBondExchange', args, deployer['account_address']) storage = Contract.get_contract('ExchangeStorage', storage_address) storage.functions.upgradeVersion(contract_address).transact( {'from': deployer['account_address'], 'gas': 4000000} ) # 取引参加者登録 ExchangeRegulatorService = \ Contract.get_contract('ExchangeRegulatorService', exchange_regulator_service_address) ExchangeRegulatorService.functions.register(issuer['account_address'], False). \ transact({'from': deployer['account_address'], 'gas': 4000000}) ExchangeRegulatorService.functions.register(trader['account_address'], False). \ transact({'from': deployer['account_address'], 'gas': 4000000}) return {'address': contract_address, 'abi': abi}
def tokenlist_contract(): deployer = eth_account['deployer'] web3.eth.defaultAccount = deployer['account_address'] contract_address, abi = Contract.deploy_contract( 'TokenList', [], deployer['account_address']) return {'address': contract_address, 'abi': abi}
def personalinfo_contract(): deployer = eth_account['deployer'] web3.eth.defaultAccount = deployer['account_address'] contract_address, abi = Contract.deploy_contract( 'PersonalInfo', [], deployer['account_address']) return {'address': contract_address, 'abi': abi}
def membership_exchange_contract(payment_gateway_address): deployer = eth_account['deployer'] web3.eth.defaultAccount = deployer['account_address'] storage_address, _ = Contract.deploy_contract( 'ExchangeStorage', [], deployer['account_address']) args = [ payment_gateway_address, storage_address ] contract_address, abi = Contract.deploy_contract( 'IbetMembershipExchange', args, deployer['account_address']) storage = Contract.get_contract('ExchangeStorage', storage_address) storage.functions.upgradeVersion(contract_address).transact( {'from': deployer['account_address'], 'gas': 4000000} ) return {'address': contract_address, 'abi': abi}
def issue_bond_token(invoker, attribute): web3.eth.defaultAccount = invoker['account_address'] interestPaymentDate = json.dumps( { 'interestPaymentDate1': attribute['interestPaymentDate1'], 'interestPaymentDate2': attribute['interestPaymentDate2'], 'interestPaymentDate3': attribute['interestPaymentDate3'], 'interestPaymentDate4': attribute['interestPaymentDate4'], 'interestPaymentDate5': attribute['interestPaymentDate5'], 'interestPaymentDate6': attribute['interestPaymentDate6'], 'interestPaymentDate7': attribute['interestPaymentDate7'], 'interestPaymentDate8': attribute['interestPaymentDate8'], 'interestPaymentDate9': attribute['interestPaymentDate9'], 'interestPaymentDate10': attribute['interestPaymentDate10'], 'interestPaymentDate11': attribute['interestPaymentDate11'], 'interestPaymentDate12': attribute['interestPaymentDate12'], } ) arguments = [ attribute['name'], attribute['symbol'], attribute['totalSupply'], attribute['faceValue'], attribute['redemptionDate'], attribute['redemptionValue'], attribute['returnDate'], attribute['returnAmount'], attribute['purpose'] ] contract_address, abi = Contract.deploy_contract( 'IbetStraightBond', arguments, invoker['account_address'] ) # その他項目の更新 TokenContract = Contract.get_contract('IbetStraightBond', contract_address) TokenContract.functions.setTradableExchange(attribute['tradableExchange']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) TokenContract.functions.setInterestRate(attribute['interestRate']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) TokenContract.functions.setInterestPaymentDate(interestPaymentDate). \ transact({'from': invoker['account_address'], 'gas': 4000000}) TokenContract.functions.setMemo(attribute['memo']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) TokenContract.functions.setContactInformation(attribute['contactInformation']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) TokenContract.functions.setPrivacyPolicy(attribute['privacyPolicy']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) TokenContract.functions.setPersonalInfoAddress(attribute['personalInfoAddress']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) return {'address': contract_address, 'abi': abi}
def issue_coupon_token(invoker, attribute): web3.eth.defaultAccount = invoker['account_address'] arguments = [ attribute['name'], attribute['symbol'], attribute['totalSupply'], attribute['tradableExchange'], attribute['details'], attribute['returnDetails'], attribute['memo'], attribute['expirationDate'], attribute['transferable'], attribute['contactInformation'], attribute['privacyPolicy'] ] contract_address, abi = Contract.deploy_contract( 'IbetCoupon', arguments, invoker['account_address']) return {'address': contract_address, 'abi': abi}
def otc_exchange_contract(payment_gateway_address, personalinfo_address, exchange_regulator_service_address): deployer = eth_account['deployer'] web3.eth.defaultAccount = deployer['account_address'] storage_address, _ = Contract.deploy_contract( 'OTCExchangeStorage', [], deployer['account_address']) args = [ payment_gateway_address, personalinfo_address, storage_address, exchange_regulator_service_address ] contract_address, abi = Contract.deploy_contract( 'IbetOTCExchange', args, deployer['account_address']) storage = Contract.get_contract('OTCExchangeStorage', storage_address) storage.functions.upgradeVersion(contract_address).transact( {'from': deployer['account_address'], 'gas': 4000000} ) return {'address': contract_address, 'abi': abi}
def exchange_regulator_service_contract(): deployer = eth_account['deployer'] web3.eth.defaultAccount = deployer['account_address'] contract_address, abi = Contract.deploy_contract( 'ExchangeRegulatorService', [], deployer['account_address']) exchange_regulator_service = Contract.get_contract('ExchangeRegulatorService', contract_address) web3.eth.defaultAccount = deployer['account_address'] exchange_regulator_service.functions.register(eth_account['issuer']['account_address'], False).\ transact({'from': deployer['account_address'], 'gas': 4000000}) exchange_regulator_service.functions.register(eth_account['trader']['account_address'], False).\ transact({'from': deployer['account_address'], 'gas': 4000000}) return {'address': contract_address, 'abi': abi}
def payment_gateway_contract(): deployer = eth_account['deployer'] agent = eth_account['agent'] web3.eth.defaultAccount = deployer['account_address'] contract_address, abi = Contract.deploy_contract( 'PaymentGateway', [], deployer['account_address']) contract = Contract.get_contract('PaymentGateway', contract_address) tx_hash = contract.functions.addAgent(agent['account_address']).transact( {'from': deployer['account_address'], 'gas': 4000000} ) web3.eth.waitForTransactionReceipt(tx_hash) return {'address': contract_address, 'abi': abi}
def issue(tx_from: str, args: Dict): web3.eth.defaultAccount = tx_from # issue arguments = [ args["name"], args["symbol"], args["issuePrice"], args["totalSupply"], args["dividends"], args["dividendRecordDate"], args["dividendPaymentDate"], args["cancellationDate"], args["principalValue"] ] contract_address, abi = Contract.deploy_contract( contract_name="IbetShare", args=arguments, deployer=tx_from ) # update TokenContract = Contract.get_contract( contract_name="IbetShare", address=contract_address ) if "tradableExchange" in args: TokenContract.functions.setTradableExchange(args["tradableExchange"]). \ transact({"from": tx_from, "gas": gas_limit}) if "personalInfoAddress" in args: TokenContract.functions.setPersonalInfoAddress(args["personalInfoAddress"]). \ transact({"from": tx_from, "gas": gas_limit}) if "contactInformation" in args: TokenContract.functions.setContactInformation(args["contactInformation"]). \ transact({"from": tx_from, "gas": gas_limit}) if "privacyPolicy" in args: TokenContract.functions.setPrivacyPolicy(args["privacyPolicy"]). \ transact({"from": tx_from, "gas": gas_limit}) if "memo" in args: TokenContract.functions.setMemo(args["memo"]). \ transact({"from": tx_from, "gas": gas_limit}) if "transferable" in args: TokenContract.functions.setTransferable(args["transferable"]). \ transact({"from": tx_from, "gas": gas_limit}) return {"address": contract_address, "abi": abi}
def issue_share_token(invoker, attribute): web3.eth.defaultAccount = invoker['account_address'] arguments = [ attribute['name'], attribute['symbol'], attribute['issuePrice'], attribute['totalSupply'], attribute['dividends'], attribute['dividendRecordDate'], attribute['dividendPaymentDate'], attribute['cancellationDate'], attribute['principalValue'] ] contract_address, abi = Contract.deploy_contract( contract_name='IbetShare', args=arguments, deployer=invoker['account_address'] ) TokenContract = Contract.get_contract('IbetShare', contract_address) if 'tradableExchange' in attribute: TokenContract.functions.setTradableExchange(to_checksum_address(attribute['tradableExchange'])). \ transact({'from': invoker['account_address'], 'gas': 4000000}) if 'personalInfoAddress' in attribute: TokenContract.functions.setPersonalInfoAddress(to_checksum_address(attribute['personalInfoAddress'])). \ transact({'from': invoker['account_address'], 'gas': 4000000}) if 'contactInformation' in attribute: TokenContract.functions.setContactInformation(attribute['contactInformation']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) if 'privacyPolicy' in attribute: TokenContract.functions.setPrivacyPolicy(attribute['privacyPolicy']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) if 'memo' in attribute: TokenContract.functions.setMemo(attribute['memo']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) if 'transferable' in attribute: TokenContract.functions.setTransferable(attribute['transferable']). \ transact({'from': invoker['account_address'], 'gas': 4000000}) time.sleep(3) return {'address': contract_address, 'abi': abi}