How does one call an entrypoint of an existing contract using SmartPy?
For example, I'd like to be able to write a contract that calls the getBalance
method of the existing ETHtz FA1.2 contract and stores the return value in local state.
In other words, I'd like to complete this code:
import smartpy as sp
class MyETHtzBalanceContract(sp.Contract):
def __init__(self):
self.init(num_ethtz = 0)
@sp.entry_point
def set_balance(self, ethtz_holder_address):
# The address of the ETHtz FA1.2 contract.
ethtz = sp.address("KT19at7rQUvyjxnZ2fBv7D9zc8rkyG7gAoU8")
# How do I get this value for account `ethtz_holder_address`?
# Note the ethtz contract defines a `getBalance` entrypoint of type
# `(pair %getBalance (address :owner) (contract nat))`.
self.data.num_ethtz = ...
BTW, I'm using the SmartPy web IDE.
Thanks!