Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
ethereum-transfer-gateway
Advanced tools
Ethhereum Transfer Gateway to Receiver Token without prior Approval
Another way to solve the two step approve and transfer process
Transfer gateways are intermediary contract that make the transfer to the destination contract before calling the contract.
They can be pre-approved globally as immutable address from the ERC20 contract (see _gateway in solc_0.7/Test/BaseERC20.sol) so ERC20 contract can benefit from it without requiring user confirmation.
Alternatively for existing contract, users can approve it only once and can then make purchase in any contract that support such gateways.
This technic is not exclusive to ERC20 and can be used for other contract types.
I am planning to make an ERC721Gateway that support the transfer of multiple ERC721 (from different token contract). use case : https://mystery.market so we can deploy new sale contract without every time requiring approval for transferring ERC721 into it.
Let say there is a Sale Contract that sell some things (represented by id) for a specific price
User create the data to make the call to SaleContract
const { data, to } = await SaleContract.populateTransaction.purchase(1);
Then the User call the TransferGateway transferERC20AndCall
function with the tokeen address and amount to transfer
As shown in the diagram below, this in turn
The Gateway also allow to operate without any approval, by letting the sender make an atomic call that first transfer the token to the gateway and then call forward
as shown in the following diagram:
FAQs
Ethhereum Transfer Gateway to Receiver Token without prior Approval
The npm package ethereum-transfer-gateway receives a total of 6 weekly downloads. As such, ethereum-transfer-gateway popularity was classified as not popular.
We found that ethereum-transfer-gateway demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.