BCD

Tezos Contract Explorer
Search Networks Deploy
  • Home
  • /
  • Mainnet
  • /
  • youves SIRS Target Price Oracle Legacy
operations (1.07K)Storage Code Interact Tokens Fork Statistics Details
Latest
​x
88
 
1
parameter (or (or (contract %get_price nat) (contract %internal_get_price nat))
2
              (or (nat %set_lpt_total_supply) (nat %set_value_token_balance_of)));
3
storage (pair
4
          (pair (address %lp_address)
5
                (pair (address %lp_token_address) (nat %lpt_total_supply)))
6
          (pair (pair (address %value_token_address) (nat %value_token_balance_of))
7
                (pair (address %value_token_oracle_address)
8
                      (string %value_token_oracle_symbol))));
9
code { UNPAIR ;
10
       IF_LEFT
11
         { IF_LEFT
12
             { NIL operation ;
13
               DUP 3 ;
14
               CAR ;
15
               GET 3 ;
16
               CONTRACT %getTotalSupply (pair unit (contract nat)) ;
17
               IF_NONE { PUSH int 39 ; FAILWITH } {} ;
18
               PUSH mutez 0 ;
19
               SELF_ADDRESS ;
20
               CONTRACT %set_lpt_total_supply nat ;
21
               IF_NONE { PUSH int 40 ; FAILWITH } {} ;
22
               UNIT ;
23
               PAIR ;
24
               TRANSFER_TOKENS ;
25
               CONS ;
26
               DUP 3 ;
27
               GET 3 ;
28
               CAR ;
29
               CONTRACT %getBalance (pair address (contract nat)) ;
30
               IF_NONE { PUSH int 43 ; FAILWITH } {} ;
31
               PUSH mutez 0 ;
32
               SELF_ADDRESS ;
33
               CONTRACT %set_value_token_balance_of nat ;
34
               IF_NONE { PUSH int 44 ; FAILWITH } {} ;
35
               DUP 6 ;
36
               CAR ;
37
               CAR ;
38
               PAIR ;
39
               TRANSFER_TOKENS ;
40
               CONS ;
41
               SELF %internal_get_price ;
42
               PUSH mutez 0 ;
43
               DIG 3 ;
44
               TRANSFER_TOKENS ;
45
               CONS }
46
             { SELF_ADDRESS ;
47
               SENDER ;
48
               COMPARE ;
49
               EQ ;
50
               IF {} { PUSH int 400 ; FAILWITH } ;
51
               NIL operation ;
52
               SWAP ;
53
               PUSH mutez 0 ;
54
               PUSH nat 2 ;
55
               DUP 5 ;
56
               CAR ;
57
               GET 4 ;
58
               PUSH nat 1000000 ;
59
               DUP 7 ;
60
               GET 3 ;
61
               CDR ;
62
               MUL ;
63
               EDIV ;
64
               IF_NONE { PUSH int 54 ; FAILWITH } { CAR } ;
65
               DIG 5 ;
66
               DUP ;
67
               GET 5 ;
68
               SWAP ;
69
               DUP ;
70
               DUG 7 ;
71
               GET 6 ;
72
               VIEW "get_price" nat ;
73
               IF_NONE { PUSH int 502 ; FAILWITH } {} ;
74
               MUL ;
75
               MUL ;
76
               PUSH nat 100000000000000000000000000 ;
77
               EDIV ;
78
               IF_NONE { PUSH int 57 ; FAILWITH } { CAR } ;
79
               TRANSFER_TOKENS ;
80
               CONS } }
81
         { IF_LEFT
82
             { SWAP ; UNPAIR ; UNPAIR ; SWAP ; CAR ; DIG 3 ; SWAP ; PAIR ; SWAP ; PAIR ; PAIR }
83
             { SWAP ; UNPAIR ; SWAP ; UNPAIR ; CAR ; DIG 3 ; SWAP ; PAIR ; PAIR ; SWAP ; PAIR } ;
84
           NIL operation } ;
85
       NIL operation ;
86
       SWAP ;
87
       ITER { CONS } ;
88
       PAIR }