Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Jun 10, 2024
1 parent 8f15f1f commit b2d4966
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .changeset/serious-carrots-provide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'openzeppelin-solidity': minor
---

`ERC7674`: Add an ERC-20 extension that implements temporary approval using transient storage (draft).
`ERC20TemporaryApproval`: Add an ERC-20 extension that implements temporary approval using transient storage (draft).
10 changes: 5 additions & 5 deletions contracts/token/ERC20/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Additionally there are multiple custom extensions, including:
* {ERC20FlashMint}: token level support for flash loans through the minting and burning of ephemeral tokens (standardized as ERC-3156).
* {ERC20Votes}: support for voting and vote delegation.
* {ERC20Wrapper}: wrapper to create an ERC-20 backed by another ERC-20, with deposit and withdraw methods. Useful in conjunction with {ERC20Votes}.
* {ERC20TemporaryApproval}: support for approvals lasting for only one transaction, as defined in ERC-7674.
* {ERC1363}: support for calling the target of a transfer or approval, enabling code execution on the receiver within a single transaction.
* {ERC4626}: tokenized vault that manages shares (represented as ERC-20) that are backed by assets (another ERC-20).
* {ERC7674}: support for approvals lasting for only one transaction, as defined in ERC-7674.
Finally, there are some utilities to interact with ERC-20 contracts in various ways:

Expand Down Expand Up @@ -56,18 +56,18 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel

{{ERC20Pausable}}

{{ERC20FlashMint}}

{{ERC20Votes}}

{{ERC20Wrapper}}

{{ERC20FlashMint}}

{{ERC20TemporaryApproval}}

{{ERC1363}}

{{ERC4626}}

{{ERC7674}}

== Utilities

{{SafeERC20}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import {StorageSlot} from "../../../utils/StorageSlot.sol";
*
* WARNING: This is a draft contract. The corresponding ERC is still subject to changes.
*/
abstract contract ERC7674 is ERC20, IERC7674 {
abstract contract ERC20TemporaryApproval is ERC20, IERC7674 {
using SlotDerivation for bytes32;
using StorageSlot for bytes32;
using StorageSlot for StorageSlot.Uint256SlotType;

// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC7674")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ERC7674_STORAGE = 0xf9459e0e3709f2b5aaa798666bbb2eb0d06d2c3958e71e4a32973e445fe1ce00;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20_TEMPORARY_APPROVAL_STORAGE")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ERC20_TEMPORARY_APPROVAL_STORAGE =
0xea2d0e77a01400d0111492b1321103eed560d8fe44b9a7c2410407714583c400;

/**
* @dev {allowance} override that includes the temporary allowance when looking up the current allowance. If
Expand Down Expand Up @@ -110,6 +111,6 @@ abstract contract ERC7674 is ERC20, IERC7674 {
address owner,
address spender
) private pure returns (StorageSlot.Uint256SlotType) {
return ERC7674_STORAGE.deriveMapping(owner).deriveMapping(spender).asUint256();
return ERC20_TEMPORARY_APPROVAL_STORAGE.deriveMapping(owner).deriveMapping(spender).asUint256();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function fixture() {
const accounts = await ethers.getSigners();
const [holder, recipient, other] = accounts;

const token = await ethers.deployContract('$ERC7674', [name, symbol]);
const token = await ethers.deployContract('$ERC20TemporaryApproval', [name, symbol]);
await token.$_mint(holder, initialSupply);

const spender = await ethers.deployContract('$Address');
Expand All @@ -24,7 +24,7 @@ async function fixture() {
return { accounts, holder, recipient, other, token, spender, batch, getter };
}

describe('ERC7674', function () {
describe('ERC20TemporaryApproval', function () {
beforeEach(async function () {
Object.assign(this, await loadFixture(fixture));
});
Expand Down

0 comments on commit b2d4966

Please sign in to comment.