argotorg / argotorg/solidity

Support named parameters in abi.encodeCall

Open
#14,979 2 comments 1 reaction 0 assignees View on GitHub
feature
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Abstract

Add support for the following syntax:

```solidity
abi.encodeCall(fnPointer, { arg1: 1, arg2: 2 });
```

## Motivation

It is currently possible to call a function, or throw a custom error, using this syntax:
```solidity
target.fn({ arg1: 1, arg2: 2 });
revert E({ arg1: 1, arg2: 2 });
```
it would be nice to have the same syntax supported for `abi.encodeCall`

## Specification

The compiler already know how to encode the call when doing `target.fn({ arg1: 1, arg2: 2 });`. The idea is to reuse the same argument encoding logic, and return the encoded data without performing the call

## Backwards Compatibility

No issue.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Solidity compiler entry point for abi.encodeCall and the existing named-argument encoding logic used by function calls and custom errors. Add coverage for the shown syntax with matching named arguments, and verify that the result is encoded without performing a call.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
blockchain, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.