Exemplo n.º 1
0
def solo_wallet():
    return Wallet.fromMnemonic(
        [
            "denial",
            "kitchen",
            "pet",
            "squirrel",
            "other",
            "broom",
            "bar",
            "gas",
            "better",
            "priority",
            "spoil",
            "cross",
        ]
    )
SCRIPT_NAME = sys.argv[0]
NETWORK = sys.argv[1]  # eg. 'https://solo.veblocks.net'
PRIVATE_KEY = sys.argv[2]
FACTORY_FILE = sys.argv[3]
FACTORY_ADDRESS = sys.argv[4]
token_1_address = sys.argv[5]
token_2_address = sys.argv[6]

if not token_1_address:
    raise Exception("fill out the token 1 smart contract address")

if not token_2_address:
    raise Exception("fill out the token 2 smart contract address")

# Prepare wallet and network
w = Wallet.fromPrivateKey(bytes.fromhex(PRIVATE_KEY))
c = Connect(NETWORK)
factory_contract = Contract.fromFile(FACTORY_FILE)

if not utils.is_contract(c.get_account(FACTORY_ADDRESS)):
    raise Exception(f"{FACTORY_ADDRESS} is not a smart contract")

if not utils.is_contract(c.get_account(token_1_address)):
    raise Exception(f"{token_1_address} is not a smart contract")

if not utils.is_contract(c.get_account(token_2_address)):
    raise Exception(f"{token_2_address} is not a smart contract")

# Call on factory to create a pool of token 1 and token 2
response = c.transact(w, factory_contract, 'createPair',
                      [token_1_address, token_2_address], FACTORY_ADDRESS)
connector = Connect("http://localhost:8669")

# VTHO token contract address
vtho_contract_address = "0x0000000000000000000000000000456e65726779"

# Set up the VTHO contract object
vtho_contract = Contract.fromFile("./VTHO.json")

# Set up the sender's wallet
sender = Wallet.fromMnemonic([
    "denial",
    "kitchen",
    "pet",
    "squirrel",
    "other",
    "broom",
    "bar",
    "gas",
    "better",
    "priority",
    "spoil",
    "cross",
])

# Set up the receiver's wallet (a brand new wallet)
receiver = Wallet.newWallet()

# Try to transfer 3 vtho from sender to receiver
if __name__ == "__main__":

    # Do: transfer 3 VTHO
    response = connector.transact(
Exemplo n.º 4
0
def clean_wallet():
    return Wallet.newWallet()
Exemplo n.º 5
0
def mainnet_wallet():
    return Wallet.fromPrivateKey(
        bytes.fromhex(
            "dce1443bd2ef0c2631adc1c67e5c93f13dc23a41c18b536effbbdcbcdb96fb65"
        )
    )