{"id":20845891,"url":"https://github.com/flowchain/flc-v2","last_synced_at":"2025-05-09T02:47:33.528Z","repository":{"id":43999729,"uuid":"238734045","full_name":"flowchain/flc-v2","owner":"flowchain","description":"Off-Chain Issuance of FLC Native Tokens","archived":false,"fork":false,"pushed_at":"2023-01-24T01:19:19.000Z","size":455,"stargazers_count":4,"open_issues_count":9,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-31T21:33:56.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://medium.com/flowchain/flc-smart-contract-migration-announcement-for-q1-2020-off-chain-issuable-user-withdraw-and-more-fe63f2ed04e2","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flowchain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-06T16:33:13.000Z","updated_at":"2020-02-25T16:02:30.000Z","dependencies_parsed_at":"2023-01-27T09:35:14.828Z","dependency_job_id":null,"html_url":"https://github.com/flowchain/flc-v2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowchain%2Fflc-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowchain%2Fflc-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowchain%2Fflc-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowchain%2Fflc-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flowchain","download_url":"https://codeload.github.com/flowchain/flc-v2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253181399,"owners_count":21866989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T02:14:18.849Z","updated_at":"2025-05-09T02:47:33.507Z","avatar_url":"https://github.com/flowchain.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FLC v2\n\nThe Flowchain token (FLC v2) smart contract. This repository hosts the source code for public audits.\n\n# Prerequisites\n\n* [node v10+](https://nodejs.org)\\\n* [Truffle v5+](https://truffleframework.com)\\\n* Linux or Mac OS X\n\n# Introduction\n\nThe FLC v2 (or the \"FLC native token\") is the new update of the original FLC v1. Please visit the [Flowchain Token](https://flowchain.co/token.html) official website for more information. For detailed information on FLC v2, we plan to release an official FLC v2 whitepaper in March 2020.\n\n# Off-Chain Issuable Tokens\n\nThe FLC v2 token (or the \"FLC native token\") has many new updates as opposed to the FLC v1 token. The FLC v1 token launched in 2019 is designed to be a mintable token that can be minted by an on-chain smart contract. Moreover, the FLC v2 token is also a mintable token that a number of tokens can also be minted and can be offered to a market.\n\nAs described in the academic paper: [Hybrid Blockchain and Pseudonymous Authentication for Secure and Trusted IoT Networksr](https://dl.acm.org/citation.cfm?doid=3292384.3292388), Flowchain has a hybrid architecture comprised of private blockchains (or \"off-chain\") and a public blockchain (or \"on-chain\"). Thus, to support Flowchain's hybrid architecture, FLC requires an off-chain issuable token technology to provide minted token redeem and user withdrawal capabilities. \n\nSuch capabilities are lack in the FLC v1 tokens; thus, an upgrade to the original FLC v1 smart contract is required prior to the coming Flowchain main net launch.\n\n## Specification\n\nFlowchain proposes an extension to ERC-20 that adds off-chain issuable and mintable tokens.\n\nA method to set an minimal withdraw amount:\n\n```solidity\nfunction setMinWithdrawAmount(uint256 amount) public returns (bool success);\n```\n\nA method to get the minimal withdraw amount:\n\n```solidity\nfunction getMinWithdrawAmount() public returns (uint256 amount);\n```\n\nA method to redeem the value of tokens to the address of the block producer (the \"user\"):\n\n```solidity\nfunction redeem(address to, uint256 amount) external returns (bool success);\n```\n\nA method to withdraw user funds:\n\n```solidity\nfunction withdraw(uint256 amount) public returns (bool success);\n```\n\nThe user can send a signed message to the FLC v2 smart contract to withdraw funds (the \"token rewards\") to their ERC-20 compatible wallet.\n\nA method to setup a mintable address that can mint tokens:\n\n```solidity\nfunction setupMintableAddress(address mintableAddress) public returns (bool success);\n```\n\nA method to mint an amount of tokens and transfer to the address:\n\n```solidity\nfunction mintToken(address to, uint256 amount) public returns (bool success);\n```\n\nA mintable address is the mining contract that can mint and redeem tokens.\n\n## Implementation\n\nThe `redeem` function can only be invoked by the mining contract at the address set by `setupMintableAddress`. \n\nAlso, `redeem` shall call `mintToken` to mint new tokens and send the funds back to the mining contract:\n\n```solidity\ncontract StandardToken {\n    /**\n     * @dev Redeem user mintable tokens. Only the mining contract can redeem tokens.\n     * @param to The user to be redeemed tokens     \n     * @param amount The amount of tokens to be withdrawn\n     * @return The result of the withdraw\n     */\n    function redeem(address to, uint256 amount) external returns (bool success) {\n        require(msg.sender == mintableAddress);    \n\n        // Mint new tokens and send the funds to the account `mintableAddress`\n        // Users can withdraw funds.\n        mintToken(mintableAddress, amount);\n\n        return true;\n    }\n}\n```\n\n# Development\n\nInstall the Truffle toolkit:\n\n```\n$ npm install -g truffle\n```\n\nInstall this project:\n\n```\n$ git clone https://github.com/flowchain/flc-v2.git\n$ cd flc-v2\n$ npm install\n```\n\nCompile this project:\n\n```\n$ truffle compile\n```\n\nRun the migrations:\n\n```\n$ truffle migrate\n```\n\nTo test project contracts, open a new terminal and run the following to start a local Ethereum client:\n\n```\n$ truffle develop\n```\n\nIn the previous terminal, run the following to test contracts:\n\n```\n$ truffle test\n```\n\n# License\n\nThe MIT License\n\nCopyright (c) 2020 The Flowchain Foundation. https://flowchain.co\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowchain%2Fflc-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflowchain%2Fflc-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowchain%2Fflc-v2/lists"}