Implementation of Solidity's fallback functions as a #[fallback] proc macro.
Motivation
In order to simplify the support for current Solidity proxy patterns, we need to support some sort of fallback mechanism so that a contract can act as a proxy and delegate calls to other contracts. This PR is an additive and relatively simple change that implements a mechanism similar to Solidity's fallback functions.
Implementation
All changes are modifications to the external procedural macro implementation.
Collect fallback annotations and error if there is more than one or if it has any arguments.
Emit a call to the function annotated with the fallback attribute after all the inherited methods are routed.
TODO
[ ] Add a #[fallback] section to the SDK docs.
[x] I have read the DCO and ensured that these changes comply.
Description
Implementation of Solidity's
fallback
functions as a#[fallback]
proc macro.Motivation
In order to simplify the support for current Solidity proxy patterns, we need to support some sort of fallback mechanism so that a contract can act as a proxy and delegate calls to other contracts. This PR is an additive and relatively simple change that implements a mechanism similar to Solidity's
fallback
functions.Implementation
external
procedural macro implementation.fallback
annotations and error if there is more than one or if it has any arguments.fallback
attribute after all the inherited methods are routed.TODO
#[fallback]
section to the SDK docs.