Get gas back on OKTC#

1. Introduction#

The Gas Back feature allows contract deployers on OKTC to proportionally distribute their contract’s handling fees to other users. After the user deploys a contract on OKTC and registers the contract, they can proceed to receive a handling fee distribution rate (Gas Back rate) according to the system, which will act as a handling fee for any user that calls this contract. Users can directly register this contract by sending an EVM transaction.

2. How to use#

Contract nameContract roleContract address
GasBackMSGHelper proxyGenerates a Msg according to the corresponding parameters inputted, acts as the parameters of SystemContract invoke interfaceMainnet: 0x0DD08B74c111D148751f38f02ab0C3408ead7d18 Testnet: 0x9e472f77e2A5C8f09B237273960c776ddE1D98C1
SystemContractOffers a public invoke interface; after the user assembles the data, they can use this interface to initiate a staking transactionMainnet: 0xd6bce454316b8ddFb76bB7bb1B57B8942B09Acd5 Testnet: 0x727d14EfC4FB5281A18A6d62BCf486a1cF4d2210
GasBackMSGHelperCode implementationMainnet: 0xC38246a34aC8241eB56C84B7356aDC6Dde737f99 Testnet: 0xC9306D5963D7e1f02D04Aa78cd5A34b0D27583b3
ProxyAdminResponsible for managing the proxy’s admin contractMainnet: 0xe9196e65a0b6705777fbe829dfa94ec8b9f2ba48 Testnet: 0xcc904644d73fa4aff34fda7433a8f3154c812769

Operating process:#

  1. According to the specific action that the user would like to perform, they should select the corresponding method from the proxy contract in StakingMSGHelper to generate the parameters
  2. Use the parameters generated from step 1, call SystemContract’s invoke method, generate an EVM formatted transaction
  3. Sign and broadcast the assembled EVM transaction on the chain
  4. After completion, users can check their results on the browser or their wallet

3. Sample code#

The codes use the OKTC staking method as in the examples below, including multi-language version demos; all developers only need to change their private key, address, and parameters to their own:

4. Interface list#

InterfaceDetailsParameter detailsThis Msg functions as the corresponding command line of SystemContract’s invoke interface parameters
genRegisterMsg()Register the contract, enjoy a share of the contract handling fee_contract: the contract that needs to be registered _withdrawerAddress: contract handling fee recipient’s address _nonces: nonce that user uses during deploying of contractexchaincli tx feesplit register
genUpdateMsg()Update contract handling fee recipient’s address_contract: address of the registered contract _withdrawerAddress: Updated contract handling recipient’s addressexchaincli tx feesplit update
genCancelMsg()Cancel handling fee distribution_contract: address of the registered contractexchaincli tx feesplit cancel