Skip to content

Instantly share code, notes, and snippets.

View atisheksingh's full-sized avatar
🏢
Working from office

atisheks1 atisheksingh

🏢
Working from office
  • Blockchain Architech @ OriginalsGateways
  • Pune , India
  • 15:11 (UTC +05:30)
View GitHub Profile
@atisheksingh
atisheksingh / L2OutputOracle.sol
Created December 3, 2024 15:08 — forked from markodayan/L2OutputOracle.sol
L2 Output Oracle (replaces the State Commitment Chain. Will be used to receive fault proof data)
//SPDX-License-Identifier: MIT
// https://community.optimism.io/docs/developers/bedrock/differences/#l1-contracts
pragma solidity 0.8.10;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title L2OutputOracle
* @notice The L2 state is committed to in this contract
* The payable keyword is used on appendL2Output to save gas on the msg.value check.
@atisheksingh
atisheksingh / docs.chain.link...samples...VRF...Lottery.sol
Created December 21, 2022 13:26 — forked from jackpmorgan/docs.chain.link...samples...VRF...Lottery.sol
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.12+commit.f00d7308.js&optimize=false&runs=200&gist=
// To enable meta transaction, let create a generic method that calls executeMetaTransaction by taking the user signature
// and then execute transaction via Biconomy
// Dependencies
import {toBuffer} from "ethereumjs-util";
import abi from "ethereumjs-abi";
import events from "events";
// Initialization of web3
let web3 = new Web3(window.ethereum);
@atisheksingh
atisheksingh / solidity-enums-with-data.md
Created July 15, 2022 13:31 — forked from cameel/solidity-enums-with-data.md
Enums with data in Solidity

Use cases

  • Optional/nullable data types.
  • Variant data types.
  • Flag with extra information needed only in some cases (or different in different cases).
  • Modeling states in a state machine where each state can have some data associated with it.
  • List of operations for batch processing, where each operation can have its own arguments.
  • Alternative to function overloading that allows avoiding combinatorial explosion when there are multiple parameters that need variants.
  • Nested data structures with heterogenous nodes.

Syntax and semantics

Compile

npx hardhat compile

Run unit tests

npx hardhat test

Start local node

npx hardhat node

Deploy to Rinkeby

@atisheksingh
atisheksingh / BnbStaking.sol
Created March 12, 2022 17:08 — forked from serefercelik/BnbStaking.sol
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.6.12+commit.27d51765.js&optimize=true&runs=200&gist=
pragma solidity 0.6.12;
import '@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol';
// import "@nomiclabs/buidler/console.sol";
interface IWBNB {