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 name | Contract role | Contract address |
---|---|---|
GasBackMSGHelper proxy | Generates a Msg according to the corresponding parameters inputted, acts as the parameters of SystemContract invoke interface | Mainnet: 0x0DD08B74c111D148751f38f02ab0C3408ead7d18 |
SystemContract | Offers a public invoke interface; after the user assembles the data, they can use this interface to initiate a staking transaction | Mainnet: 0xd6bce454316b8ddFb76bB7bb1B57B8942B09Acd5 |
GasBackMSGHelper | Code implementation | Mainnet: 0xC38246a34aC8241eB56C84B7356aDC6Dde737f99 |
ProxyAdmin | Responsible for managing the proxy’s admin contract | Mainnet: 0xe9196e65a0b6705777fbe829dfa94ec8b9f2ba48 |
Operating process:#
- 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
- Use the parameters generated from step 1, call SystemContract’s invoke method, generate an EVM formatted transaction
- Sign and broadcast the assembled EVM transaction on the chain
- 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#
Interface | Details | Parameter details | This 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 contract | exchaincli tx feesplit register |
genUpdateMsg() | Update contract handling fee recipient’s address | _contract: address of the registered contract _withdrawerAddress: Updated contract handling recipient’s address | exchaincli tx feesplit update |
genCancelMsg() | Cancel handling fee distribution | _contract: address of the registered contract | exchaincli tx feesplit cancel |