x
62
parameter (or (address %add_in_whitelist)
(or (string %default) (address %remove_in_whitelist)));
storage (pair (address %owner) (pair (string %storage) (set %whitelist address)));
code { UNPAIR ;
IF_LEFT
{ SENDER ;
DUP 3 ;
CAR ;
COMPARE ;
EQ ;
IF {} { PUSH string "Only the owner can update the whitelist" ; FAILWITH } ;
SWAP ;
DUP ;
DUG 2 ;
GET 4 ;
SWAP ;
DUP ;
DUG 2 ;
MEM ;
IF { PUSH string "User already in the whitelist" ; FAILWITH } {} ;
SWAP ;
DUP ;
GET 4 ;
PUSH bool True ;
DIG 3 ;
UPDATE ;
UPDATE 4 }
{ IF_LEFT
{ SWAP ;
DUP ;
DUG 2 ;
GET 4 ;
SENDER ;
MEM ;
IF {} { PUSH string "Sender not in the whitelist" ; FAILWITH } ;
UPDATE 3 }
{ SENDER ;
DUP 3 ;
CAR ;
COMPARE ;
EQ ;
IF
{}
{ PUSH string "Only the owner can update the whitelist" ; FAILWITH } ;
SWAP ;
DUP ;
DUG 2 ;
GET 4 ;
SWAP ;
DUP ;
DUG 2 ;
MEM ;
IF {} { PUSH string "User already in the whitelist" ; FAILWITH } ;
SWAP ;
DUP ;
GET 4 ;
PUSH bool False ;
DIG 3 ;
UPDATE ;
UPDATE 4 } } ;
NIL operation ;
PAIR }