Skip to content

fxfactorial/WETH10

 
 

Repository files navigation

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 🍬⛽.

Kovan testnet deployment of latest meaningful commit (fd225b0) 🔨.

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.

Approvals can only be set to and from zero, to avoid race conditions.

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 Minting

This contract allows to flashMint an arbitrary amount of Wrapped Ether, unbacked by real Ether, with the condition that it is burned before the end of the transaction.

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

About

revamped contract

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 52.9%
  • JavaScript 47.1%