Skip to content

Instantly share code, notes, and snippets.

@ZigBalthazar
ZigBalthazar / main.sol
Created October 11, 2023 05:04
implementation of a sample contract deploy and raw Call
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
contract UserContractFactory {
mapping(address => address) public userContracts;
address public storageContractAddr;
address public owner;
bytes constant GET_NUMBER_SIG = abi.encodeWithSelector(bytes4(keccak256("getNumber()")));
@ZigBalthazar
ZigBalthazar / eip-712.ts
Last active February 27, 2024 16:15
EIP-712
import { ethers, verifyTypedData, JsonRpcProvider, Wallet, TypedDataField } from "ethers";
interface IProviderAndSigner {
provider: JsonRpcProvider;
signer: Wallet;
}
interface IDomain {
name: string,
version: string,
@ZigBalthazar
ZigBalthazar / eip712.sol
Created February 27, 2024 16:13
solidity-eip712-verify
pragma solidity ^0.7.6;
pragma abicoder v2;
import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol";
contract Authentication {
using ECDSA for bytes32;
string public constant name = "EIP712Authentication";
string public constant version = "1.0.0";
@ZigBalthazar
ZigBalthazar / UTXO.ts
Created March 9, 2024 15:56
implementatiton of UTXO in typescript
type UTXO = {
id: string;
amount: number;
};
type Wallet = {
address: string;
utxos: UTXO[];
};