OpenZeppelin / OpenZeppelin/openzeppelin-upgrades

Proxies with receive() function

Open
#591 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
658
Forks
286
PR merge metrics
No merged PRs in 30d

Description

Now that we have an easy way to verify proxies on Etherscan we can more freely experiment with different kinds of proxies.

Something that sometimes comes up is the desire to have a proxy with the ability to receive native token transferred using Solidity .transfer or .send which send a small gas stipend that isn't enough to pay for delegatecall. This can be fixed by adding receive() {} to the proxy itself, so that it doesn't need to trigger delegatecall. (Example support question)

We can consider offering a proxy with this functionality built in, as a kind of proxy deployment, e.g. kind: 'payable-uups'.

Moreover, we can automatically detect if this kind needs to be used and can be used safely, if the implementation contract has an empty receive() {} function. Though in this case the receive would never be triggered, it serves to declare the intent (note: it may add some minor execution cost and bytecode size to the contract).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named. Start by reviewing the proxy deployment path and the Solidity receive behavior described in the issue, then clarify whether the scope is a payable-UUPS kind, automatic detection, or both. Done should include agreed behavior and tests for native-token transfers using transfer or send.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity, typescript
Domain
blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.