5️⃣Refuel SaaS
Integration flow
Main system components
User Wallet on chain A and Chain B
ZeroWayGasRefuelV1 smart contract
Saas partner wallet
Zeroway wallet
Hyperlane infrastructure contracts
ZeroWayGasRefuelV1 is a smart contract designed for interchain ETH transfers between different Ethereum L2 chains. Smart contract also supports SaaS (Solution as a Service) option allowing Zeroway to add partners who can integrate our contracts into their ecosystem and receive a share from all user transfers initiated from their own frontend directly into the specified wallet. in simple words, contract alows users to transfer ETH between chains and partners - to gain income without a need to support any bridge solutions.
Coponents described above are presented here:
2. User Flow
1-2. A user requests information aboult refuel volume limitations using refuelSettings(...) method
3-5. A user requests fee parameters for the indicated refuel using calculateRefuelFee(...) method ( or calculateRefuelFeeBatch(...) method)
6-7. User initiate transactional partnerRefuel(...) method (ortransactional partnerRefuelBatch(...)method), indicating the parther adress from the whitelist.
8-9. The paid fee will be distributed between user and parther according to the whileist settings
10-12. The crosschain intaraction is being processed
13-17. User receives his payment in the recepint chain
If any problem arises, user can withdraw his finds using withdrawDebt(...) method when the ETH balance of the contract will be enough. Gas refuel contract tracs and stores all the transfers even with zero balance in it.
3. Integrational methods
refuelSettings
A method used to receive actual refuel settings
Returns RefuelSettingsstructure from which minRefuelAmount and maxRefuelAmount can be tacken
RefuelSettings structure :
calculateRefuelFee
A method used for fee calculation
calculateRefuelFeeBatch
A method used for fee calculation for refuel batch
partnerRefuel
A method used for ETH transfer with indicated partner
target_: user address where ETH are transferredamount_: refuel amountdestinationDomain_: target chain IDpartner_: partner address where fee share is transferred
Returns the whole fee size and Hyperlane message ID.
partnerRefuelBatch
A method used for batch ETH transfer with indicated partner
targets_: user adresses arrayamounts_: refuel amounts arraydestinationDomains_: target chain IDs arraypartner_: partner address
Returns the whole fee size and Hyperlane message ID.
userBalance
A method used to check user balance in the contract.
user: user address
Returns user balance in the contract.
This method is needed to check if a user has any unwithdrawn funds from the contract which he can withdraw. The balance accures if the transfer was not successful because of any reasons.
withdrawDebt
A method used to withdraw user balance from the contract.
to_: an address where ETH will be withdrawn
This method is used to withdraw user balance. It's nessessory in cases when the revious transcation has failed because of any reasons and funds remain in contract.
4. Example
Partner initializing https://basescan.org/tx/0x18b2d084853f879d1faf5223a9e7eb810b6a42b464ab5d36839a687651ed7c5e
Partner refuel transaction initializing in Basehttps://basescan.org/tx/0x1ac6ea47eae9e4e7c3be0402f298027c9907925ac71904b661300af993ef462e
Parner refuel transaction exexution in recepint chainhttps://arbiscan.io/tx/0xa98a5e611462af6f5752c555e437aa05d0b322cb99c3d8fd229ebbbb28e4016f
Transaction in Hyperlane explorerhttps://explorer.hyperlane.xyz/message/0xf74dd3d9a44c3ffd66c38c9777b025469be1141d179960a3b5b95f5148169359
5. Contract list
The list of cotracts and identifiers in supported chains
5. Becoming a Zeroway partner
The connection of partners is carried out by the owner of the contract through the following methods:
addSAASPartner: adding new partnerupdateSAASPartner: updating partner senntingsremoveSAASPartner: deliting partner
Partner parameters are stored in thesaasPartnerSettingmapping where address is used as a key and setting stracture is used as a value
Last updated