Skip to content

Instantly share code, notes, and snippets.

View cryptonomicon46's full-sized avatar
💭
Working on an NFT project

Sand N cryptonomicon46

💭
Working on an NFT project
View GitHub Profile
@cryptonomicon46
cryptonomicon46 / finance_buddy.py
Last active December 16, 2024 15:46
Financial Analyst
"""
Credit Card Transaction Analyzer using Claude API
================================================
Author: Sandip Nallani
Date: December 14, 2024
Version: 1.0
Description:
------------
A simple tool that uses the Claude API to analyze credit card transactions.
@cryptonomicon46
cryptonomicon46 / GarageManager.sol
Created November 22, 2023 22:39
The interface and contract for the `GarageManager` exercise.
/**
@notice GarageManager inherits the IGarageManager interface
It has various functions to add,return and modify cars for an owner in the garage
*/
contract GarageManager is IGarageManager {
//@dev storage variable to hold the array of cars
Car[] public cars;
//@dev mapping from owner to owned cars in the garage
mapping (address owner => Car[] ownedCars) public carsInTheGarageByOwner;
@cryptonomicon46
cryptonomicon46 / Console Output
Created October 30, 2023 05:58
EthenaMinting Handler and Invariant tests
Running 2 tests for test/foundry/minting/tests/Invariant_EthenaMinting.t.sol:Invariant_EthenaMinting
[PASS] invariant_balance_USDe() (runs: 256, calls: 3840, reverts: 1675)
[PASS] invariant_collateral_transfer() (runs: 256, calls: 3840, reverts: 1670)
@cryptonomicon46
cryptonomicon46 / VerifySignatureTest.sol
Last active March 17, 2023 15:16
Generate message digest 'getMessageToSign' and verify the EIP 712 signature of the signer
import { time, loadFixture } from "@nomicfoundation/hardhat-network-helpers";
import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs";
import { expect } from "chai";
import { ethers } from "hardhat";
describe("VerifySignature", function () {
// We define a fixture to reuse the same setup in every test.
// We use loadFixture to run this setup once, snapshot that state,
// and reset Hardhat Network to that snapshopt in every test.
async function deployVerifySignatureFixture() {
@cryptonomicon46
cryptonomicon46 / Betting.sol
Created February 9, 2023 05:30
Fixed any compile error for solidity version 0.8.0
//SPDX-License-Identifier: MIT
pragma solidity =0.8.0;
contract Betting {
address payable public owner;
uint256 public minimumBet;
uint256 public totalBetsOne;
uint256 public totalBetsTwo;
address payable[] public players;
struct Player {
uint256 amountBet;
const { expect } = require("chai");
const { ethers } = require("hardhat");
const { BigNumber } = require("ethers");
const { parseEther, formatEther } = require("ethers/lib/utils");
const {time,loadFixture} = require("@nomicfoundation/hardhat-network-helpers");
const { anyValue } = require("@nomicfoundation/hardhat-chai-matchers/withArgs");
const { parse } = require("dotenv");
const { format } = require("path");
@cryptonomicon46
cryptonomicon46 / IWETH.sol
Last active December 29, 2022 18:25
WETH-Test token to interact with on Goerli testnet
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
/// @title IWETH contract interface that has all the ERC20 capabilities
/// @author Sandip Nallani
/// @notice This will be inherited by the WETH contract and then by the DepositAndWithdraw.sol contract to wrap/UnWrap user's ETH
interface IWETH {
@cryptonomicon46
cryptonomicon46 / DepositAndWithdraw.sol
Created December 29, 2022 03:33
The contract that interacts with the WETH contract to deposit/withdraw on behalf of the user
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "hardhat/console.sol";
import "./IWETH.sol";
@cryptonomicon46
cryptonomicon46 / NoDelegateCall
Created July 4, 2022 19:42
No Delegate Call Example
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
abstract contract NoDelegateCall{
address public immutable originalOwner;
constructor() {
originalOwner = address(this);
@cryptonomicon46
cryptonomicon46 / UniSwapV3CreatePool
Created July 4, 2022 19:40
UnitSwap V3 Factory creating Pool addresses
//SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
abstract contract NoDelegateCall{
address private immutable original;
constructor() {
original = address(this);
}