-
Notifications
You must be signed in to change notification settings - Fork 0
Codyfight Token $CTOK ‐ Contract Documentation
Context provides information about the transaction sender.
Context library from OpenZeppelin contracts.
function _msgSender() internal view virtual returns (address)
Returns the transaction sender address.
Name | Type | Description |
---|---|---|
[0] | address | sender_ The transaction sender address. |
function _msgData() internal view virtual returns (bytes)
Returns the transaction data.
Name | Type | Description |
---|---|---|
[0] | bytes | data_ The transaction data. |
LssController is a contract that implements the lossless feature. It is used to control the lossless feature of the LERC20Burnable contract. The LssController contract must implement the beforeTransfer, beforeTransferFrom, beforeApprove, beforeIncreaseAllowance, beforeDecreaseAllowance, and beforeBurn functions. The LssController contract must be set in the LERC20Burnable contract.
Interface of the LssController.
function beforeTransfer(address sender, address recipient, uint256 amount) external
Function to be called before a transfer.
Name | Type | Description |
---|---|---|
sender | address | The sender address. |
recipient | address | The recipient address. |
amount | uint256 | The transfer amount. |
function beforeTransferFrom(address msgSender, address sender, address recipient, uint256 amount) external
Function to be called before a transfer from.
Name | Type | Description |
---|---|---|
msgSender | address | The transaction sender address. |
sender | address | The sender address. |
recipient | address | The recipient address. |
amount | uint256 | The transfer amount. |
function beforeApprove(address sender, address spender, uint256 amount) external
Function to be called before an approve.
Name | Type | Description |
---|---|---|
sender | address | The sender address. |
spender | address | The spender address. |
amount | uint256 | The approve amount. |
function beforeIncreaseAllowance(address msgSender, address spender, uint256 addedValue) external
Function to be called before an increase allowance.
Name | Type | Description |
---|---|---|
msgSender | address | The transaction sender address. |
spender | address | The spender address. |
addedValue | uint256 | The added allowance amount. |
function beforeDecreaseAllowance(address msgSender, address spender, uint256 subtractedValue) external
Function to be called before a decrease allowance.
Name | Type | Description |
---|---|---|
msgSender | address | The transaction sender address. |
spender | address | The spender address. |
subtractedValue | uint256 | The subtracted allowance amount. |
function beforeBurn(address account, uint256 amount) external
Function to be called before a burn.
Name | Type | Description |
---|---|---|
account | address | The account address. |
amount | uint256 | The burn amount. |
LERC20Burnable is a contract that implements the ERC20 standard with burn and lossless features. The LERC20Burnable contract is based on the OpenZeppelin Context contract.
LERC20Burnable contract from Lossless.io. Extends the Context contract.
address recoveryAdmin
recoveryAdmin is the address of the recovery admin, who can change the admin and turn off the lossless feature.
Recovery admin variable.
address admin
admin is the address of the admin, who will hold the minted tokens and have governance rights.
Admin variable.
uint256 timelockPeriod
timelockPeriod is the period in seconds that the recovery admin must wait to turn off the lossless feature.
Timelock period variable.
uint256 losslessTurnOffTimestamp
losslessTurnOffTimestamp is the timestamp when the lossless feature will be turned off.
Lossless turn off timestamp variable.
bool isLosslessOn
isLosslessOn is a boolean that indicates if the lossless feature is on.
Lossless on variable.
contract ILssController lossless
lossless is the address of the LssController contract, which implements the lossless feature.
Lossless controller variable.
constructor(uint256 totalSupply_, string name_, string symbol_, address admin_, address recoveryAdmin_, uint256 timelockPeriod_, address lossless_) public
Constructor sets the initial values of the contract. It mints the total supply to the admin address.
Constructor function.
Name | Type | Description |
---|---|---|
totalSupply_ | uint256 | The total supply of the token. |
name_ | string | The name of the token. |
symbol_ | string | The symbol of the token. |
admin_ | address | The address of the admin. |
recoveryAdmin_ | address | The address of the recovery admin. |
timelockPeriod_ | uint256 | The timelock period in seconds. |
lossless_ | address | The address of the LssController contract. |
event Transfer(address _from, address _to, uint256 _value)
Transfer event.
Name | Type | Description |
---|---|---|
_from | address | The sender address. |
_to | address | The recipient address. |
_value | uint256 | The transfer amount. |
event Approval(address _owner, address _spender, uint256 _value)
Approval event.
Name | Type | Description |
---|---|---|
_owner | address | The owner address. |
_spender | address | The spender address. |
_value | uint256 | The approve amount. |
event NewAdmin(address _newAdmin)
New admin event.
Name | Type | Description |
---|---|---|
_newAdmin | address | The new admin address. |
event NewRecoveryAdminProposal(address _candidate)
New recovery admin proposal event.
Name | Type | Description |
---|---|---|
_candidate | address | The candidate address. |
event NewRecoveryAdmin(address _newAdmin)
New recovery admin event.
Name | Type | Description |
---|---|---|
_newAdmin | address | The new recovery admin address. |
event LosslessTurnOffProposal(uint256 _turnOffDate)
Lossless turn off proposal event.
Name | Type | Description |
---|---|---|
_turnOffDate | uint256 | The turn off date timestamp. |
event LosslessOff()
Lossless off event.
event LosslessOn()
Lossless on event.
modifier lssAprove(address spender, uint256 amount)
The lssAprove modifier calls the beforeApprove function of the lossless contract.
Lossless approve modifier.
Name | Type | Description |
---|---|---|
spender | address | The spender address. |
amount | uint256 | The approve amount. |
modifier lssTransfer(address recipient, uint256 amount)
The lssTransfer modifier calls the beforeTransfer function of the lossless contract.
Lossless transfer modifier.
Name | Type | Description |
---|---|---|
recipient | address | The recipient address. |
amount | uint256 | The transfer amount. |
modifier lssTransferFrom(address sender, address recipient, uint256 amount)
The lssTransferFrom modifier calls the beforeTransferFrom function of the lossless contract.
Lossless transfer from modifier.
Name | Type | Description |
---|---|---|
sender | address | The sender address. |
recipient | address | The recipient address. |
amount | uint256 | The transfer amount. |
modifier lssBurn(address account, uint256 amount)
The lssBurn modifier calls the beforeBurn function of the lossless contract.
Lossless burn modifier.
Name | Type | Description |
---|---|---|
account | address | The account address. |
amount | uint256 | The burn amount. |
modifier lssIncreaseAllowance(address spender, uint256 addedValue)
The lssIncreaseAllowance modifier calls the beforeIncreaseAllowance function of the lossless contract.
Lossless increase allowance modifier.
Name | Type | Description |
---|---|---|
spender | address | The spender address. |
addedValue | uint256 | The added allowance amount. |
modifier lssDecreaseAllowance(address spender, uint256 subtractedValue)
The lssDecreaseAllowance modifier calls the beforeDecreaseAllowance function of the lossless contract.
Lossless decrease allowance modifier.
Name | Type | Description |
---|---|---|
spender | address | The spender address. |
subtractedValue | uint256 | The subtracted allowance amount. |
modifier onlyRecoveryAdmin()
The onlyRecoveryAdmin modifier restricts access to the recovery admin.
Recovery admin modifier.
function transferOutBlacklistedFunds(address[] from) external
This function allows the lossless contract to transfer out blacklisted funds.
Function to transfer out blacklisted funds.
Name | Type | Description |
---|---|---|
from | address[] | The array of addresses from which the funds will be transferred. |
function setLosslessAdmin(address newAdmin) external
This function allows the recovery admin to set a new admin.
Function to set new admin.
Name | Type | Description |
---|---|---|
newAdmin | address | The new admin address. |
function transferRecoveryAdminOwnership(address candidate, bytes32 keyHash) external
This function allows the recovery admin to transfer the recovery admin ownership to a candidate address.
Function to transfer recovery admin ownership.
Name | Type | Description |
---|---|---|
candidate | address | The candidate address. |
keyHash | bytes32 | The key hash. |
function acceptRecoveryAdminOwnership(bytes key) external
This function allows the candidate address to accept the recovery admin ownership.
Function to accept recovery admin ownership.
Name | Type | Description |
---|---|---|
key | bytes | The key. |
function proposeLosslessTurnOff() external
This function allows the recovery admin to propose to turn off the lossless features.
Function to propose lossless turn off.
function executeLosslessTurnOff() external
This function allows the recovery admin to execute the lossless turn off, when the timelock period has passed.
Function to execute lossless turn off.
function executeLosslessTurnOn() external
This function allows the recovery admin to execute the lossless turn on.
Function to execute lossless turn on.
function getAdmin() public view virtual returns (address)
Function to get the admin address.
Name | Type | Description |
---|---|---|
[0] | address | The admin address. |
function name() public view virtual returns (string)
Function to get the name of the token.
Name | Type | Description |
---|---|---|
[0] | string | The name of the token. |
function symbol() public view virtual returns (string)
Function to get the symbol of the token.
Name | Type | Description |
---|---|---|
[0] | string | The symbol of the token. |
function decimals() public view virtual returns (uint8)
Function to get the decimals of the token.
Name | Type | Description |
---|---|---|
[0] | uint8 | The decimals of the token. |
function totalSupply() public view virtual returns (uint256)
Function to get the total supply of the token.
Name | Type | Description |
---|---|---|
[0] | uint256 | The total supply of the token. |
function balanceOf(address account) public view virtual returns (uint256)
Function to get the balance of an account.
Name | Type | Description |
---|---|---|
account | address | The account address. |
Name | Type | Description |
---|---|---|
[0] | uint256 | The balance of the account. |
function transfer(address recipient, uint256 amount) public virtual returns (bool)
Function to transfer tokens. Uses the lssTransfer modifier to call the beforeTransfer function of the lossless contract.
Name | Type | Description |
---|---|---|
recipient | address | The recipient address. |
amount | uint256 | The transfer amount. |
Name | Type | Description |
---|---|---|
[0] | bool | A boolean that indicates if the operation was successful. |
function allowance(address owner, address spender) public view virtual returns (uint256)
Function to get the allowance of a spender on an owner's tokens.
Name | Type | Description |
---|---|---|
owner | address | The owner address. |
spender | address | The spender address. |
Name | Type | Description |
---|---|---|
[0] | uint256 | The allowance of the spender on the owner's tokens. |
function approve(address spender, uint256 amount) public virtual returns (bool)
Function to approve a spender to spend an amount of tokens. Uses the lssAprove modifier to call the beforeApprove function of the lossless contract.
Name | Type | Description |
---|---|---|
spender | address | The spender address. |
amount | uint256 | The approve amount. |
Name | Type | Description |
---|---|---|
[0] | bool | A boolean that indicates if the operation was successful. |
function transferFrom(address sender, address recipient, uint256 amount) public virtual returns (bool)
Function to transfer tokens from an owner to a recipient. Uses the lssTransferFrom modifier to call the beforeTransferFrom function of the lossless contract.
Name | Type | Description |
---|---|---|
sender | address | The sender address. |
recipient | address | The recipient address. |
amount | uint256 | The transfer amount. |
Name | Type | Description |
---|---|---|
[0] | bool | A boolean that indicates if the operation was successful. |
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool)
Function to increase the allowance of a spender. Uses the lssIncreaseAllowance modifier to call the beforeIncreaseAllowance function of the lossless contract.
Name | Type | Description |
---|---|---|
spender | address | The spender address. |
addedValue | uint256 | The added allowance amount. |
Name | Type | Description |
---|---|---|
[0] | bool | A boolean that indicates if the operation was successful. |
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool)
Function to decrease the allowance of a spender. Uses the lssDecreaseAllowance modifier to call the beforeDecreaseAllowance function of the lossless contract.
Name | Type | Description |
---|---|---|
spender | address | The spender address. |
subtractedValue | uint256 | The subtracted allowance amount. |
Name | Type | Description |
---|---|---|
[0] | bool | A boolean that indicates if the operation was successful. |
function _transfer(address sender, address recipient, uint256 amount) internal virtual
Internal function to transfer tokens. Overrides the _transfer function of the Context contract to enforce specific conditions.
Name | Type | Description |
---|---|---|
sender | address | The sender address. |
recipient | address | The recipient address. |
amount | uint256 | The transfer amount. |
function _mint(address account, uint256 amount) internal virtual
Mint function is only executed at contract deployment. No mint function is available after deployment.
Internal function to mint tokens. Overrides the _mint function of the Context contract to enforce specific conditions.
Name | Type | Description |
---|---|---|
account | address | The account address. |
amount | uint256 | The mint amount. |
function _burn(address account, uint256 amount) internal virtual
Internal function to burn tokens. Overrides the _burn function of the Context contract to enforce specific conditions.
Name | Type | Description |
---|---|---|
account | address | The account address. |
amount | uint256 | The burn amount. |
function _approve(address owner, address spender, uint256 amount) internal virtual
Internal function to approve a spender to spend an amount of tokens.
Name | Type | Description |
---|---|---|
owner | address | The owner address. |
spender | address | The spender address. |
amount | uint256 | The approve amount. |
function burn(uint256 amount) public virtual
Burn function may not be allowed if the lossless feature is on, Lossless controller may block the burn.
Function to burn tokens. Uses the lssBurn modifier to call the beforeBurn function of the lossless contract.
Name | Type | Description |
---|---|---|
amount | uint256 | The burn amount. |
function burnFrom(address account, uint256 amount) public virtual
Burn function may not be allowed if the lossless feature is on, Lossless controller may block the burn.
Function to burn tokens from an account. Uses the lssBurn modifier to call the beforeBurn function of the lossless contract.
Name | Type | Description |
---|---|---|
account | address | The account address. |
amount | uint256 | The burn amount. |
CodyfightToken is the official token of Codyfight. Tokens are only minted at contract deployment. No mint function is available after deployment. Tokens can be burned.
CodyfightToken fully inherits the LERC20Burnable contract, which implements the ERC20 standard with burn and lossless features.
constructor(uint256 totalSupply_, string name_, string symbol_, address admin_, address recoveryAdmin_, uint256 timelockPeriod_, address lossless_) public
Constructor sets the initial values of the contract. It mints the total supply to the admin address.
Constructor function.
Name | Type | Description |
---|---|---|
totalSupply_ | uint256 | The total supply of the token. |
name_ | string | The name of the token. |
symbol_ | string | The symbol of the token. |
admin_ | address | The address of the admin. |
recoveryAdmin_ | address | The address of the recovery admin. |
timelockPeriod_ | uint256 | The timelock period in seconds. |
lossless_ | address | The address of the LssController contract. |