C3N
A French government authority (cybercrime unit) deployed a smart contract on Tezos.
Below is the Michelson of the contract (see it on better call dev):
1
{
2
{ { DUP ; CAR ; DIP { CDR } } ; { DUP ; CAR @newadmin ; DIP { CDR } } ; DIP { { DUP ; CAR @oldhash ; DIP { CDR @newhash } } } ; DIP { DIP { DIP { { DUP ; CAR @storedadmin ; DIP { CDR @storedhash } } } } } } ;
3
SWAP ;
4
{ DIP { DIP { DIP { SWAP } } } } ;
5
{ DIP { DIP { SWAP } } } ;
6
DIP { SWAP } ;
7
{ DIP { DIP { DIP { SWAP } } } } ;
8
{ DIP { DIP { SWAP ; DUP ; DIP { SWAP } } } } ;
9
{
10
{ COMPARE ; EQ } ;
11
IF { }
12
$ELSE { { UNIT ; FAILWITH } }
13
} ;
14
SENDER ;
15
SWAP ;
16
{ DIP { DIP { PUSH @admin bool false } } } ;
17
ITER { DIP { DUP } ; { COMPARE ; EQ } ; SWAP ; DIP { OR @admin } } ;
18
DROP ;
19
{
20
IF { }
21
$ELSE { { UNIT ; FAILWITH } }
22
} ;
23
IF_NONE { }
24
$ELSE { DIP { DROP } } ;
25
NIL operation ;
26
{ DIP { PAIR %admin %hash } ; PAIR %op }
27
}
Copied!
Below is the transcription to Archetype:
1
archetype c3n
2
3
/* michelson source : https://better-call.dev/main/KT1Gbu1Gm2U47Pmq9VP7ZMy3ZLKecodquAh4/script */
4
5
variable admins : list<address> = [caller]
6
7
variable hash : bytes = 0x050100000009617263686574797065
8
9
entry register (newadmins : option<list<address>> , oldhash : bytes, newhash : bytes) {
10
require {
11
r1: oldhash = hash;
12
r2: contains(admins,caller);
13
}
14
effect {
15
hash := newhash;
16
if issome(newadmins) then admins := opt_get(newadmins)
17
}
18
}
Copied!
Last modified 1yr ago
Export as PDF
Copy link