You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In OpenBrush 4.0-beta it is possible to avoid boilerplate code with usage of implementation macro, but currently it only works with OpenBrush native traits. If some projects want to separate logics of custom trait implementation and actual contract file, there will still be a lot of boilerplate code, that should be written manually. We can resolve this issue in the following way:
Create something like trait_implementation macro that will be used on TraitImpl. It will have the parameter - the actual trait naming, for which implementation is described.
trait_implementation macro will generate functional macro, like trait_impl!(Contract) that will generate
Thanks for starting this. IMHO all solutions will be stubs while we wait for the proper/fix of the trait system in ink! itself. Tracking issue: use-ink/ink#1689
Seems reasonable like this but how do you deal with payable functions ?
We can add the payable marker that will work inside the trait_implementation macro, so messages that are payable will be generated also as #[ink(payable)]
Thanks for starting this. IMHO all solutions will be stubs while we wait for the proper/fix of the trait system in ink! itself. Tracking issue: paritytech/ink#1689
That's true, but until this issue in ink! is not fixed, we still can implement our own solution for this
In OpenBrush 4.0-beta it is possible to avoid boilerplate code with usage of
implementation
macro, but currently it only works with OpenBrush native traits. If some projects want to separate logics of custom trait implementation and actual contract file, there will still be a lot of boilerplate code, that should be written manually. We can resolve this issue in the following way:trait_implementation
macro that will be used onTraitImpl
. It will have the parameter - the actual trait naming, for which implementation is described.trait_implementation
macro will generate functional macro, liketrait_impl!(Contract)
that will generateimplementation
macro, and it will use it on storage structThe text was updated successfully, but these errors were encountered: