thanks to the magic of lisp and a relatively simple macro, these two code samples are fully equivalent its like if I told you Clojurescript has native support for EVM contracts Lisp lets you make that feel like a reality. Lisp macros let you modify the language itself.
In both cases, the end result is a constructor which gives me an object I can call all these functions on but the version using defcontract is much easier to read and write this lets your business logic focus on what matters, your boilerplate gets generated for you
if you were writing code for multiple contracts, which of the two examples I showed you would you rather write over and over? which would you rather review in a PR? macros dont fix everything, but they are a powerful tool for reducing complexity in your business logic
I forgot to include the abi definition in the first screenshot which literally doubles the length of the code sample lmao you get the point readable code good. boilerplate makes your brain skip over stuff. macros help remove boilerplate to make your code more readable
2,53K