For general way of ABI to SCALE transcoding, we might need some util function like
fn ABI_to_SCALE(bytes _data, bytes _type)
The _data is the data in ABI encoding format and to be transcoded, the _type is some compact format to represent the struct of the data, both for ABI and SCALE.
The first choice would be pure solidity, but if the implementation cost too much gas, we can consider using precompile.
For example, this new added one and others https://github.com/darwinia-network/darwinia-common/pull/1186
The simple way will be summary common used Calls or structs need to be encoded in solidity.
For example, for following call
We can use some mocked enum call type for encoding, something similar to.
For general way of ABI to SCALE transcoding, we might need some util function like
The
_data
is the data in ABI encoding format and to be transcoded, the_type
is some compact format to represent the struct of the data, both for ABI and SCALE.The first choice would be pure solidity, but if the implementation cost too much gas, we can consider using precompile.