Skip to content

Conversation

@hamdiallam
Copy link
Contributor

@hamdiallam hamdiallam commented Apr 7, 2025

/**
 * @title ERC20Reference
 * @notice An ERC20 that is a remote reference of a native ERC20 on its home chain. This can be thought
 *         about in the traditional sense of a pointer reference. On the home chain, any user can create
 *         an acquireable reference to their ERC20 for a given spender, acquired via `transferFrom()`.
 *         However, all `transfer()` calls incur a "dereference" back to the home chain to natively
 *         transfer the ERC20 to the desired recipient, backed by Superchain Message Passing. As a result,
 *         an ERC20 can be remotely controlled by an account without fungible wrapped representations.
 */
contract ERC20Reference is ERC20 {}

Copy link
Contributor Author

hamdiallam commented Apr 7, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 7, 2025

Deploying supersim with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1ac71e0
Status: ✅  Deploy successful!
Preview URL: https://4876563d.supersim.pages.dev
Branch Preview URL: https://phantom-superchain-erc20.supersim.pages.dev

View logs

@hamdiallam hamdiallam force-pushed the phantom_superchain_erc20 branch from 101d07a to a408858 Compare April 7, 2025 17:20
@hamdiallam hamdiallam changed the base branch from main to supersim_promise.sol April 7, 2025 17:20
import {IL2ToL2CrossDomainMessenger} from "@contracts-bedrock-interfaces/L2/IL2ToL2CrossDomainMessenger.sol";
import {Predeploys} from "@contracts-bedrock/libraries/Predeploys.sol";

contract PhantomSuperchainERC20 is ERC20 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry that this ERC20 is too feature rich and will cause foot guns. For example things that won't work well:

  • Approve
  • TotalSupply

because they will all return values which seem correct but actually are broken. If you give someone an API, they will use it even if you don't intend for them to use it.

I think a way to adjust this is to actually revert if anything is called that we can't support 1:1 with an ERC20. That way, when integrating this into an existing application we can also get noisy errors if someone integrates the phantom and then their tests fail because they use approve

Oh another note -- the API we support is actually a bit nuanced because we don't actually fully support transferFrom or balanceOf. We ONLY support transferFrom(addr) or balanceOf(addr) if the addr==the contract which is using the token. So we should enforce that behavior as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea 100%, inheriting ERC20 here was just to bootstrap this implementation and not concern myself with having erc20 stuff implemented.

transferFrom: agreed we should not implement this. However this API could by default be the crossDomainDepositFrom in the context of the phantom token to remotely transfer the funds into a recipient address. Kinda fits the name nicely. Only the messenger would be authorized as msg.sender.

++1 on approvals and such

@hamdiallam hamdiallam changed the title prototype: phantom superchain erc20 prototype: remote superchain erc20 Apr 10, 2025
@hamdiallam hamdiallam force-pushed the phantom_superchain_erc20 branch from 8a726f1 to a2317fa Compare April 10, 2025 15:46
@hamdiallam hamdiallam force-pushed the phantom_superchain_erc20 branch from 0584150 to 0ec7efe Compare April 10, 2025 18:20
@hamdiallam hamdiallam force-pushed the phantom_superchain_erc20 branch from e68584a to 1ac71e0 Compare April 14, 2025 21:13
@hamdiallam hamdiallam changed the base branch from supersim_promise.sol to graphite-base/373 June 9, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants