Skip to content

JhChoy/6909-to-20

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

6909-to-20

Foundry License: GPL v2 Solidity

ERC6909 to ERC20 converter using ERC-7511 minimal proxy clones for gas-efficient token wrapping.

This smart contract allows you to wrap ERC6909 tokens into ERC20 tokens using ERC-7511 minimal proxy clones for gas-efficient deployment.

Inspired by the Gnosis 1155-to-20 converter, adapted for the ERC6909 multi-token standard.

Requirements

  • The ERC6909 token must implement IERC6909Metadata interface for automatic metadata wrapping

Deployment

Uses CreateX for deterministic cross-chain deployments.

Environment Setup

# Copy environment template
cp .env.example .env

Fill in your .env file:

PRIVATE_KEY=your_private_key_here
RPC_URL=your_rpc_url_here

Deploy

# Set your desired network RPC URL in .env and run:
./script/deploy.sh

The script will deploy the factory contract on the block explorer.

Features

  • Gas Efficient: Uses ERC-7511 minimal proxy with PUSH0 optimization (saves 200 gas at deployment, 5 gas at runtime)
  • Deterministic Addresses: Predictable wrapper addresses
  • Metadata Preservation: Automatically wraps original token metadata

Usage

// Wrap ERC6909 tokens (without initial deposit - just creates wrapper)
Wrapped6909Factory factory = new Wrapped6909Factory();
address wrappedToken = factory.wrap6909(erc6909Address, tokenId, 0);

// Wrap ERC6909 tokens with deposit
address wrappedTokenWithDeposit = factory.wrap6909(erc6909Address, tokenId, amount);

// Deposit ERC6909 → mint ERC20
IWrapped6909(wrappedToken).depositFor(recipient, amount);

// Withdraw ERC20 → burn and get ERC6909
IWrapped6909(wrappedToken).withdrawTo(recipient, amount);

Development

git clone JhChoy/6909-to-20
cd 6909-to-20
forge test

Deployed Addresses

Mainnet (1): 0x9050b0A12D92b8ba7369ecc87BcD04643Fa0CfDB

Sepolia (11155111): 0x9050b0A12D92b8ba7369ecc87BcD04643Fa0CfDB

Arbitrum (42161): 0x9050b0A12D92b8ba7369ecc87BcD04643Fa0CfDB

Arbitrum Sepolia (421614): 0x9050b0A12D92b8ba7369ecc87BcD04643Fa0CfDB

Base (8453): 0x9050b0A12D92b8ba7369ecc87BcD04643Fa0CfDB

Monad Mainnet (143) 0x9050b0A12D92b8ba7369ecc87BcD04643Fa0CfDB

Monad Testnet (10143): 0x9050b0A12D92b8ba7369ecc87BcD04643Fa0CfDB

References

License

GPL-2.0-or-later