Unverified Commit 0818b714 authored by Tomáš Zemanovič's avatar Tomáš Zemanovič Committed by Raphaël Cauderlier

Manager: use 'assert' instead of 'failwith', only accept tokens on 'default' entry

parent 6241f447
...@@ -6,10 +6,26 @@ storage key_hash; ...@@ -6,10 +6,26 @@ storage key_hash;
code code
{ UNPAIR ; { UNPAIR ;
IF_LEFT IF_LEFT
{ DUUP ; { # 'do' entrypoint
IMPLICIT_ACCOUNT ; ADDRESS ; # Assert no token was sent:
# to send tokens, the default entry point should be used
PUSH mutez 0 ;
AMOUNT ;
ASSERT_CMPEQ ;
# Assert that the sender is the manager
DUUP ;
IMPLICIT_ACCOUNT ;
ADDRESS ;
SENDER ; SENDER ;
IFCMPNEQ ASSERT_CMPEQ ;
{ SENDER ; PUSH string "Only the owner can operate." ; PAIR ; FAILWITH } # Execute the lambda argument
{ UNIT ; EXEC ; PAIR }} UNIT ;
{ DROP ; NIL operation ; PAIR }}; EXEC ;
PAIR ;
}
{ # 'default' entrypoint
DROP ;
NIL operation ;
PAIR ;
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment