The ATEN token contract follows the standard ERC-20 specification, including the use of 18 decimal places. The contract also includes an additional transferAndCall feature, which allows direct smart contract interactions without relying on the typical approve/transferFrom mechanism.
TransferAndCall
Besides the standard ERC20 token features (transfer(), balanceOf(), allowance(), etc), the following transferAndCall feature is also available:
On the receiving contract side, the onTokenTransfer function should be implemented to handle the incoming tokens and execute the desired logic:
// SPDX-License-Identifier: MITpragmasolidity ^0.8.25;interface ITokenCallReceiver {functiononTokenTransfer(address from,uint256 amount,bytescalldata data ) externalreturns (bool);}contractTokenReceiverisITokenCallReceiver {// Define function selectors as constantsbytes4privateconstant STAKE_SELECTOR =bytes4(keccak256("stake(uint256)"));// Implement the onTokenTransfer functionfunctiononTokenTransfer(address from,uint256 amount,bytescalldata data ) externaloverridereturns (bool) {// Extract the function selectorbytes4 selector;assembly { selector :=calldataload(data.offset) }// Decode the function call data based on the selectorif (selector == STAKE_SELECTOR) {// Extract the parameters for the stake function (uint256 stakeAmount) = abi.decode(data[4:], (uint256)); // Skip the 4-byte function selector// Handle the stake function logicstake(stakeAmount); } else {revert("Unsupported function selector"); }// Return successreturntrue; }// Example stake function that could be calledfunctionstake(uint256 amount) public {// Handle the staking logic here }}