Giter Club home page Giter Club logo

weth10's Introduction

WETH10

This twitter hackathon project ๐Ÿฆ updates the canonical "Wrapped Ether" WETH(9) contract with minor but significant upgrades to save Ethereum network users gas and time in making transactions with tokenized ETH on lo-trust, lo-code ๐Ÿฌโ›ฝ.

Mainnet deployment of commit (34d2712) ๐Ÿ”จ. The contract has been deployed at the same address in Kovan, Goerli, Rinkeby and Ropsten.

Total Supply

The supply of WETH10 is capped at type(uint112).max.

Wrapping Ether

Any operation that ends with this contract holding Wrapped Ether is prohibited.

deposit Ether in this contract to receive Wrapped Ether (WETH), which implements the ERC20 standard. WETH is interchangeable with Ether in a 1:1 basis.

withdraw Ether from this contract by unwrapping WETH from your wallet.

The depositTo and withdrawTo convenience functions allow to place the resulting WETH or Ether in an address other than the caller.

The withdrawFrom function allows to unwrap Ether from an owner wallet to a recipient wallet, as long as the owner called approve

Approvals

When an approval is set to type(uint256).max it will not decrease through transferFrom or withdrawFrom calls.

WETH10 implements EIP2612 to set approvals through off-chain signatures

Call Chaining

The depositAndCall and transferAndCall functions allow to deposit Ether or transfer WETH, executing a call in a user-defined contract immediately afterwards, but within the same transaction.

This function will call onTokenTransfer on the recipient address, receiving and passing along a bytes parameter which can be used by the calling contract to process the callback. See EIP667.

Flash Loans

This contract implements EIP3156 that allows to flashLoan an arbitrary amount of Wrapped Ether, unbacked by real Ether, with the condition that it is burned before the end of the transaction. No fees are charged.

This function will call onFlashLoan on the calling address, receiving and passing along a bytes parameter which can be used by the calling contract to process the callback.

Function unrolling

For a minimal gas cost, all functions in WETH10 are external, and a great deal of code repetition exists. To help in understanding the code, blocks that are used recurrently are preceded by a commented-out function call such as // _transferFrom(msg.sender, to, value) that describes the functionality of the block, and followed by a blank line.

weth10's People

Contributors

alcueca avatar amxx avatar dmihal avatar fubuloubu avatar paulrberg avatar ro5s avatar wighawag avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.