Skip to content

Codyfight Token $CTOK ‐ Project Documentation

Vinicius Martins edited this page Apr 16, 2024 · 1 revision

Codyfight Token $CTOK - Project Documentation

Visit the official Codyfight website for more information.

Functional Requirements

Project Purpose

CTOK fuels Codyfight's in-game economy, facilitating asset exchange and rewarding players. It operates on the Arbitrum blockchain for in-game transactions and broader crypto use.

Project Features

CTOK is a LERC-20 Burnable token, this protocol created and maintained by Lossless.io is an ERC-20 implementation that is capable of freezing any fraudulent transaction based on a set of fraud identification parameters.

References:

Project Business Logic

CTOK smart contract establishes a burnable ERC-20 token with additional features for recovery administration and lossless functionality. It inherits from LERC20Burnable, implementing functions for transfers, approvals, and allowance management. Key features include:

  • Lossless Functionality: Control mechanisms are in place to toggle lossless functionality, enabling additional checks for transfers and approvals via the Lossless Controller.

  • Recovery Administration: The contract facilitates the transfer of recovery admin ownership and the proposal and execution of lossless functionality turn-off.

  • ERC20 Compliance: Standard ERC-20 functions such as transfer, transferFrom, approve, increaseAllowance, and decreaseAllowance are implemented, along with events to track token transfers and approvals.

  • Token Minting and Burning: Functions for minting and burning tokens are provided, with appropriate checks for balance and allowance. The minting function is only available at contract deployment.

Use Cases

CTOK has plenty of utilities and serves not only as a way to reward players but also as a system to value users’ tasks in-game.

Codyfight is a competitive game and Codyfighters will need to showcase their skills and think efficiently about how to win tokens.

Use cases are community incentives, rewards, in-game asset purchases, governance and more:

  • Lower costs of in-game transaction fees, keeping them at the bare minimum.
  • Reward external project contributors and motivate them to get involved in the success of the project.
  • Reward players’ efforts in the gameplay and further their motivation to purchase assets.
  • Benefit players who create in-game assets (Codyfighters & AI code).
  • Create a valuable system of rewards based on the player's performance.
  • Reward for competitive players, team members, and e-sport investors.

These use cases demonstrate the versatile applications of the CodyfightToken smart contract within the gaming ecosystem and beyond, leveraging blockchain technology to enhance user experiences, incentivize participation, and facilitate economic interactions.

References:

Roles and Authorizations

  • Admin Role:

    • Role Description: The admin role represents the project owner's administrative wallet address, used for Lossless governance decisions and initial token holder.

    • Permissions:

      • Interact with the Lossless protocol for governance decisions.
      • Tokens are minted to the administrative wallet address.
  • Recovery Admin Role:

    • Role Description: The Recovery Admin role is responsible for managing administrative changes and facilitating recovery procedures within the CodyfightToken (CTOK) contract.

    • Permissions:

      • Transfer Ownership: The Recovery Admin can transfer ownership of the Recovery Admin role to another address by proposing a new candidate.
      • Accept Ownership: Upon the proposal of a new candidate, the Recovery Admin can accept ownership of the Recovery Admin role by providing the correct key.
      • Proposal for Lossless Functionality: The Recovery Admin can propose turning off the lossless functionality, and initiating a governance decision process within the contract.

These permissions empower the Recovery Admin to oversee critical administrative tasks, ensuring the contract's smooth operation and security.

References:

Technical Requirements

Project Components

CodyfightToken (CTOK) is a LERC20Burnable contract. Deploying it requires these parameters:

  • totalSupply: amount of tokens to be minted (18 decimals);

  • name: token title;

  • symbol: token symbol;

  • admin: project owner’s administrative wallet address, this will be used in Lossless governance decisions. Token creators should set up a wallet that they are planning on using to interact with the Lossless protocol. Tokens are initially minted to this wallet;

  • recoveryAdmin: project owner’s wallet that is used to change admin. Token creators should use multi-sig for this and keep it as secure as possible as this wallet allows changing the admin wallet;

  • timelockPeriod: timelock period in seconds dedicated for turning Lossless turn off. In case the project decides to turn off Lossless they would have to wait for this period after initially proposing to turn the Lossless functionality off. Recommended timelockPeriod is 24 hours or 86400 seconds. Any lower timelockPeriod will be considered unsafe and will be marked as such in Lossless platform;

  • lossless: Lossless protocol controller address. It should be set to Lossless Controller address. Lossless Controller address is different on different chains. Any other address will not allow the token to function properly. You can find the appropriate controller address here.

References:

Technologies Used

The CodyfightToken (CTOK) project employs a diverse set of technologies to build and operate its ecosystem. Here's a breakdown of the key technologies used:

CodyfightToken project aims to build a secure, scalable, and feature-rich token ecosystem on the Arbitrum blockchain, providing users with a seamless and rewarding experience.

Architectural Design

Smart Contracts

  • LERC20Burnable: Implements core token functionalities including minting, burning, transferring, and allowance management. Integrates lossless functionality through modifiers and events.
  • CodyfightToken: Main token contract inheriting functionality from LERC20Burnable. Initializes token parameters and interacts with lossless controller.

Interfaces

  • ILssController: Interface defining functions for lossless functionality such as beforeTransfer, beforeApprove, beforeBurn, etc.

