def test_token_1(bank, registry, token_name): alice = accounts.add( 'a8060afe2390bd0c00c7ef800f545d466b55cc84d4ad6d01e03220af03e97982') bob = accounts.add( '7b9009958a83807bbe38bf35f451ff0c4bf4d926cee63dd07658762db58ceba4') # bank.deposit({'from': bob, 'value': '0.1 ether', 'gas_price':1000000000}) prevBNBBal = alice.balance() bank.work( 0, registry[token_name]['goblin'], 10**17, 0, eth_abi.encode_abi(['address', 'bytes'], [ registry[token_name]['two_side'].address, eth_abi.encode_abi(['address', 'uint256', 'uint256'], [registry[token_name]['token'], 0, 0]) ]), { 'from': alice, 'value': '0.05 ether', 'gas_price': 1000000000 }) curBNBBal = alice.balance() print('∆ ht alice', curBNBBal - prevBNBBal) pos_id = bank.nextPositionID() - 1 print('alice pos', bank.positionInfo(pos_id))
def setup(id1, id2, issuer, nft, token): for i in range(6): accounts.add() accounts[0].transfer(accounts[-1], "1 ether") issuer.addAuthority(accounts[-6:-3], [], 2000000000, 1, {'from': accounts[0]}) token.mint(accounts[2], 1000, {'from': accounts[0]}) nft.mint(accounts[2], 1000, 0, "0x00", {'from': accounts[0]})
def setup(id1, id2, org, nft, share): for i in range(6): accounts.add() accounts[0].transfer(accounts[-1], "1 ether") org.addAuthority(accounts[-6:-3], [], 2000000000, 1, {"from": accounts[0]}) share.mint(accounts[2], 1000, {"from": accounts[0]}) nft.mint(accounts[2], 1000, 0, "0x00", {"from": accounts[0]})
def main(): # set up the accounts accounts.add(os.environ['METAMASK_SECRET_KEY']) accounts.default = accounts[1] # misc shit print(network.show_active()) network.gas_limit(10000000) # intialize web3 providers web3_l1 = Web3(Web3.HTTPProvider(os.environ['PROVIDER_KOVAN'])) web3_l2 = Web3(Web3.HTTPProvider('https://kovan.optimism.io')) assert web3_l1.isConnected() assert web3_l2.isConnected() # debug some accounts shit # print(web3_l1.eth.Eth.accounts) # need the ABI and bytecode for each of the following contracts: # ERC20.sol -- token # L2DepositedERC20.sol -- gateway # all are accessible via the brownie contract objects # deploy the L1 token tx_hash = web3_l2.eth.contract( abi=ERC20.abi, bytecode=ERC20.bytecode).constructor(69000,'ELMO').transact( {'from': str(accounts.default)} ) addr_token_l1 = web3_l1.eth.get_transaction_receipt(tx_hash)['contractAddress'] print('Done!')
def main(): print(network.show_active()) network.gas_limit(10000000) accounts.add(os.environ['METAMASK_SECRET_KEY']) accounts.default = accounts[1] ERC20.deploy(69000, 'ELMO', {'from': accounts.default})
def setup(issuer): for i in range(3): accounts.add() accounts[0].transfer(accounts[-1], "1 ether") sigs = (issuer.signatures['setAuthoritySignatures'], issuer.signatures['setAuthorityApprovedUntil'], issuer.signatures['setAuthorityThreshold']) issuer.addAuthority((accounts[-2], ), sigs, 2000000000, 1, {'from': accounts[0]}) issuer.addAuthority((accounts[-1], accounts[-3]), sigs, 2000000000, 1, {'from': accounts[0]})
def main(): skey = os.environ['PRIVATE_KEY'] accounts.add(skey) network_name = network.show_active() if network_name == 'ropsten': operator_address = ROPSTEN_RANDOM_BEACON_OPERATOR_ADDRESS elif network_name == 'mainnet': operator_address = MAINNET_RANDOM_BEACON_OPERATOR_ADDRESS else: raise ValueError(f"unsupported network {network}") BulkClaimer.deploy(operator_address, {'from': accounts[0]}, publish_source=True) # noqa: E501
def main(): load_dotenv('.env') accounts.add(getenv('acct0_pk')) eth_amb_addr = "0xD4075FB57fCf038bFc702c915Ef9592534bED5c1" xdai_amb_addr = "0xc38D4991c951fE8BCE1a12bEef2046eF36b0FA4A" d = shelve.open('addresses') d['eth_amb_addr'] = eth_amb_addr d['xdai_amb_addr'] = xdai_amb_addr #deploy MainnetMediator mainnetMediator = MainnetMediator.deploy({"from": accounts[0]}) d['mainnetMediator'] = mainnetMediator.address
def setup(org, share): for i in range(10): accounts.add() sigs = ( org.signatures["addAuthorityAddresses"], org.signatures["removeAuthorityAddresses"], ) org.addAuthority([accounts[-2]], sigs, 2000000000, 1, {"from": accounts[0]}) org.addAuthority([accounts[-1]], sigs, 2000000000, 1, {"from": accounts[0]}) accounts[0].transfer(accounts[-2], "1 ether") accounts[0].transfer(accounts[-1], "1 ether")
def setup(org): for i in range(3): accounts.add() accounts[0].transfer(accounts[-1], "1 ether") sigs = ( org.signatures["setAuthoritySignatures"], org.signatures["setAuthorityApprovedUntil"], org.signatures["setAuthorityThreshold"], ) org.addAuthority((accounts[-2],), sigs, 2000000000, 1, {"from": accounts[0]}) org.addAuthority( (accounts[-1], accounts[-3]), sigs, 2000000000, 1, {"from": accounts[0]} )
def setup(issuer, token): for i in range(10): accounts.add() sigs = ( issuer.signatures['addAuthorityAddresses'], issuer.signatures['removeAuthorityAddresses'], ) issuer.addAuthority([accounts[-2]], sigs, 2000000000, 1, {'from': accounts[0]}) issuer.addAuthority([accounts[-1]], sigs, 2000000000, 1, {'from': accounts[0]}) accounts[0].transfer(accounts[-2], "1 ether") accounts[0].transfer(accounts[-1], "1 ether")
def main(): dev = accounts.add(os.getenv(config['wallets']['from_key'])) print(network.show_active()) return VRFConsumer.deploy( config['networks'][network.show_active()]['keyhash'], config['networks'][network.show_active()]['vrf_coordinator'], config['networks'][network.show_active()]['link_token'], {'from': dev})
def get_owner_account(priv_key_path_env_var: str = "DEPLOYMENT_PRIV_KEY_PATH", priv_key_pwd_env_var: str = "DEPLOYMENT_PRIV_KEY_PWD"): priv_key_path = os.environ.get(priv_key_path_env_var, None) if priv_key_path: _priv_key_path = os.path.abspath( os.path.expanduser(os.path.expandvars(priv_key_path))) # IF env var to key file is provided priv_key_pwd = os.environ.get(priv_key_pwd_env_var, None) if priv_key_pwd is None: print( f'The DEPLOYMENT_PRIV_KEY_PWD env var is not defined, trying to proceed with prompting ' f'password from stdin.') priv_key_pwd = getpass.getpass("Password for private key: ") with open(_priv_key_path) as f: encr_pk_json = json.load(f) pk = Account.decrypt(encr_pk_json, priv_key_pwd) owner = accounts.add(pk) else: print( f'The DEPLOYMENT_PRIV_KEY_PATH env var is not defined, trying to proceed with web3 provider accounts.' ) # If not use default accounts owner = accounts[0] print(f'owner: {owner}') return owner
def main(): dev = accounts.add(config["wallets"]["from_key"]) # Get the most recent PriceFeed Object vrf_contract = VRFConsumer[len(VRFConsumer) - 1] interface.LinkTokenInterface( config["networks"][network.show_active()]["link_token"]).transfer( vrf_contract, 1000000000000000000, {"from": dev})
def main(): dev = accounts.add(os.getenv(config['wallets']['from_key'])) return FraxsesNft.deploy( #config['networks'][network.show_active()]['oracle'], #config['networks'][network.show_active()]['jobId'], #config['networks'][network.show_active()]['fee'], {'from': dev})
def initiateSIGHBoosterContract(): if network.show_active() == 'mainnet-fork' or network.show_active( ) == 'development': return deployScript(accounts[0]) elif network.show_active() == 'kovan': dev = accounts.add(os.getenv('PRIVATE_KEY')) return deployScript(dev)
def main(): print(os.getenv("cat")) dev = accounts.add(os.getenv(config['wallets']['from_key'])) print(network.show_active()) simple_collectible = SimpleCollectible.deploy({'from': dev}) simple_collectible.createCollectible("None") print(simple_collectible.ownerOf(0))
def deploySIGHFinance(): if network.show_active() == 'mainnet-fork' or network.show_active( ) == 'development': return deployScript(accounts[0]) elif network.show_active() == 'kovan': dev = accounts.add(os.getenv('PRIVATE_KEY')) return deployScript(dev)
def deploySIGHBoosterContracts(): if network.show_active() == 'mainnet-fork' or network.show_active( ) == 'development': return deployScript(accounts[0]) elif network.show_active() == 'live': ac = accounts.add(os.getenv('PRIVATE_KEY')) return deployScript(ac)
def main(): dev = accounts.add(os.getenv(config['wallets']['from_key'])) # Get the most recent PriceFeed Object vrf_contract = VRFConsumer[len(VRFConsumer) - 1] interface.LinkTokenInterface( config['networks'][network.show_active()]['link_token']).transfer( vrf_contract, 1000000000000000000, {'from': dev})
def initializeSIGHBoostersSalesContract(): boosterContract = boosters.initiateSIGHBoosterContract() # FIRST INITIALIZE THE SIGH BOOSTERS CONTRACT if network.show_active() == 'mainnet-fork' or network.show_active()== 'development': return deployScript(boosterContract,accounts[0]) elif network.show_active() == 'kovan': dev = accounts.add(os.getenv('PRIVATE_KEY')) return deployScript(boosterContract,dev)
def main(): dev = accounts.add(os.getenv(config['wallets']['from_key'])) # Get the most recent PriceFeed Object geo_db = GeoDB[len(GeoDB) - 1] geo_db.requestUsers({'from': dev}) time.sleep(25) print(geo_db.users())
def set_tokenURI(token_id, nft_contract, tokenURI): dev = accounts.add(config["wallets"]["from_key"]) nft_contract.setTokenURI(token_id, tokenURI, {"from": dev}) print("Awesome! You can view your NFT at {}".format( OPENSEA_FORMAT.format(nft_contract.address, token_id))) print( 'Please give up to 20 minutes, and hit the "refresh metadata" button.')
def main(): dev = accounts.add(os.getenv('PRIVATE_KEY')) # Get the most recent PriceFeed Object api_contract = APIConsumer[len(APIConsumer) - 1] interface.LinkTokenInterface( config['networks'][network.show_active()]['link_token']).transfer( api_contract, 1000000000000000000, {'from': dev}) print("Funded {}".format(api_contract.address))
def main(): dev = accounts.add(os.getenv(config['wallets']['from_key'])) # Get the most recent ExerciseTokenClaim Object exercise_token_claim_contract = ExerciseTokenClaim[len(ExerciseTokenClaim) - 1] interface.LinkTokenInterface(config['networks'][network.show_active()]['link_token']).transfer( exercise_token_claim_contract, 1000000000000000000, {'from': dev}) print("Funded {}".format(exercise_token_claim_contract.address))
def get_account(): if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS: return accounts[0] if network.show_active() in config["networks"]: dev_account = accounts.add(config["wallets"]["from_key"]) return dev_account else: pytest.skip("Invalid network/wallet specified ")
def main(): dev = accounts.add(config["wallets"]["from_key"]) # Get the most recent PriceFeed Object api_contract = APIConsumer[len(APIConsumer) - 1] interface.LinkTokenInterface( config["networks"][network.show_active()]["link_token"]).transfer( api_contract, 1000000000000000000, {"from": dev}) print("Funded {}".format(api_contract.address))
def get_account(index=None, id=None): if index: return accounts[index] if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS: return accounts[0] if id: return accounts.load(id) return accounts.add(config["wallets"]["from_key"])
def main(): dev = accounts.add(os.getenv(config['wallets']['from_key'])) # Get the most recent PriceFeed Object advanced_collectible = AdvancedCollectible[len(AdvancedCollectible) - 1] interface.LinkTokenInterface( config['networks'][network.show_active()]['link_token']).transfer( advanced_collectible, config['networks'][network.show_active()]['fee'], {'from': dev})
def fund_advanced_collectible(nft_contract): dev = accounts.add(config["wallets"]["from_key"]) # Get the most recent PriceFeed Object interface.LinkTokenInterface( config["networks"][network.show_active()]["link_token"] ).transfer( nft_contract, config["networks"][network.show_active()]["fee"], {"from": dev} )