🛠️Modifications (개선점)
Summaries of the changes implemented in the fork.
We don't have a korean translation for this page yet. Sorry! 이 페이지에 대한 한국어 번역이 아직 준비되지 않았습니다.
In the interest of transparency, we would like to outline the modifications made in the fork:
1. Implements IKIP7Receiver
for compatibility with KIP7 (Klaytn's own fungible token standard):
IKIP7Receiver
for compatibility with KIP7 (Klaytn's own fungible token standard):The IKIP7Receiver
interface introduces the onKIP7Received
function, which handles the receipt of KIP-7 tokens. KIP-7 smart contracts call this function on the recipient after a safeTransfer
. Returning any value other than the magic value(0x9d188c22
) will result in the transaction being reverted.
Tonic Instances(ETHTonic
and ERC20Tonic
), implements the onKIP7Received
function as follows:
2. Make it possible for the owner
to withdraw unrelated tokens(airdrops) from the contract:
owner
to withdraw unrelated tokens(airdrops) from the contract:The fork incorporates the Ownable
functionality, allowing the owner
of the contract to withdraw unrelated tokens, such as tokens received through airdrops (this is why we implemented IKIP7Receiver
for ETHTonic
as well).
This feature provides more control and flexibility for the contract owner in managing unexpected token transfers to the contract.
3. Added state variables to keep track of stats, enabling queries in our frontend app:
The fork introduces two new state variables, numberOfDeposits
and numberOfWithdrawals
, to maintain statistics on the number of deposits and withdrawals. This allows users to access these statistics through the frontend app using multicall.
4. Implemented TonicFeePolicyManager to manage the policy of withdrawal fees:
Tonic employs the newly-added TonicFeePolicyManager
contract to manage withdrawal fee policies. You can view the code here. Our contracts have the feePolicyManager
state (which is set by the initial constructor
and cannot be changed afterward) and include three internal view functions: _feeNumerator()
, _feeDenominator()
, and _treasury()
. These functions return the fee numerator, fee denominator, and treasury address, respectively, querying the TonicFeePolicyManager
with each call.
In the _processWithdraw
function within the Tonic instances, the treasuryFee
is calculated, and the recipientAmount
is determined by subtracting the treasuryFee
and _relayerFee
from the denomination.
For ETHTonic
(Tonic Instance for Native Tokens), the treasuryFee
is transferred to the treasury address.
For ERC20Tonic
(Tonic instance of ERC20/KIP7), the treasuryFee
is safely transferred to the treasury address using the safeTransfer
function.
Last updated