Beispiel #1
0
def many_args(
    _a: pt.abi.Uint64,
    _b: pt.abi.Uint64,
    _c: pt.abi.Uint64,
    _d: pt.abi.Uint64,
    _e: pt.abi.Uint64,
    _f: pt.abi.Uint64,
    _g: pt.abi.Uint64,
    _h: pt.abi.Uint64,
    _i: pt.abi.Uint64,
    _j: pt.abi.Uint64,
    _k: pt.abi.Uint64,
    _l: pt.abi.Uint64,
    _m: pt.abi.Uint64,
    _n: pt.abi.Uint64,
    _o: pt.abi.Uint64,
    _p: pt.abi.Uint64,
    _q: pt.abi.Uint64,
    _r: pt.abi.Uint64,
    _s: pt.abi.Uint64,
    _t: pt.abi.Uint64,
    *,
    output: pt.abi.Uint64,
) -> pt.Expr:
    return output.set(_t.get())
Beispiel #2
0
def qrem(
    a: pt.abi.Uint64,
    b: pt.abi.Uint64,
    *,
    output: pt.abi.Tuple2[pt.abi.Uint64, pt.abi.Uint64],
) -> pt.Expr:
    return pt.Seq(
        (q := pt.abi.Uint64()).set(a.get() / b.get()),
        (rem := pt.abi.Uint64()).set(a.get() % b.get()),
        output.set(q, rem),
    )
Beispiel #3
0
 def fn_2arg_1ret(
     a: pt.abi.Uint64,
     b: pt.abi.StaticArray[pt.abi.Byte, Literal[10]],
     *,
     output: pt.abi.Byte,
 ) -> pt.Expr:
     return output.set(b[a.get() % pt.Int(10)])
Beispiel #4
0
 def fn_mixed_annotations_0_with_ret(a: pt.ScratchVar, b: pt.Expr,
                                     c: pt.abi.Byte, *,
                                     output: pt.abi.Uint64) -> pt.Expr:
     return pt.Seq(
         a.store(c.get() * pt.Int(0x0FF1CE) * b),
         output.set(a.load()),
     )
Beispiel #5
0
def multiple_txn(
    appl: pt.abi.ApplicationCallTransaction,
    axfer: pt.abi.AssetTransferTransaction,
    pay: pt.abi.PaymentTransaction,
    any_txn: pt.abi.Transaction,
    *,
    output: pt.abi.Uint64,
):
    return output.set(
        appl.get().fee() + axfer.get().fee() + pay.get().fee() + any_txn.get().fee()
    )
Beispiel #6
0
 def fn_log_add(a: pt.abi.Uint64, b: pt.abi.Uint32) -> pt.Expr:
     return pt.Seq(pt.Log(pt.Itob(a.get() + b.get())), pt.Return())
Beispiel #7
0
 def fn_1arg_1ret(a: pt.abi.Uint64, *, output: pt.abi.Uint64) -> pt.Expr:
     return output.set(a)
Beispiel #8
0
def fn_2mixed_arg_1ret(a: pt.abi.Uint64, b: pt.ScratchVar, *,
                       output: pt.abi.Uint64) -> pt.Expr:
    return pt.Seq(b.store(a.encode()), output.set(a))
Beispiel #9
0
 def fn_mixed_annotation_1_with_ret(a: pt.ScratchVar, b: pt.abi.Uint64, *,
                                    output: pt.abi.Bool) -> pt.Expr:
     return output.set((a.load() + b.get()) % pt.Int(2))
Beispiel #10
0
def sub(a: pt.abi.Uint64, b: pt.abi.Uint64, *, output: pt.abi.Uint64) -> pt.Expr:
    """replace me"""
    return output.set(a.get() - b.get())
Beispiel #11
0
def txn_amount(t: pt.abi.PaymentTransaction, *, output: pt.abi.Uint64):
    return output.set(t.get().amount())
Beispiel #12
0
def not_registrable(lhs: pt.abi.Uint64, rhs: pt.Expr, *, output: pt.abi.Uint64):
    return output.set(lhs.get() * rhs)
Beispiel #13
0
def eine_constant(*, output: pt.abi.Uint64):
    return output.set(1)
Beispiel #14
0
def add(a: pt.abi.Uint64, b: pt.abi.Uint64, *, output: pt.abi.Uint64) -> pt.Expr:
    """add takes 2 integers a,b and adds them, returning the sum"""
    return output.set(a.get() + b.get())
Beispiel #15
0
 def fn_ret_add(a: pt.abi.Uint64, b: pt.abi.Uint32, *,
                output: pt.abi.Uint64) -> pt.Expr:
     return output.set(a.get() + b.get() + pt.Int(0xA190))
Beispiel #16
0
def div(a: pt.abi.Uint64, b: pt.abi.Uint64, *, output: pt.abi.Uint64) -> pt.Expr:
    return output.set(a.get() / b.get())
Beispiel #17
0
def mod(a: pt.abi.Uint64, b: pt.abi.Uint64, *, output: pt.abi.Uint64) -> pt.Expr:
    return output.set(a.get() % b.get())
Beispiel #18
0
 def fn_0arg_uint64_ret(*, output: pt.abi.Uint64) -> pt.Expr:
     return output.set(1)
Beispiel #19
0
def fn_1tt_arg_uint64_ret(x, *, output: pt.abi.Uint64) -> pt.Expr:
    return output.set(1)