# Generator Token

A Generator token is a token which mints tokens over a certain period following well defined properties and the tokens are then sent fo the destination_address as specified by the owner

### Properties

The properties:

- name e.g. INCAG in case of ThreeFold
- owner_address, is the person who owns the generator token
- dest_token_name e.g. INCA in case of ThreeFold
- dest_chain e.g. SOLANA
- dest_address, where the minted tokens will be sent too
  - owner can change the dest address
- description
- code = smart contract related
  - smart_contract_addr: address of the smart contract
  - this smart contract executes the code as needed to execute this contract, this smart contract will ask the minter code to create tokens as needed.
- minter related
  - minter_contract_addr: address of the smart contract which generates the tokens (minting) 
  - info about minter, the minter creates the Generator Tokens as well as the Destination Tokens
- source related
  - can be empty if there is no source token
  - source_token_name e.g. TFT (can also be address)
  - source_token_chain e.g. STELLAR
  - sourcetable
    - list of the sourcetokens (amount, src_address) e.g. 1000 TFT was input of this INCAG token.
- mintingtable
  - nr of $dest_token_name e.g. INCA to be minted over which time 
  - is a table with date + minting amount of our specific "dest_token" which is generated (minted) over time
- acceleration_table
  - accelerated minting rules
  - per row we find a date, oracleaddress, minimum, maximum, nrminted e.g. if oracle about INCA price is higher than 0.5 USD, there is no max, then we mint e.g. 1000 INCA on a specific Date
the INCAG
  - if not specified then the owner of the INCAG can freely define the destination
- clawback (stop the minting and if any incoming tokens, send them back to the originator)
  - clawback_multisig_accounts e.g. accounts which can instantiate a clawback
  - clawback_multisig_min_signature e.g. nr of signatures needed for clawback
  - clawback_address (*is only relevant if the originating tokens come from somewhere*)
  - when clawback is executed it basically means the generator token no longer exists


### Example Generator Token

```json
{
  "name": "INCAG",
  "owner_address": "0x9876543210987654321098765432109876543210",
  "dest_token_name": "INCA",
  "dest_chain": "SOLANA",
  "dest_address": "0x9876543210987654321098765432109876543210",
  "description": "INCA-G token for generating INCA (Internet Capacity token) over time",
  "smart_contract_addr": "0x1234567890123456789012345678901234567890",
  "minter_contract_addr": "0x1234567890123456789012345678901234567890",
  "source": {
    "source_token_name": "TFT",
    "source_token_chain": "STELLAR",
    "sourcetable": [
      {
        "amount": 1000,
        "src_address": "GDFZ...STELLAR...ADDRESS"
      }
    ]
  },
  "mintingtable": [
    {
      "date": "2026-08-17",
      "minting_amount": 100
    },
    {
      "date": "2026-09-17",
      "minting_amount": 200
    },
    {
      "date": "2026-10-17",
      "minting_amount": 700
    }
  ],
  "acceleration_table": [
    {
      "date": "2025-08-17",
      "oracle_address": "0xABCDEF1234567890ABCDEF1234567890ABCDEF12",
      "minimum": 0.5,
      "maximum": null,
      "nr_minted": 500
    },
    {
      "date": "2025-12-17",
      "oracle_address": "0xABCDEF1234567890ABCDEF1234567890ABCDEF12",
      "minimum": 0.75,
      "maximum": null,
      "nr_minted": 500
    }
  ],
  "clawback": {
    "clawback_multisig_accounts": [
      "GABC...STELLAR...ADDRESS1",
      "GDEF...STELLAR...ADDRESS2",
      "GHIJ...STELLAR...ADDRESS3",
      "GKLM...STELLAR...ADDRESS4",
      "GNOP...STELLAR...ADDRESS5"
    ],
    "clawback_multisig_min_signature": 3
  }
}
```


```mermaid
sequenceDiagram
    participant Owner
    participant GeneratorToken
    participant SmartContract
    participant MinterContract
    participant DestChain
    participant Oracle

    Owner->>GeneratorToken: Create Generator Token
    GeneratorToken->>SmartContract: Initialize
    
    loop For each date in mintingtable
        SmartContract->>SmartContract: Check current date
        alt Current date matches mintingtable date
            SmartContract->>MinterContract: Request minting
            MinterContract->>DestChain: Mint tokens
            DestChain->>Owner: Transfer minted tokens to dest_address
        end
    end

    loop For each date in acceleration_table
        SmartContract->>SmartContract: Check current date
        alt Current date matches acceleration_table date
            SmartContract->>Oracle: Request price data
            Oracle-->>SmartContract: Return price data
            alt Price meets acceleration criteria
                SmartContract->>MinterContract: Request accelerated minting
                MinterContract->>DestChain: Mint additional tokens
                DestChain->>Owner: Transfer additional minted tokens to dest_address
            end
        end
    end

    alt Clawback initiated
        Owner->>GeneratorToken: Request clawback
        loop Until clawback_multisig_min_signature reached
            GeneratorToken->>GeneratorToken: Collect signatures
        end
        GeneratorToken->>SmartContract: Execute clawback
        SmartContract->>SmartContract: Stop minting
        alt Source tokens exist
            SmartContract->>Owner: Return source tokens
        end
        SmartContract->>GeneratorToken: Deactivate Generator Token
    end

    Owner->>GeneratorToken: Change dest_address
    GeneratorToken->>SmartContract: Update dest_address
```