Intent: Enable developers to build proxy based DApps that allow users operate without native coin balance. Thus the users will make bulk claims/rewards with "borrowed gas" that will be repaid with a share of their XEN rewards.
Example: Alice has no ETH in her wallet but today is her XENFT mint term. Instead of transferring the required amount from somewhere else, Alice uses Bob's DApp that entirely subsidizes gas for Alice. In return for the service, Bob's smart contract will retain a share of the minted XEN rewards, while the rest of the amount will be transferred to Alice's wallet. Bob also has the option to fund the gas with a one-block flash loan (like Aave's).
Why EIP-2771: It is the standard for making smart contract meta-transaction capable, but it also indirectly enables the ability to fund gas usage with flash loans. Flash loans implementations similar to Aave's are built for smart contracts. It is not possible to borrow, convert the funds to native coin and repay them from an EOA wallet because everything needs to happen within a transaction. More than that, decentralized gas subsidizers like GSN implement EIP-2771. What is interesting in GSN's architecture is that the payment logic is separated from relay servers, allowing to receive the flashloan into the contract while the relayer as EOA can perform the actual claim reward operation having the guarantee that it will be compensated for the incurred gas cost. Frontends can choose to deploy their own relayer or use other relayer instances available in the GSN network. This change will allow integrations for other EIP-2771 compatible relayers (like Open Zeppelin Defender Relayer) while remaining perfectly functional for EOAs.
How (implementation): The XENFT contract needs to inherit a ERC2771Context implementation (like OpenGSN or OpenZeppelin) and the constructor will pass a trusted Forwarder that will be deployed before the XENFT contract. Also msg.sender
have to be replaced with _msgSender()
implementation of the inherited context.
If this proposition starts to show interest, I will submit a PR with a potential contract implementation and tests to demonstrate the applicability.