Skip to content

Instantly share code, notes, and snippets.

View coderwithsense's full-sized avatar

Himanshu coderwithsense

View GitHub Profile
@coderwithsense
coderwithsense / contacts.sol
Created August 13, 2024 18:52
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.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/Ownable.sol";
contract ContactManager is Ownable {
constructor(address initialOwner) Ownable(initialOwner) {}
struct User {
address userAddress;
@coderwithsense
coderwithsense / spl-token.js
Last active April 17, 2024 20:04
CREATING SPL-TOKEN
import { percentAmount, generateSigner, signerIdentity, createSignerFromKeypair } from '@metaplex-foundation/umi'
import { TokenStandard, createAndMint } from '@metaplex-foundation/mpl-token-metadata'
import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';
import { mplCandyMachine } from "@metaplex-foundation/mpl-candy-machine";
import "@solana/web3.js";
import base58 from 'bs58';
import { clusterApiUrl } from '@solana/web3.js';
// CHANGE THESE VALUES
@coderwithsense
coderwithsense / README.md
Last active January 10, 2024 13:25
CryptoGrad PreSale Smart Contract (Editing required for production ready)

TokenPresale Smart Contract

Overview

The TokenPresale smart contract facilitates the sale of a specific ERC-20 token at a predetermined rate in exchange for Ether (ETH). It includes features such as pausing, ownership control, and a cap on the total ETH that can be raised during the presale.

Important Variables

  • token: The ERC-20 token being sold.
  • rate: The rate at which tokens are exchanged for ETH, denominated in wei.
  • cap: The maximum amount of ETH that can be raised during the presale.
  • weiRaised: Total amount of ETH raised so far.
@coderwithsense
coderwithsense / cryptoGradnonTaxToken.sol
Created January 10, 2024 11:37
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.22+commit.4fc1097e.js&optimize=false&runs=200&gist=
// File: @openzeppelin/contracts/utils/Nonces.sol
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides tracking nonces for addresses. Nonces will only increment.
*/
@coderwithsense
coderwithsense / cryptoGradTaxToken.sol
Created January 4, 2024 13:05
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.23+commit.f704f362.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
@coderwithsense
coderwithsense / cryptoGradTaxToken.sol
Created January 4, 2024 11:40
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.23+commit.f704f362.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
@coderwithsense
coderwithsense / cryptoGradTaxToken.sol
Created January 4, 2024 10:53
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.23+commit.f704f362.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)

We have to input marketing, cex, dev wallet initially when deploying, these wallets are

Max transaction amount is 3% of the supply, maxWalletSize is 2% of th supply, taxSwapTreshold is 0.5% of the supply

To openTrade, send tokens to token address and amount of eth you want to supply for pair on uniswap, use function openTrading()

Tax wallet is the deployer wallet, which will get 90% of the token supply initially