Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save yousuf-hossain-shanto/126a21673acd8d0e7d8fe08cf621ff78 to your computer and use it in GitHub Desktop.

Select an option

Save yousuf-hossain-shanto/126a21673acd8d0e7d8fe08cf621ff78 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.24+commit.e11b9ed9.js&optimize=true&runs=200&gist=

func: createPresale

Param _price: How much sell tokens can be purchased in 1 USD. In sell tokens decimals. Assuming 18 decimals Ex: 0.02 USD/Token, so 50 tokens/USD. Value: 50000000000000000000

Param _nextStagePrice: Same as _price Ex: 0.025 USD/Token, so 40 tokens/USD. Value: 40000000000000000000

Param _tokensToSell: How much sell tokens you want to sell. In sell tokens decimals. Assuming 18 decimals Ex: 5 million or 5000000. Value: 5000000000000000000000000

Param _UsdtHardcap: How much fund you wanna collect. Kinda calculative value. Do (usdPrice per tokentokens to sell). In usdt decimals. Assuming 6 decimals. Ex: 0.025000000=100000. Value: 100000000000

func: ethToTokens. Returns sale tokens count in it's decimals points.

Param _id: presale id. You should've the current presale id. Ex: 1

Param amount: How much ETH you want to put. In wei. Ex: 1 ETH. Value: 1000000000000000000

func: usdToTokens. Returns sale tokens count in it's decimals points.

Param _id: presale id. You should've the current presale id. Ex: 1

Param amount: How much USDT/USDC you want to put. In USDT/USDC decimals. Assuming 6 decimals. Ex: 1 USDC. Value: 1000000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment