Fully ERC20 compliance
Nativo
is fully ERC20 compliance, while the WETH contract is not, WETH doesnt emit
a Transfer
event from address(0)
to the user after minting tokens.
This also happen when the user unwrap the tokens, WETH doesnt emit a Transfer
event from the user to address(0)
after burning tokens.
Better UX
Nativo
propose an extension of WETH
, besides the clasical
deposit{value: AMOUNT}()
and withdraw(uint256 amount)
we
have add some useful methods.
• depositTo(address recipient)
This method is a combination of deposit
and transfer
, it will wrap the
deposit amount and transfer the same amount to the
recipient
address.
NATIVO.depositTo{ value: amount }(recipient);
// is a replacement for:
WETH9.deposit{ value: amount}();
WETH9.transfer(recipient, amount);
• withdrawTo(address recipient, uint256 amount)
This method is a combination of withdraw
and eth transfer
, it will
unwrap the withdraw amount and transfer the same amount to the
recipient
address.
NATIVO.withdrawTo(recipient, amount);
// is a replacement for:
receive() external payable {
require(msg.sender == address(WETH));
}
// ...
WETH9.withdraw(amount);
SafeTransferLib.safeTransferETH(recipient, amount);
• withdrawFromTo(address from, address recipient, uint256 amount)
This method is a combination of transferFrom
and withdraw
, it will
unwrap the amount from the from
address, thay give approval to the contract and
transfer the same amount of native currency to the recipient
address.
NATIVO.withdrawFromTo(from, recipient, amount);
// is a replacement for:
receive() external payable {
require(msg.sender == address(WETH));
}
// ...
WETH9.transferFrom(from, address(this), amount);
WETH9.withdraw(amount);
SafeTransferLib.safeTransferETH(recipient, amount);
ERC20Permit
Nativo
is an ERC20 that allows gasless approval of tokens (standardized as ERC2612).
This ERC allow approvals to be made via signatures, as defined in EIP-2612.
ERC-1363: Payable Token
There is no way to execute code after a ERC-20 transfer or approval (i.e. making a payment), so
to make an action it is required to send another transaction and pay GAS twice.
Nativo
tackle this using the
ERC-1363, is a payable token, it implements the follow methods:
transferAndCall
andtransferFromAndCall
will call an onTransferReceived on a ERC1363Receiver contract.approveAndCall
will call an onApprovalReceived on a ERC1363Spender contract.
Flashloans - ERC-3156
Nativo
implementes the
ERC-3156: Flash Loans
. A flash loan is a smart contract transaction in which a lender smart contract lends assets
to a borrower smart contract with the condition that the assets are returned, plus a fee of
0.1%, before the end of the transaction.
This let the protocol to lend an amount of tokens without a requirement for collateral, with the
condition that they must be returned within the same transaction.
← Introduction Gas savings →