Nativo Wrapper

Nativo Wrapper

Nativo, an advanced ERC20 token, enhances Wrapped Ether with gas-efficient operations, flash loans, ERC20Permit, payable token functionalities for smoother DeFi transactions

The problem Nativo Wrapper solves

Nativo serves as a modernized version of Wrapped Ether (WETH), improving upon its existing functionalities and offering a more gas-efficient alternative for the DeFi space. Here's how Nativo can be utilized:

  1. ERC20 Compliance: Nativo is fully ERC20 compliant, making it compatible with any contract or DApp that uses the ERC20 standard. This allows for seamless interaction and reduced transaction friction across the Ethereum ecosystem.

  2. Improved UX with Advanced Methods: Nativo introduces novel methods such as

    depositTo

    ,

    withdrawTo

    , and

    withdrawFromTo

    . These functionalities enable more direct and efficient transfer of tokens, making the wrapping and unwrapping process simpler and faster for users.

  3. ERC20Permit and ERC-1363 Support: Nativo supports ERC20Permit (EIP2612), enabling token approvals through off-chain signatures, and ERC-1363, allowing post-transfer action execution. These features offer users greater flexibility and improved user experience.

  4. Flash Loans (ERC-3156): By implementing ERC-3156, Nativo allows users to borrow an arbitrary amount of Wrapped Ether, unbacked by actual Ether, with the condition that it is burned before the end of the transaction. This can provide unique arbitrage opportunities in the DeFi space.

  5. Gas Efficiency: With several gas optimization techniques and deployment on vanity addresses across chains, Nativo achieves significant gas savings, reducing the cost of transactions for users.

In essence, Nativo simplifies the use of wrapped tokens on Ethereum, improves the interoperability of the Ethereum ecosystem, and enhances transaction efficiency. Whether it's staking, providing liquidity, or interacting with DApps, Nativo aims to make these tasks more accessible, efficient, and cost-effective.

Challenges we ran into

One of the main challenges encountered during the development of Nativo was related to slots and storage layout, especially considering the deployment across multiple chains. As you might know, contract storage is a key aspect to consider when writing and deploying contracts in Solidity. Mismanagement of storage, particularly when dealing with complex contract upgrades, can potentially lead to severe issues.

When we initially developed and tested Nativo, we discovered some inconsistencies in the way data was being stored and accessed. This was traced back to the improper use of storage slots, leading to overwriting of storage values in certain cases, which is a critical bug.

Overcoming this challenge required a deep understanding of how Solidity manages storage at a low level. Through detailed analysis of our contract's storage layout, we were able to identify the source of the problem and reorganize our storage structures in a way that prevented any possible overwrites.

This process highlighted the importance of maintaining a solid and consistent testing strategy. Thanks to our extensive test coverage and invariant testing approach, we were able to detect and address these issues promptly. Such testing methodologies are crucial in the blockchain development space due to the immutable nature of smart contracts.

Discussion