Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ERC-3009: Move to Draft #504

Closed
wants to merge 15 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ERCS/erc-3009.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
title: Transfer With Authorization
author: Peter Jihoon Kim (@petejkim), Kevin Britz (@kbrizzle), David Knott (@DavidLKnott)
discussions-to: https://github.com/ethereum/EIPs/issues/3010
status: Stagnant
status: Draft
type: Standards Track
category: ERC
created: 2020-09-28
requires: 20, 712
---

## Simple Summary

Check failure on line 13 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

body has extra section(s)

error[markdown-order-section]: body has extra section(s) --> ERCS/erc-3009.md | 13 | ## Simple Summary | ::: ERCS/erc-3009.md | 392 | ## Implementation | = help: see https://ethereum.github.io/eipw/markdown-order-section/

A contract interface that enables transferring of fungible assets via a signed authorization.

Expand Down Expand Up @@ -41,7 +41,7 @@

This can be especially problematic if the gas prices are very high and transactions often get queued up and remain unconfirmed for a long time. Non-sequential nonces allow users to create as many transactions as they want at the same time.

The ERC-20 allowance mechanism is susceptible to the [multiple withdrawal attack](https://blockchain-projects.readthedocs.io/multiple_withdrawal.html)/[SWC-114](https://swcregistry.io/docs/SWC-114), and encourages antipatterns such as the use of the "infinite" allowance. The wide-prevalence of upgradeable contracts have made the conditions favorable for these attacks to happen in the wild.

Check failure on line 44 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> ERCS/erc-3009.md | 44 | The ERC-20 allowance mechanism is susceptible to the [multiple withdrawal attack](https://blockchain-projects.readthedocs.io/multiple_withdrawal.html)/[SWC-114](https://swcregistry.io/docs/SWC-114), and encourages antipatterns such as the use of the "infinite" allowance. The wide-prevalence of upgradeable contracts have made the conditions favorable for these attacks to happen in the wild. | = help: see https://ethereum.github.io/eipw/markdown-rel-links/

The deficiencies of the ERC-20 allowance pattern brought about the development of alternative token standards such as the [ERC-777](./eip-777) and [ERC-677](https://github.com/ethereum/EIPs/issues/677). However, they haven't been able to gain much adoption due to compatibility and potential security issues.

Expand Down Expand Up @@ -310,9 +310,9 @@

## Backwards Compatibility

New contracts benefit from being able to directly utilize EIP-3009 in order to create atomic transactions, but existing contracts may still rely on the conventional ERC-20 allowance pattern (`approve`/`transferFrom`).

Check failure on line 313 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

the first match of the given pattern must be a link

error[markdown-link-first]: the first match of the given pattern must be a link --> ERCS/erc-3009.md | 313 | New contracts benefit from being able to directly utilize EIP-3009 in order to create atomic transactions, but existing contracts may still rely on the conventional ERC-20 allowance pattern (`approve`/`transferFrom`). | = info: the pattern in question: `(?i)(?:eip|erc)-[0-9]+` = help: see https://ethereum.github.io/eipw/markdown-link-first/

In order to add support for EIP-3009 to existing contracts ("parent contract") that use the ERC-20 allowance pattern, a forwarding contract ("forwarder") can be constructed that takes an authorization and does the following:

Check failure on line 315 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

the first match of the given pattern must be a link

error[markdown-link-first]: the first match of the given pattern must be a link --> ERCS/erc-3009.md | 315 | In order to add support for EIP-3009 to existing contracts ("parent contract") that use the ERC-20 allowance pattern, a forwarding contract ("forwarder") can be constructed that takes an authorization and does the following: | = info: the pattern in question: `(?i)(?:eip|erc)-[0-9]+`

1. Extract the user and deposit amount from the authorization
2. Call `receiveWithAuthorization` to transfer specified funds from the user to the forwarder
Expand Down Expand Up @@ -387,11 +387,11 @@

## Test Cases

See [EIP3009.test.ts](https://github.com/CoinbaseStablecoin/eip-3009/blob/master/test/EIP3009.test.ts).

Check failure on line 390 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

proposals must be referenced with the form `EIP-N` (not `EIPN` or `EIP N`)

error[markdown-re-eip-dash]: proposals must be referenced with the form `EIP-N` (not `EIPN` or `EIP N`) --> ERCS/erc-3009.md | 390 | See [EIP3009.test.ts](https://github.com/CoinbaseStablecoin/eip-3009/blob/master/test/EIP3009.test.ts). | = info: the pattern in question: `(?i)eip[\s]*[0-9]+` = help: see https://ethereum.github.io/eipw/markdown-re-eip-dash/

## Implementation

**EIP3009.sol**

Check failure on line 394 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

proposals must be referenced with the form `EIP-N` (not `EIPN` or `EIP N`)

error[markdown-re-eip-dash]: proposals must be referenced with the form `EIP-N` (not `EIPN` or `EIP N`) --> ERCS/erc-3009.md | 394 | **EIP3009.sol** | = info: the pattern in question: `(?i)eip[\s]*[0-9]+`
```solidity
abstract contract EIP3009 is IERC20Transfer, EIP712Domain {
// keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
Expand Down Expand Up @@ -454,7 +454,7 @@
}
```

**IERC20Transfer.sol**

Check failure on line 457 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

proposals must be referenced with the form `ERC-N` (not `ERCN` or `ERC N`)

error[markdown-re-erc-dash]: proposals must be referenced with the form `ERC-N` (not `ERCN` or `ERC N`) --> ERCS/erc-3009.md | 457 | **IERC20Transfer.sol** | = info: the pattern in question: `(?i)erc[\s]*[0-9]+` = help: see https://ethereum.github.io/eipw/markdown-re-erc-dash/
```solidity
abstract contract IERC20Transfer {
function _transfer(
Expand All @@ -465,14 +465,14 @@
}
```

**EIP712Domain.sol**

Check failure on line 468 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

proposals must be referenced with the form `EIP-N` (not `EIPN` or `EIP N`)

error[markdown-re-eip-dash]: proposals must be referenced with the form `EIP-N` (not `EIPN` or `EIP N`) --> ERCS/erc-3009.md | 468 | **EIP712Domain.sol** | = info: the pattern in question: `(?i)eip[\s]*[0-9]+`
```solidity
abstract contract EIP712Domain {
bytes32 public DOMAIN_SEPARATOR;
}
```

**EIP712.sol**

Check failure on line 475 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

proposals must be referenced with the form `EIP-N` (not `EIPN` or `EIP N`)

error[markdown-re-eip-dash]: proposals must be referenced with the form `EIP-N` (not `EIPN` or `EIP N`) --> ERCS/erc-3009.md | 475 | **EIP712.sol** | = info: the pattern in question: `(?i)eip[\s]*[0-9]+`
```solidity
library EIP712 {
// keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
Expand All @@ -494,8 +494,8 @@
EIP712_DOMAIN_TYPEHASH,
keccak256(bytes(name)),
keccak256(bytes(version)),
address(this),
bytes32(chainId)
bytes32(chainId),
address(this)
)
);
}
Expand All @@ -521,7 +521,7 @@
}
```

A fully working implementation of EIP-3009 can be found in [this repository](https://github.com/CoinbaseStablecoin/eip-3009/blob/master/contracts/lib/EIP3009.sol). The repository also includes [an implementation of EIP-2612](https://github.com/CoinbaseStablecoin/eip-3009/blob/master/contracts/lib/EI32612.sol) that uses the EIP-712 library code presented above.

Check failure on line 524 in ERCS/erc-3009.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

the first match of the given pattern must be a link

error[markdown-link-first]: the first match of the given pattern must be a link --> ERCS/erc-3009.md | 524 | A fully working implementation of EIP-3009 can be found in [this repository](https://github.com/CoinbaseStablecoin/eip-3009/blob/master/contracts/lib/EIP3009.sol). The repository also includes [an implementation of EIP-2612](https://github.com/CoinbaseStablecoin/eip-3009/blob/master/contracts/lib/EI32612.sol) that uses the EIP-712 library code presented above. | = info: the pattern in question: `(?i)(?:eip|erc)-[0-9]+`

## Security Considerations

Expand Down
Loading