CityOfZion / neo3-boa

Write smart contracts for Neo3 in python
Apache License 2.0
38 stars 21 forks source link

Custom python style decorators #574

Open merl111 opened 3 years ago

merl111 commented 3 years ago

Is it planned to implement custom python style decorators?

A very simple use case I can think of would be to implement something like that:

from boa3.builtin import CreateNewEvent, public

def onlyOwner(): 
    # do owner check and abort if false                              
    pass                                       

@onlyOwner                                     
@public                                        
def withdraw() -> bool:                        
    pass                                       

I know it's just sugar coating and functional everything can be done without decorators, I am just curious, and I think it might help with the readability of contracts.

I don't have a solution ready, but I could probably help if someone would be able to guide me a little.

melanke commented 1 year ago

This might be implemented in the future but it has a low priority