The Axelar cross-chain integration work needs the Ethereum ABI.encode() and ABI.decode() functionality made available, ideally as a native Cadence language function owing to the difficulty of implementing the same logic directly in Cadence code due to the byte level handling. This need will doubtless also arise for other aspects of EVM integration in future since ABIs are very common.
Problem statement
ABI (Application Binary Interface) is the standard for interacting with Ethereum smart contracts. Data is encoded based on its type, and because the encoded result doesn't contain type information, it is necessary to indicate their types when decoding.
Proposed solution
Introduce two natively-implemented methods on the EVM contract, for ABI encoding/decoding:
EVM.encodeABI
EVM.decodeABI
A sample usage of the two above functions can be seen below:
// Encode & decode `String`, `UInt64` and `Bool`
var data = EVM.encodeABI(["John Doe", UInt64(33), false])
let types = [Type<String>(), Type<UInt64>(), Type<Bool>()]
var values = EVM.decodeABI(types, data: data)
// Assert the decoded values
assert(values.length == 3)
assert((values[0] as! String) == "John Doe")
assert((values[1] as! UInt64) == UInt64(33))
assert((values[2] as! Bool) == false)
We make use of Cadence type-system, and map each supported type to its Solidity counterpart.
Impact
These functions would allow developers to create data packages that would be portable between Flow and EVM as well as generate EVM function calls/signatures on Flow.
Properly meter the computation of these 2 functions, based on the encoded/decoded payload
2 weeks
-
2500 $
Total funding proposed: 7000 $
Team
Name
Role
Bio
Contact
Ardit Marku
Back-end Engineer
A seasoned back-end engineer with a focus on problem solving and designing robust software systems. Over 9 years of experience building high-traffic search engines, marketplaces, exchanges and in-house analytics solutions. Led cross-functional teams to deliver both web and mobile apps, participating in all steps of the software development lifecycle. Open source lover and advocate.
ABI encoding/decoding functionality for Cadence
Grant category
Please select one:
Description
The Axelar cross-chain integration work needs the Ethereum
ABI.encode()
andABI.decode()
functionality made available, ideally as a native Cadence language function owing to the difficulty of implementing the same logic directly in Cadence code due to the byte level handling. This need will doubtless also arise for other aspects of EVM integration in future since ABIs are very common.Problem statement
ABI
(Application Binary Interface) is the standard for interacting with Ethereum smart contracts. Data is encoded based on its type, and because the encoded result doesn't contain type information, it is necessary to indicate their types when decoding.Proposed solution
Introduce two natively-implemented methods on the
EVM
contract, forABI
encoding/decoding:EVM.encodeABI
EVM.decodeABI
A sample usage of the two above functions can be seen below:
We make use of Cadence type-system, and map each supported type to its Solidity counterpart.
Impact
These functions would allow developers to create data packages that would be portable between
Flow
andEVM
as well as generateEVM
function calls/signatures onFlow
.Milestones and funding
Total funding proposed: 7000 $
Team