2018-04-05 17:17:27 +02:00
|
|
|
# (signed hash of the string, string)
|
2017-10-30 10:22:16 +01:00
|
|
|
parameter (option (pair signature int));
|
|
|
|
storage (pair key int);
|
|
|
|
code {DUP; DUP; CAR;
|
|
|
|
IF_NONE {PUSH tez "1.00"; # Fee pattern from July 26
|
|
|
|
AMOUNT; CMPLE; IF {FAIL} {};
|
|
|
|
# Provide the data
|
|
|
|
CDR; DIP {CDDR}}
|
|
|
|
{DUP; DIP{SWAP}; SWAP; CDAR; # Move key to the top
|
|
|
|
DIP {DUP; CAR; DIP {CDR; H}; PAIR}; # Arrange the new piece of data
|
|
|
|
CHECK_SIGNATURE; # Check to ensure the data is authentic
|
|
|
|
# Update data
|
|
|
|
IF {CDR; SWAP; DIP{DUP}; CDAR; PAIR}
|
|
|
|
# Revert the update. This could be replaced with FAIL
|
|
|
|
{DROP; DUP; CDR; DIP{CDDR}}};
|
|
|
|
# Cleanup
|
2018-04-05 17:17:27 +02:00
|
|
|
DIP{DROP}; NIL operation; PAIR}
|