{"id":20278572,"url":"https://github.com/masdxi/ico-contract","last_synced_at":"2025-08-01T19:07:47.754Z","repository":{"id":54434931,"uuid":"337681005","full_name":"MASDXI/ico-contract","owner":"MASDXI","description":"Initial Coin Offering (ICO) smart contract written in Solidity. This repository budling with hardhat and openzeppelin with best practice code pattern.","archived":false,"fork":false,"pushed_at":"2021-11-02T07:10:27.000Z","size":460,"stargazers_count":21,"open_issues_count":0,"forks_count":14,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T06:04:37.545Z","etag":null,"topics":["ethereum","hardhat","initial-coin-offering","openzeppelin","solidity"],"latest_commit_sha":null,"homepage":"","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/MASDXI.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":"2021-02-10T09:54:49.000Z","updated_at":"2025-03-18T18:24:11.000Z","dependencies_parsed_at":"2022-08-13T15:31:23.002Z","dependency_job_id":null,"html_url":"https://github.com/MASDXI/ico-contract","commit_stats":null,"previous_names":["masdxi/ico-contract"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MASDXI/ico-contract","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MASDXI%2Fico-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MASDXI%2Fico-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MASDXI%2Fico-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MASDXI%2Fico-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MASDXI","download_url":"https://codeload.github.com/MASDXI/ico-contract/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MASDXI%2Fico-contract/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268281829,"owners_count":24225159,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ethereum","hardhat","initial-coin-offering","openzeppelin","solidity"],"created_at":"2024-11-14T13:24:10.706Z","updated_at":"2025-08-01T19:07:47.714Z","avatar_url":"https://github.com/MASDXI.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Initial Coin Offering (ICO) contract\n\nTutorial using Hardhat(Buidler) to complie, deploy and automated unit tests Solidity smart contract.  \nyou use this repository as Initial Coin Offering (ICO) contract template or ERC20 template.   \nTo run these tutorials, you must have the following installed:\n\n- [nodejs](https://nodejs.org/en/)\n\n- [nvm](https://github.com/nvm-sh/nvm)\n\n```bash\n$ npm install\n```\n\nto compile your smart contract to get an ABI and artifact of a smart contract.\n\n```bash\n$ npm run compile\n```\n\nfor a unit testing smart contract using the command line.\n\n```\n$ npm run test\n```\nexpecting `sample-test.js` result.\n```bash\n\n  Initial Coin Offering (ICO) contract\n    ✓ Assigns initial balance (97ms)\n    ✓ Do not have permission to minting token (95ms)\n    ✓ Do not have permission to burning token (74ms)\n    ✓ Buy token with ether (212ms)\n    ✓ Do not have permission to withdraw ether from contract (69ms)\n    ✓ Transfer adds amount to destination account (99ms)\n    ✓ Transfer emits event (132ms)\n    ✓ Can not transfer above the amount (63ms)\n    ✓ Can not transfer from empty account (77ms)\n    ✓ Minting token (100ms)\n    ✓ Burning token (73ms)\n    ✓ Withdraw ether from contract (61ms)\n    ✓ Do not have enough ether to buy token (30ms)\n\n\n  13 passing (2s)\n\n```\n\nafter testing if you want to deploy the contract using the command line.\n\n```bash\n\n$ npm run test-rpc\n# Open another Terminal\n$ npm run deploy-local\n\n# result in npx hardhat node Terminal\nweb3_clientVersion\neth_chainId\neth_accounts\neth_chainId\neth_estimateGas\neth_gasPrice\neth_sendTransaction\n  Contract deployment: \u003cUnrecognizedContract\u003e\n  Contract address:    0x5fb...aa3\n  Transaction:         0x4d8...945\n  From:                0xf39...266\n  Value:               0 ETH\n  Gas used:            323170 of 323170\n  Block #1:            0xee6...85d\n\neth_chainId\neth_getTransactionByHash\neth_blockNumber\neth_chainId (2)\neth_getTransactionReceipt\n\n# result in npx hardhat run Terminal\nInitial Coin Offering (ICO) contract deployed to: 0x5Fb...aa3\n\n```\nyour can edit deploy network endpoint at `hardhat.config.js`.\n\n```javascript\nmodule.exports = {\n  networks: {\n        {\n        localhost: {\n          url: \"http://127.0.0.1:8545\"\n        },\n        hardhat: {\n          // See its defaults\n        }\n  }\n};\n\n```\nExample customized function  \nIf you want to pay token fee to the miner or validator in the network.\n```javascript\n    // pragma solidity 0.8.0\n    // Solidity 0.8.X has an integrated SafeMath Library\n    // override function transfer to distribute fee to miner or validator in the network\n    /* Diagram transfer with token fees\n      ##### Before #####\n      A balance: 101\n      B balance: 0\n      C balance: 0\n\n      A.transfer(B.address,101);\n                    A\n                    |\t\n                    | transfer Tx\n                    |_____ \n                    |     |\n                    v     v\t\t\t\t\n                    B     C\n\n      ##### After #####\n      A balance: 0\n      B balance: 100\n      C balance: 1\n    */\n    function transfer(address account,uint256 amount) public override returns(bool){\n        require(amount % 10 != 0, \"ERC20: insufficient funds\");\n        uint256 fee = amount % 10;\n        _transfer(msg.sender,account,amount-fee);\n        _transfer(msg.sender,block.coinbase,fee);\n        return true;\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasdxi%2Fico-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasdxi%2Fico-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasdxi%2Fico-contract/lists"}