BCD

Tezos Contract Explorer
Search Networks Deploy
  • Home
  • /
  • Ghostnet
  • /
  • KT1R4i4...GLuu
operations (1.96K)Storage Code Interact Tokens Fork Views Statistics Details
Latest
​x
52
 
1
{ parameter (or (unit %deposit) (unit %withdraw)) ;
2
  storage (big_map address mutez) ;
3
  code { UNPAIR ;
4
         IF_LEFT
5
           { DROP ;
6
             PUSH mutez 0 ;
7
             AMOUNT ;
8
             COMPARE ;
9
             LE ;
10
             IF
11
               { DROP ; PUSH string "Send some tez to this entrypoint." ; FAILWITH }
12
               { DUP ;
13
                 SENDER ;
14
                 GET ;
15
                 IF_NONE { AMOUNT } { AMOUNT ; ADD } ;
16
                 SOME ;
17
                 SENDER ;
18
                 UPDATE ;
19
                 NIL operation ;
20
                 PAIR } }
21
           { DROP ;
22
             PUSH mutez 0 ;
23
             AMOUNT ;
24
             COMPARE ;
25
             GT ;
26
             IF
27
               { DROP ; PUSH string "Do not send tez to this entrypoint" ; FAILWITH }
28
               { DUP ;
29
                 SENDER ;
30
                 GET ;
31
                 IF_NONE
32
                   { DROP ; PUSH string "You do not currently have a balance." ; FAILWITH }
33
                   { SWAP ;
34
                     SENDER ;
35
                     PAIR ;
36
                     PUSH string "Account not found" ;
37
                     SENDER ;
38
                     CONTRACT unit ;
39
                     IF_NONE { FAILWITH } { SWAP ; DROP } ;
40
                     DIG 2 ;
41
                     UNIT ;
42
                     TRANSFER_TOKENS ;
43
                     SWAP ;
44
                     UNPAIR ;
45
                     NONE mutez ;
46
                     SWAP ;
47
                     UPDATE ;
48
                     NIL operation ;
49
                     DIG 2 ;
50
                     CONS ;
51
                     PAIR } } } } ;
52
  view "balance" address mutez { UNPAIR ; GET ; IF_NONE { PUSH mutez 0 } {} } }