Skip to content

Conversation

@kingster-will
Copy link
Collaborator

Summary

This PR introduces the "Wrapped IP" (WIP) token, which is based on the WETH9 and WETH9.1 implementations. The WIP token includes support for the permit (ERC-2612) and permit2 functionalities, allowing for gas-efficient approvals.

Features

  • ERC-20 Compliance: The WIP token adheres to the ERC-20 standard, ensuring compatibility with existing DeFi protocols and wallets.
  • Permit (ERC-2612): Allows for gasless approvals by signing messages off-chain.
  • Permit2: An enhanced version of the permit function for additional flexibility and security.
  • Deposit Function: Users can deposit IP tokens (gas tokens) and receive an equivalent amount of WIP tokens.
  • Withdrawal Function: Users can burn WIP tokens to receive the equivalent amount of IP tokens.

Implementation Details

  • Contract: The WIP contract is implemented in src/WIP.sol.
  • Deployment Script: A deployment script is provided in script/Deploy.s.sol to facilitate the deployment of the WIP contract.

Usage

  1. Deposit IP Tokens: Call the deposit function to convert IP tokens to WIP tokens.
  2. Withdraw IP Tokens: Call the withdraw function to convert WIP tokens back to IP tokens.
  3. Permit: Use the permit function to approve token transfers via off-chain signatures.
  4. Permit2: Use the permit2 function for enhanced approval mechanisms.

References

Example

// Example of depositing IP tokens and receiving WIP tokens
wip.deposit{value: 1 ether}();

Notes

  • This implementation prevents sending WIP tokens to the zero address or the contract itself.
  • The permit and permit2 functions enhance user experience by reducing the need for on-chain approval transactions.

@kingster-will kingster-will merged commit 686c0d2 into main Oct 16, 2024
2 checks passed
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.

4 participants