{"id":27147976,"url":"https://github.com/r3d4ng3l/presalesmartcontract","last_synced_at":"2025-04-08T11:51:55.399Z","repository":{"id":63557683,"uuid":"568046257","full_name":"R3D4NG3L/PresaleSmartContract","owner":"R3D4NG3L","description":"This repository offers a smart contract to manage seed sales / pre-sales. It is written in Solidity for EVM blockchains (e.g. Ethereum, BSC, Cronos, ...).","archived":false,"fork":false,"pushed_at":"2022-11-20T12:43:42.000Z","size":244,"stargazers_count":31,"open_issues_count":1,"forks_count":21,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-14T10:35:18.366Z","etag":null,"topics":["bsc","cronos","defi","ethereum","ethereum-contract","evm-chains","presale","seed-sale","smart-contract","solidity","solidity-contracts","solidity-dapps"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/R3D4NG3L.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":"2022-11-19T09:25:47.000Z","updated_at":"2024-04-10T12:10:37.000Z","dependencies_parsed_at":"2022-11-21T08:47:57.542Z","dependency_job_id":null,"html_url":"https://github.com/R3D4NG3L/PresaleSmartContract","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/R3D4NG3L%2FPresaleSmartContract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R3D4NG3L%2FPresaleSmartContract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R3D4NG3L%2FPresaleSmartContract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R3D4NG3L%2FPresaleSmartContract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/R3D4NG3L","download_url":"https://codeload.github.com/R3D4NG3L/PresaleSmartContract/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838409,"owners_count":21004576,"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":["bsc","cronos","defi","ethereum","ethereum-contract","evm-chains","presale","seed-sale","smart-contract","solidity","solidity-contracts","solidity-dapps"],"created_at":"2025-04-08T11:51:54.825Z","updated_at":"2025-04-08T11:51:55.379Z","avatar_url":"https://github.com/R3D4NG3L.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e 📜 Presale Solidity Smart Contract\n\n- [🤝 Need help for deployment?](#-need-help-for-deployment)\n- [🕵 Are you looking for the Dapp Front-end of this smart contract?](#-are-you-looking-for-the-dapp-front-end-of-this-smart-contract)\n- [🔎 Purpose](#-purpose)\n  - [TokenPreSale.sol](#tokenpresalesol)\n  - [TestUSDT.sol \u0026 TestErc20Token.sol](#testusdtsol--testerc20tokensol)\n  - [Features](#features)\n- [🐉 Examples on BSC Testnet](#-examples-on-bsc-testnet)\n  - [TokenPreSale.sol](#tokenpresalesol-1)\n  - [TestUSDT.sol](#testusdtsol)\n  - [TestErc20Token.sol](#testerc20tokensol)\n- [💪 How to use it](#-how-to-use-it)\n  - [How to create a new sale round](#how-to-create-a-new-sale-round)\n  - [How to change sale round start and end time](#how-to-change-sale-round-start-and-end-time)\n  - [How to change vesting start time](#how-to-change-vesting-start-time)\n  - [How to change sale token address](#how-to-change-sale-token-address)\n  - [How to change sale token price](#how-to-change-sale-token-price)\n  - [How to enable / disable buy with Ethers functionality](#how-to-enable--disable-buy-with-ethers-functionality)\n  - [How to enable / disable buy with USDT functionality](#how-to-enable--disable-buy-with-usdt-functionality)\n  - [How to pause / unpause presale](#how-to-pause--unpause-presale)\n\n# 🤝 Need help for deployment?\nIf you **need for deployment and use of this smart contract**, you can find my contacts on my GitHub profile page.\n___If you contact me on Telegram, write as first message that you have found my contact on GitHub or you will automatically blocked___.\n\n# 🕵 Are you looking for the Dapp Front-end of this smart contract?\nTake a look to [this project](https://github.com/R3D4NG3L/PresaleSmartContract)!\n![](https://github.com/R3D4NG3L/PresaleDapp/raw/main/public/images/gifs/Overview.gif)\n\n# 🔎 Purpose\n## TokenPreSale.sol\nThis repository offers a smart contract to manage seed sales / pre-sales. It is written in Solidity for EVM blockchains (e.g. Ethereum, BSC, Cronos, ...).\n## TestUSDT.sol \u0026 TestErc20Token.sol\nThis repository offers also other 2 bonus smart contracts to allow you to test TokenPreSale.sol on test nets \n\n## Features\n- ✅ Manage a **pre-sale / seed sale**\n- ✅ With only **one smart contract** is possible to **manage multiple sale rounds** for potentially multiple tokens\n- ✅ **Configurable** sale round **start and end date time**\n- ✅ **Configurable vesting start time, cliff and period**\n- ✅ **Configurable number of tokens to be sold**\n- ✅ Token claim is allowed only after the sale round is completed and can be configured also a cliff period (not mandatory) to allow claim in small portions over a certain period of time\n- ✅ **Configurable token to be claimed**\n- ✅ **It is not necessary to develop the token to be claimed before sale round starts**, this will give you more time to think about tokenomics and feature of your ERC20 token that will have to be developed.\n- ✅ It is possible to **invest into the sale round with stable coins** such as USDT, USDC, etc... (requirement of 6 decimal digits per ERC20 token)\n- ✅ It is possible to **invest into the sale round with Ethers** (it depends from which blockchain is deployed the smart contract, so it would be **ETH** for Ethereum Blockchain, **BNB** for Binance Smart Chain, CRO for **Cronos**, etc...)\n- ✅ It is **possible to change parameters when the sale round has already started**\n\n# 🐉 Examples on BSC Testnet\nDeploy date: 19 November 2022\n\n**⚠️ Those links might go down in the future if the BSC Testnet goes down or is wiped out**.\n\n## TokenPreSale.sol\nhttps://testnet.bscscan.com/address/0xbfBAde8310Db30F2E34C2aee1896001dD6B005f9\n\n## TestUSDT.sol\nhttps://testnet.bscscan.com/address/0x250df3426Facabb1a1AE0145ea2E86cdbb296fA7\n\n## TestErc20Token.sol\nhttps://testnet.bscscan.com/address/0x5d08C7eD211825518f1CD121c32B077aEE350954\n\n# 💪 How to use it\n## How to create a new sale round\nThe function that you'll have to call with the contract owner address is '*createPresale*'\n```javascript\n/**\n * @dev Creates a new presale\n * @param _startTime start time of the sale\n * @param _endTime end time of the sale\n * @param _price Per token price multiplied by (10**18)\n * @param _tokensToSell No of tokens to sell without denomination. If 1 million tokens to be sold then - 1_000_000 has to be passed\n * @param _baseDecimals No of decimals for the token. (10**18), for 18 decimal token\n * @param _vestingStartTime Start time for the vesting - UNIX timestamp\n * @param _vestingCliff Cliff period for vesting in seconds\n * @param _vestingPeriod Total vesting period(after vesting cliff) in seconds\n * @param _enableBuyWithEth Enable/Disable buy of tokens with ETH\n * @param _enableBuyWithUsdt Enable/Disable buy of tokens with USDT\n */\nfunction createPresale(\n    uint256 _startTime,\n    uint256 _endTime,\n    uint256 _price,\n    uint256 _tokensToSell,\n    uint256 _baseDecimals,\n    uint256 _vestingStartTime,\n    uint256 _vestingCliff,\n    uint256 _vestingPeriod,\n    uint256 _enableBuyWithEth,\n    uint256 _enableBuyWithUsdt\n)\n```\n\nExample (*truffle console*):\n```typescript\nlet instance = await TokenSaleTest.deployed()\n// _startTime = 1668360000 -\u003e Sun Nov 13 2022 17:20:00 GMT+0000\n// _endTime = 1680328800 -\u003e Sat Apr 01 2023 06:00:00 GMT+0000\n// _price = 18005041411595246 -\u003e 0,018005041411595246$ per Token\n// __tokensToSell = 10000000 -\u003e 10 millions of tokens to be sold in this sale round\n// _baseDecimals = 1000000000000000000 -\u003e ERC20 Token to be sold number of decimals, in this case 18 decimals (10**18)\n// _vestingStartTime: 1680328801 -\u003e Sat Apr 01 2023 06:00:01 GMT+0000\n// _vestingCliff: 0 -\u003e No Cliff Period\n// _vestingPeriod: 0 -\u003e No vesting period\n// _enableBuyWithEth: 0 -\u003e Buy with Ethers functionality disabled\n// _enableBuyWithUsdt: 1 -\u003e Buy with USDT (stable coin) functionality enabled\ninstance.createPresale(1668360000, 1680328800, BigInt(18005041411595246), 10000000, BigInt(1000000000000000000), 1680328801, 0, 0, 0, 1)\n```\n\n## How to change sale round start and end time\n```javascript\n/**\n * @dev To update the sale times\n * @param _id Presale id to update\n * @param _startTime New start time\n * @param _endTime New end time\n */\nfunction changeSaleTimes(\n    uint256 _id,\n    uint256 _startTime,\n    uint256 _endTime\n)\n```\n\nExample (*truffle console*):\n```typescript\nlet instance = await TokenSaleTest.deployed()\nlet latestPresaleId = await instance.presaleId.call()\n// _id = latestPresaleId or the preSaleId which you want to change\n// _startTime = 1668360000 -\u003e Sun Nov 13 2022 17:20:00 GMT+0000\n// _endTime = 1680328800 -\u003e Sat Apr 01 2023 06:00:00 GMT+0000\ninstance.changeSaleTimes(latestPresaleId, 1668360000, 1680328800)\n```\n\n## How to change vesting start time\n```javascript\n/**\n * @dev To update the vesting start time\n * @param _id Presale id to update\n * @param _vestingStartTime New vesting start time\n */\nfunction changeVestingStartTime(uint256 _id, uint256 _vestingStartTime)\n```\n\nExample (*truffle console*):\n```typescript\nlet instance = await TokenSaleTest.deployed()\nlet latestPresaleId = await instance.presaleId.call()\n// _id = latestPresaleId or the preSaleId which you want to change\n// _startTime = 1668360000 -\u003e Sun Nov 13 2022 17:20:00 GMT+0000\ninstance.changeVestingStartTime(latestPresaleId, 1668360000)\n```\n\n## How to change sale token address\n```javascript\n/**\n * @dev To update the sale token address\n * @param _id Presale id to update\n * @param _newAddress Sale token address\n */\nfunction changeSaleTokenAddress(uint256 _id, address _newAddress)\n```\n\nExample (*truffle console*):\n```typescript\nlet instance = await TokenSaleTest.deployed()\nlet latestPresaleId = await instance.presaleId.call()\n// _id = latestPresaleId or the preSaleId which you want to change\n// _newAddress = 0xdc381eac30f839e9c9f614d31e6c71679b40fa10 -\u003e ERC20 Token address\ninstance.changeSaleTokenAddress(latestPresaleId, \"0xdc381eac30f839e9c9f614d31e6c71679b40fa10\")\n```\n\n## How to change sale token price\n```javascript\n/**\n * @dev To update the price\n * @param _id Presale id to update\n * @param _newPrice New sale price of the token\n */\nfunction changePrice(uint256 _id, uint256 _newPrice)\n```\n\nExample (*truffle console*):\n```typescript\nlet instance = await TokenSaleTest.deployed()\nlet latestPresaleId = await instance.presaleId.call()\n// _id = latestPresaleId or the preSaleId which you want to change\n// _newPrice = 18005041411595246 -\u003e 0,018005041411595246$ per Token\ninstance.changePrice(latestPresaleId, BigInt(18005041411595246))\n```\n\n## How to enable / disable buy with Ethers functionality\n```javascript\n/**\n * @dev To update possibility to buy with ETH\n * @param _id Presale id to update\n * @param _enableToBuyWithEth New value of enable to buy with ETH\n */\nfunction changeEnableBuyWithEth(uint256 _id, uint256 _enableToBuyWithEth)\n```\n\nExample (*truffle console*):\n```typescript\nlet instance = await TokenSaleTest.deployed()\nlet latestPresaleId = await instance.presaleId.call()\n// _id = latestPresaleId or the preSaleId which you want to change\n// _enableToBuyWithEth = 1 -\u003e Enabled\ninstance.changeEnableBuyWithEth(latestPresaleId, 1)\n```\n\n## How to enable / disable buy with USDT functionality\n```javascript\n/**\n * @dev To update possibility to buy with Usdt\n * @param _id Presale id to update\n * @param _enableToBuyWithUsdt New value of enable to buy with Usdt\n */\nfunction changeEnableBuyWithUsdt(uint256 _id, uint256 _enableToBuyWithUsdt)\n```\n\nExample (*truffle console*):\n```typescript\nlet instance = await TokenSaleTest.deployed()\nlet latestPresaleId = await instance.presaleId.call()\n// _id = latestPresaleId or the preSaleId which you want to change\n// _enableToBuyWithUsdt = 0 -\u003e Disabled\ninstance.changeEnableBuyWithUsdt(latestPresaleId, 0)\n```\n\n## How to pause / unpause presale\n```javascript\n/**\n * @dev To pause the presale\n * @param _id Presale id to update\n */\nfunction pausePresale(uint256 _id)\n\n/**\n * @dev To unpause the presale\n * @param _id Presale id to update\n */\nfunction unPausePresale(uint256 _id)\n```\n\nExample (*truffle console*):\n```typescript\nlet instance = await TokenSaleTest.deployed()\nlet latestPresaleId = await instance.presaleId.call()\n// _id = latestPresaleId or the preSaleId which you want to change\ninstance.pausePresale(latestPresaleId)\n// _id = latestPresaleId or the preSaleId which you want to change\ninstance.unPausePresale(latestPresaleId)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr3d4ng3l%2Fpresalesmartcontract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr3d4ng3l%2Fpresalesmartcontract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr3d4ng3l%2Fpresalesmartcontract/lists"}