1import smartpy as sp
2
3
4@sp.module
5def main():
6 dest1 = sp.address("tz1M9CMEtsXm3QxA7FmMU2Qh7xzsuGXVbcDr")
7 dest2 = sp.address("tz1YtuZ4vhzzn7ssCt93Put8U9UJDdvCXci4")
8
9 class C1(sp.Contract):
10 @sp.entrypoint
11 def ep(self):
12 sp.send(dest1, sp.tez(1))
13
14 class C2(sp.Contract):
15 @sp.entrypoint
16 def ep(self, cond):
17 if cond == True:
18 sp.send(dest2, sp.tez(2))
19
20 class C3(sp.Contract):
21 @sp.entrypoint
22 def ep1(self):
23 sp.send(dest1, sp.tez(1))
24
25 @sp.entrypoint
26 def ep2(self):
27 pass
28
29 class C4(sp.Contract):
30 @sp.entrypoint
31 def ep1(self):
32 sp.send(dest1, sp.tez(1))
33
34 @sp.entrypoint
35 def ep2(self, cond):
36 if cond == True:
37 sp.send(dest2, sp.tez(2))
38
39 class C5(sp.Contract):
40 @sp.entrypoint
41 def ep(self, params):
42 if params == True:
43 sp.send(dest1, sp.tez(1))
44 else:
45 assert params == False
46
47 class C6(sp.Contract):
48 @sp.entrypoint
49 def ep(self):
50 c = sp.contract(sp.int, dest1, entrypoint="myEntryPoint")
51 sp.transfer(-42, sp.mutez(0), c.unwrap_some())
52
53
54@sp.add_test()
55def test():
56 scenario = sp.test_scenario("Send", main)
57 scenario.h1("Send")
58 scenario += main.C1()
59 scenario += main.C2()
60 scenario += main.C3()
61 scenario += main.C4()
62 scenario += main.C5()
63 scenario += main.C6()