Admin and Recovery Admin

  • Administrative wallet address (admin) and recovery admin wallet address (recoveryAdmin) specified during contract deployment. Recovery admin proposes and executes changes related to lossless functionality and ownership transfer. Admin holds minted tokens and governs the contract, interacting with the lossless protocol for governance decisions.

Lossless Functionality

  • CTOK includes lossless functionality with additional checks and safeguards during token transfers and operations. Toggled on or off by recovery admin for flexibility and security enhancements.

Events

  • Various events emitted during contract execution to provide visibility into important state changes. Events include Transfer, Approval, NewAdmin, NewRecoveryAdminProposal, NewRecoveryAdmin, LosslessTurnOffProposal, LosslessOff, and LosslessOn.

Modifiers

  • Modifiers enforce additional checks and interactions with the lossless controller before executing certain functions. Modifiers such as lssTransfer, lssApprove, lssBurn, etc., ensure secure and efficient contract operations.

Overall, the architecture of the CTOK project revolves around secure and efficient smart contracts, with a focus on implementing lossless functionality and providing flexibility for contract administration and ownership. The interaction between the main token contract, lossless controller, admin, and recovery admin ensures robust governance and security for the CTOK ecosystem.

Testing

The CodyfightToken (CTOK) project includes comprehensive testing to ensure the functionality, security, and reliability of the smart contracts. The testing suite covers various scenarios and edge cases to validate the contract's behavior under different conditions.

Deployment

The deployment process involves deploying the CTOK smart contract on the Arbitrum blockchain with the specified parameters, including total supply, token name, symbol, admin, recovery admin, timelock period, and lossless controller address. Once deployed, the contract is ready to interact with users and other components of the Codyfight ecosystem.

References:

Non-Functional Requirements

Security Considerations, Compliance and Governance

The CodyfightToken (CTOK) project incorporates several security measures, compliance standards, and governance practices to ensure the safety and integrity of the token ecosystem. Key security features and practices include:

  • ERC-20 Standard: CTOK follows the ERC-20 token standard, ensuring interoperability with other Ethereum-based tokens and platforms, and compliance with industry norms and guidelines.

  • Lossless Functionality: The lossless protocol adds an additional layer of security by preventing fraudulent transactions and ensuring the integrity of token transfers and operations.

  • Role-Based Permissions: The admin and recovery admin roles are carefully defined to manage critical contract functions such as ownership transfer, lossless functionality, and recovery procedures.

  • Timelock Period: The timelock period for turning off lossless functionality provides a grace period for governance decisions, allowing stakeholders to review and confirm changes before they take effect.

  • Event Logging: Events are emitted during contract execution to provide visibility into important state changes and transactions, enabling users to monitor contract activities and detect anomalies.

  • Modifiers and Checks: Modifiers enforce additional checks and interactions with the lossless controller before executing certain functions, ensuring that only authorized transactions are processed.

  • Testing and Auditing: Comprehensive testing and auditing processes are conducted to validate the contract's functionality, security, and compliance with best practices, minimizing the risk of vulnerabilities and exploits.

By incorporating these security measures and best practices, the CodyfightToken (CTOK) project aims to create a secure and reliable token ecosystem that safeguards user assets and transactions on the Arbitrum blockchain.

Scalability and Performance

The CodyfightToken (CTOK) project leverages the Arbitrum blockchain as a layer 2 scaling solution to enhance scalability and performance for in-game transactions and broader crypto use. By operating on Arbitrum, CTOK benefits from:

  • Low Transaction Fees: Arbitrum offers low transaction fees, making it cost-effective for users to perform token transfers, asset exchanges, and other operations within the Codyfight ecosystem.

  • Fast Transaction Speeds: Arbitrum provides fast transaction speeds, enabling near-instant confirmation times for token transfers and operations, enhancing the user experience and gameplay efficiency.

  • Scalable Architecture: The Arbitrum blockchain is designed for scalability, supporting a high throughput of transactions and smart contract interactions, making it suitable for the growing demands of the Codyfight ecosystem.

  • Layer 2 Solutions: By utilizing layer 2 solutions like Arbitrum, CTOK can offload transaction processing and data storage from the Ethereum mainnet, reducing congestion and improving overall performance for users.

The scalability and performance benefits of operating on Arbitrum enable the CodyfightToken (CTOK) project to deliver a seamless and efficient token ecosystem that meets the needs of players, developers, and stakeholders within the gaming community.

References:

Usability and User Experience

The CodyfightToken (CTOK) project focuses on usability and user experience to provide a seamless and rewarding interaction for players, developers, and stakeholders within the gaming ecosystem. Key usability features and enhancements include:

  • Intuitive Token Operations: CTOK offers intuitive token operations such as transfers, approvals, and burning, enabling users to interact with the token contract easily and efficiently.

  • NatSpec Documentation: Human-readable documentation is provided for the smart contract functions, events, and modifiers, making it easier for developers and users to understand the contract's behavior and usage.

By focusing on usability and user experience, the CodyfightToken (CTOK) project aims to create a user-friendly and engaging token ecosystem that empowers players, developers, and stakeholders to participate in the gaming community and benefit from the rewards and incentives offered by CTOK.