def __init__(self, oracle): self.init( oracle = oracle, currencyPair = sp.string(""), value = sp.nat(0), precision = sp.nat(0), timestamp = sp.timestamp(0), source = sp.string(""))
def test(): scenario = sp.test_scenario() scenario.h1("Minimal") c1 = EthClientOnTezos() scenario += c1 scenario += c1.increment(sp.record(block = sp.record(hash = sp.string('sdhkf')) )) scenario += c1 scenario += c1.add_block_header(sp.record(block = sp.record(parent_hash = sp.string('sdfsdf'), header_hash = sp.string('dfsdf'),header_number = 8)))
def test(): c = myContract() secret = sp.string('My secret message') password = sp.string('avada_kedavra') packed = sp.pack(secret) + sp.pack(password) hashed = sp.sha256(packed) scenario = sp.test_scenario() scenario.register(c, show=True) # same as scenario += c c.store_hash(hashed)
def __init__(self): self.init(storedValue = 0, latest_block =0, sample_hash = sp.string('0x'), # Hash of the header that has the highest cumulative difficulty. The current head of the canonical chain header_hash = sp.string('0x'), # Hashes of the canonical chain mapped to their numbers. Stores up to `hashes_gc_threshold` entries header number -> header hash canonical_header_hashes = sp.map(tkey= sp.TNat , tvalue=sp.TString), # All known header hashes for a block number. Stores up to `finalized_gc_threshold`. # header number -> hashes of all headers with this number. # used in the relayer to backtrack if chain switched the fork. known_hashes = sp.big_map(tkey = sp.TNat, tvalue= hash_set_type), # Number of confirmations that applications can use to consider the transaction safe.For most use cases 25 should be enough, for super safe cases it should be 500. num_confirmations=2 )
def test(): alice = sp.test_account('Alice') bob = sp.test_account('Bob') ts = sp.timestamp(0) c = myContract() scenario = sp.test_scenario() scenario.register(c, show = True) # same as scenario += c c.register(login = alice.address, name = sp.string('Alice')).run(now = ts) ts = ts.add_days(1) c.register(login = bob.address, name = sp.string('Bob')).run(now = ts) ts = ts.add_days(2) c.visit(alice.address).run(amount = sp.tez(5), now = ts) c.visit(alice.address).run(amount = sp.tez(5), now = ts, valid = False) ts = ts.add_days(4) c.visit(alice.address).run(amount = sp.tez(3), now = ts, valid = False) ts = ts.add_days(7) c.visit(alice.address).run(amount = sp.tez(3), now = ts) ts = ts.add_days(11) c.visit(alice.address).run(amount = sp.tez(3), now = ts) c.visit(bob.address).run(amount = sp.tez(3), now = ts, valid = False) c.visit(bob.address).run(amount = sp.tez(5), now = ts) c.visit(bob.address).run(amount = sp.tez(15), now = ts, valid = False) ts = ts.add_days(12) c.visit(bob.address).run(amount = sp.tez(3), now = ts)
def __init__(self): self.init(votesRecord= sp.map(tkey = sp.TString , tvalue = sp.TInt), description = sp.string(''), owner= sp.string(''))
def __init__(self): self.init(comments =sp.string(""),value = sp.int(0))
def check_metadata_list(l): res = sp.local("toks", sp.string("")) sp.for md in l: res.value = sp.concat([md.symbol, res.value]) sp.verify((md.symbol == "TK0") | (md.symbol == "TK1"))
def check_metadata_list(l): res = sp.local("toks", sp.string("")) sp.verify(sp.len(l) == 1) sp.for md in l: sp.verify((md.symbol == "FSCK") & (md.name == "Fishcake"))