Similar to Solidity's modifiers, the only_admin
decorator would call the only_admin function before calling mint.
func only_admin():
let (caller) = get_caller_address()
let (admin) = admin.read()
with_attr error_message("Auth: not admin"):
assert caller = admin
end
end
@only_admin
func mint():
# func body...
end
Another use to synthesize getters
@getter
@storage_var
func foo() -> (value : felt):
end
Using the above @getter
decorator would automatically create a simple get_foo
function:
func get_foo() -> (value : felt):
let (value) = foo.read()
return (value)
end
I'd apprecitate just to have a way how to auto-declare a public getter for a storage_var, I have a lot of boring code just like the above.
If you can also give us a way how to run it before or after a decorated function, that would be great.
- hide implicit args, no more typing of the holy trinity
{syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_check_ptr}
- solve revoked references - newcomers to the lang get, without exception, bitten by this. I learnt to live with it but it would be much appreciated if it would get solved by the compiler
- dynamic arrays (and improve working with arrays in general) - don't be like vyper :)
- bit packing and unpacking in stdlib - everyone is building their own
- a way how to concisely update a large struct, see here
- new for (composite) structs - a way to create an empty struct so I don't have to do this
Instead of
let (caller) = get_caller_address()
owner.write(caller)
I want to be able to write
owner.write(get_caller_address())