Zilliqa / ZRC

Zilliqa Reference Contracts
MIT License
40 stars 57 forks source link

Pattern/anti-pattern guide #2

Open jjcnn opened 5 years ago

jjcnn commented 5 years ago

We could use a guide to patterns/antipatterns in Scilla.

Examples:

jjcnn commented 5 years ago

Another example: Attempt to keep contracts reactive rather than active. If someone wants something from the contract, they should invoke an appropriate transition themselves. For instance, if the owners of a multi-signature wallet have approved the transfer of some money to a recipient, rather than transferring the money upon the last signature, one should let the recipient invoke the transition that executes the transfer.

edison0xyz commented 5 years ago

Good point on the part that the recipient should invoke the transition that executes the transfer.

It helps to ensure that the recipient has access to the wallet address during the withdrawal process, and prevents the possibility of funds being sent to an address that no one has access to. Always favour pulls over push if possible.