Skip to content

Instantly share code, notes, and snippets.

@iamjaspreetsingh
Created October 10, 2018 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamjaspreetsingh/4510686dc94cee5facfbbdad80a163ed to your computer and use it in GitHub Desktop.
Save iamjaspreetsingh/4510686dc94cee5facfbbdad80a163ed to your computer and use it in GitHub Desktop.
Type error in the binding to into `msg`: [:0:0]: Couldn't resolve the identifier "noauth".
contract ERC777Token
(name:String ,
symbol: String,
totalSupply:Uint128,
owner : ByStr20,
granularity: Uint128)
(* Initial balance is not stated explicitly: it's initialized when creating the contract. *)
field balances : Map ByStr20 Uint128 =
let m = Emp ByStr20 Uint128 in
builtin put m owner totalSupply
field allowed : Map ByStr20 (Map ByStr20 Uint128) = Emp ByStr20 (Map ByStr20 Uint128)
field _totalSupply: Uint128 = totalSupply
transition revokeOperator (operator : ByStr20)
auth="revoked";
noauth="revoke failed";
al <- allowed;
is_operator=builtin eq operator _sender;
match is_operator with
| True=>
msg = { _tag : "Main"; _recipient : _sender; _amount : Uint128 0; authorized : noauth};
msgs = one_msg msg;
send msgs
| False=>
allowed_operators = let m = Emp ByStr20 Uint128 in builtin put m operator totalSupply ;
allowed_new = builtin remove al operator ;
allowed := allowed_new;
msg = { _tag : "Main"; _recipient : _sender; _amount : Uint128 0; authorized : auth};
msgs = one_msg msg;
send msgs
end
end
@iamjaspreetsingh
Copy link
Author

It was working for me in old ide https://ide.zilliqa.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment