Skip to content

Instantly share code, notes, and snippets.

View ahmedali8's full-sized avatar
🦀

Ahmed Ali ahmedali8

🦀
View GitHub Profile
@ahmedali8
ahmedali8 / liquidityAmounts.ts
Created March 9, 2025 12:11
Amounts from Liquidity & Swap Calculations - Uniswap V4
import { SqrtPriceMath, TickMath } from "@uniswap/v3-sdk";
import Decimal from "decimal.js";
import { ethers } from "ethers";
import JSBI from "jsbi";
export const JSBI_ZERO = JSBI.BigInt(0);
export function getSqrtPriceAtTick(tick: string): string {
return new Decimal(1.0001).pow(tick).sqrt().mul(new Decimal(2).pow(96)).toFixed(0);
}
@ahmedali8
ahmedali8 / Coffee.sol
Created November 5, 2022 06:28
Blockchain Genesis - Web3Disrupt Workshop
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { CoffeeMock } from "./Coffee_NFT.sol";
contract Coffee {
struct Donate {
uint256 tokensDonated;
uint256 noOfDonations;
@ahmedali8
ahmedali8 / 1_Storage.sol
Created January 20, 2021 08:08
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.6+commit.6c089d02.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
@ahmedali8
ahmedali8 / 15dec2019CW.sol
Created May 29, 2020 07: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.6.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.6.0;
contract first {
enum Reg { // custom datatype for constant values
onsite, // 0
online // 1
}
struct Student { // custom dataType for students
uint RollNo;
string name;
@ahmedali8
ahmedali8 / 15dec2019CW.sol
Created May 14, 2020 05:43
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.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.6.0;
contract first {
enum Reg { // custom datatype for constant values
onsite, // 0
online // 1
}
struct Student { // custom dataType for students
uint RollNo;
string name;
@ahmedali8
ahmedali8 / 15dec2019CW.sol
Created May 6, 2020 06:18
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.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.6.0;
contract first {
enum Reg { // custom datatype for constant values
onsite, // 0
online // 1
}
struct Student { // custom dataType for students
uint RollNo;
string name;
@ahmedali8
ahmedali8 / iBank.sol
Created March 12, 2020 05:01
Gist for Remix IDE
//code here