KitxERC20
isol/contracts/kit/KitxERC20.sol
Kit The KitxERC20 is a comprehensive and efficient core ERC20 smart contract suite, providing all essential features for token development.
Import
import "isol/contracts/kit/KitxERC20.sol";Usage
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import "isol/contracts/kit/KitxERC20.sol";
contract Kit is KitxERC20 {
constructor()
KitxERC20(
"Kit Token",
"KIT",
1000000
)
{}
}Arguments
| Parameter | Type | Description |
|---|---|---|
name | string | The name of your token |
symbol | string | The symbol (ticker) of your token |
initialSupply | uint256 | The initial supply (whole number, no decimals needed) |
name
- Type:
string
The name of your ERC20 token, e.g., "MyToken".
contract Kit is KitxERC20 {
constructor()
KitxERC20(
"Kit Token", // Name (string)
"KIT", // Symbol (string)
1000000 // Initial Supply (number: uint256)
)
{}
}symbol
- Type:
string
The symbol (ticker) of your ERC20 token, e.g., "MTK".
contract Kit is KitxERC20 {
constructor()
KitxERC20(
"Kit Token", // Name (string)
"KIT", // Symbol (string)
1000000 // Initial Supply (number: uint256)
)
{}
}initialSupply
- Type:
uint256(number || bigint)
The initial supply of your ERC20 token, specified as a whole number. This amount will be minted to the deployer's address upon deployment.
contract Kit is KitxERC20 {
constructor()
KitxERC20(
"Kit Token", // Name (string)
"KIT", // Symbol (string)
1000000 // Initial Supply (number: uint256)
)
{}
}Functions
Read
| Function | Arguments | Description |
|---|---|---|
allowance | owner (address), spender (address) | Check approved amount for spender |
balanceOf | account (address) | Get token balance of an address |
decimals | - | Get number of decimals used by the token |
name | - | Get the name of the token |
owner | - | Get the owner of the token |
symbol | - | Get the symbol of the token |
totalSupply | - | Get the total supply of the token |
Write
| Function | Interact | Arguments | Description |
|---|---|---|---|
approve | user | spender (address), value (uint256) | Allow spender to use your tokens |
burn | user | value (uint256) | Burn a specific amount of your tokens |
burnFrom | user | account (address), value (uint256) | Burn a specific amount of your tokens from an account |
renounceOwnership | owner | - | Renounce ownership of the token |
transfer | user | to (address), value (uint256) | Send tokens to another address |
transferFrom | user | from (address), to (address), value (uint256) | Move tokens using allowance |
transferOwnership | owner | newOwner (address) | Transfer ownership of the token |
Events
| Logs |
|---|
Transfer(address indexed from, address indexed to, uint256 value) |
Approval(address indexed owner, address indexed spender, uint256 value) |
OwnershipTransferred(address indexed previousOwner, address indexed newOwner) |
Features
Functions are inherited from BasexERC20, with additional new features below.
| Function | Type | Interact | Arguments | Description |
|---|---|---|---|---|
owner | read | - | - | Get the owner of the token |
burn | write | user | value (uint256) | Burn a specific amount of your tokens |
burnFrom | write | user | account (address), value (uint256) | Burn a specific amount of your tokens from an account |
renounceOwnership | write | owner | - | Renounce ownership of the token |
transferOwnership | write | owner | newOwner (address) | Transfer ownership of the token |
References
Source code: KitxERC20
OpenZeppelin: ERC20, ERC20Burnable, Ownable
Examples
Deploy
./MyToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import "isol/contracts/kit/KitxERC20.sol";
contract MyToken is KitxERC20 {
constructor()
KitxERC20(
"MyToken", // Name (string)
"MTK", // Symbol (string)
5000000 // Initial Supply (number: uint256)
)
{}
}Interact
./interact.ts
import { daccSendToken } from 'dacc-js';
import { optimismSepolia } from 'viem/chains'; // used `viem` - npm i viem
const tx = await daccSendToken({
// account: "0xPrivatekey...", // Can call with `allowDaccWallet` function
daccPublickey: 'daccPublickey_0x123_XxX..',
// address: '0x123address...', // Only the address created is set to `publicEncryption: true`
passwordSecretkey: 'my+Password#123..',
network: optimismSepolia,
tokenAddress: '0xTokenContract...',
to: '0xRecipient...',
amount: 0.1
// decimals: 6
});
console.log(tx); // {txHash, chainId, from, to, tokenAddress, amount, decimals}
console.log(tx?.txHash); // 0xTransactionHash...