Skip to content

Instantly share code, notes, and snippets.

View coderwithsense's full-sized avatar

Himanshu coderwithsense

View GitHub Profile
@coderwithsense
coderwithsense / OracleProvider.sol
Created March 30, 2025 09:50
Deploys new PredictionGame contracts and tracks them by creator and token pair. Core contract per market. Handles mint, burn, snapshot, claim, and progressive fee logic.
// Still to be implemented
@coderwithsense
coderwithsense / PredictionFactory.sol
Created March 30, 2025 09:49
Deploys new PredictionGame contracts and tracks them by creator and token pair
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./PredictionGame.sol";
contract PredictionFactory {
address[] public allGames;
mapping(address => address[]) public userGames;
event GameCreated(address game, address creator);
@coderwithsense
coderwithsense / StoryNFT.sol
Created January 5, 2025 23:01
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.19;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract StoryNFT is ERC721URIStorage, Ownable {
uint256 private _tokenIds;
constructor() ERC721("StoryNFT", "SNFT") Ownable(msg.sender) {}
@coderwithsense
coderwithsense / BetPool.sol
Created January 5, 2025 20:45
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.0;
/**
* @dev Minimal ERC20 interface
*/
interface IERC20 {
function transferFrom(
address sender,
address recipient,
@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)