Wrapped Native Integration Generator
Generate Solidity contracts that interact with the Wrapped Native (WNATIVE) contract at 0x6000030000842044000077551D00cfc6b4005900.
Project Setup
Before generating code, check the user's project is configured:
- Foundry:
foundry.tomlmust exist. If not:forge init - Wrapped Native:
lib/wrapped-native/must exist. If not:forge install limitbreakinc/wrapped-native - Remappings:
remappings.txtneeds@limitbreak/wrapped-native/=lib/wrapped-native/. Append if missing -- do not overwrite existing entries. - Local testing: For local development, use
apptoken-devto bootstrap an Anvil node with all Apptoken protocols at their deterministic addresses -- seeapptoken-general/references/project-setup.md.
Instructions
Parse integration requirements from
$ARGUMENTSResolve ambiguities before generating -- if $ARGUMENTS doesn't make the integration pattern clear (basic wrapping vs permits vs gas sponsorship), or references external addresses (fee recipients, operators) without specifying them, ask in a single message. If clear, proceed.
Determine the integration pattern based on what the user needs:
- Basic wrapping/unwrapping: Deposit, withdraw, depositTo, withdrawSplit
- Payable ERC-20 operations: Combined deposit+approve, deposit+transfer
- Permit-based gasless transfers: EIP-712 signatures for
permitTransfer - Gas sponsorship / permitted withdrawals:
doPermittedWithdrawwith convenience fees - Protocol integration: Using WNATIVE as a payment or reserve token
Generate the integration contract with:
- Correct interface import (
IWrappedNativefor basic,IWrappedNativeExtendedfor permits/enhanced features) - Proper use of
payablefunctions when combining deposit + action - Native token handling (
receive()if the contract needs to accept unwrapped native) - EIP-712 signature construction if using permits
- Correct interface import (
Handle key integration details:
- WNATIVE address is deterministic:
0x6000030000842044000077551D00cfc6b4005900 - When calling payable
transferFromwithmsg.value, deposits credit thefromaddress, NOTmsg.sender - Same for
permitTransfer-- deposits creditfrom - Contracts receiving native tokens from
withdraw/withdrawToAccountmust have areceive()orfallback()function withdrawSplitarrays must be equal length
- WNATIVE address is deterministic:
Generate a Foundry test if the integration involves non-trivial logic (permits, fee calculations, multi-step flows).
Reference Files
references/integration-patterns.md-- Common integration patterns with annotated Solidity examples- Protocol knowledge:
wrapped-native-protocol
Common Mistakes
- Forgetting that payable
transferFromandpermitTransfercredit deposits tofrom, notmsg.sender-- operator contracts will not receive the deposited funds - Not implementing
receive()on contracts that callwithdraworwithdrawToAccountto themselves -- the native transfer will revert - Using WETH9's
deposit()pattern (call + value) whendepositTowould be more gas-efficient for crediting another address - Signing permits with the wrong domain separator -- must use name
"Wrapped Native", version"1", and the deterministic contract address - Not checking
isNonceUsedbefore submitting a permit transaction -- the nonce may have been revoked or already consumed
When to Use This vs Other Skills
- This skill (wrapped-native-integrator): Generate contracts that wrap, unwrap, transfer, or permit WNATIVE tokens. Use when the core task is interacting with the Wrapped Native contract.
- lbamm-integrator: Use when building swap/liquidity integrations with LBAMM. If the pool uses WNATIVE, the LBAMM integrator handles the wrapping internally.
- tokenmaster-integrator: Use when building buy/sell/spend flows against TokenMaster. If the reserve asset is WNATIVE, the TokenMaster integrator handles it.
- payment-processor-exchange: Use when building NFT marketplace integrations. Payment Processor accepts WNATIVE directly.
Related Skills
- wrapped-native-protocol -- Deep protocol knowledge, full API reference, permit system details
- lbamm-integrator -- DEX integration (LBAMM pools may use WNATIVE)
- tokenmaster-integrator -- Token economy integration (pools may use WNATIVE as reserve)