Skip to content

Instantly share code, notes, and snippets.

@ezynda3
ezynda3 / ConnectFour.sol
Created November 27, 2022 14:08
Connect Four Solidity
// SPDX-License-Identifier: MIT
//
// Let's play connect-four!
// Check out the contract for details.
pragma solidity 0.8.17;
contract ConnectFour {
mapping(bytes32 => Game) public games; // Game IDs ==> Games
mapping(address => uint256) public nrOfGames; // User ==> Nr. of Games
@ezynda3
ezynda3 / rescue-tokens.ts
Created July 18, 2022 08:08
Flashbots Rescue Tokens
import { ethers, providers, Wallet, utils, Transaction } from "ethers";
import {
FlashbotsBundleProvider,
FlashbotsBundleResolution,
} from "@flashbots/ethers-provider-bundle";
import { exit } from "process";
const FLASHBOTS_URL = "https://relay-goerli.flashbots.net";
const TOKEN_ADDRESS = "0x4E5d67a73bdb6BF68fADa7BDD7F455A7aA02C8ab";
@ezynda3
ezynda3 / lifisyncfiles.txt
Created April 3, 2022 18:34
Lifi Sync Files
src/Interfaces/ICBridge.sol
src/Interfaces/IERC173.sol
src/Interfaces/ILiFi.sol
src/Interfaces/ITransactionManager.sol
src/Interfaces/IERC165.sol
src/Interfaces/IAnyswapRouter.sol
src/Interfaces/IDiamondLoupe.sol
src/Interfaces/IHopBridge.sol
src/Interfaces/IDiamondCut.sol
src/Interfaces/IAnyswapToken.sol
@ezynda3
ezynda3 / web3modal.svelte
Created December 6, 2021 09:41
Web3Modal Svelte example
<script>
import { onMount } from 'svelte'
import { defaultChainStore, web3 } from 'svelte-web3'
let Web3Modal
let WalletConnectProvider
onMount(() => {
Web3Modal = window.Web3Modal.default
@ezynda3
ezynda3 / deploy.sh
Created December 5, 2021 11:34
Deploy using CREATE2 proxy dapptools example
#!/bin/sh
FACTORY_ADDRESS="0x4e59b44847b379578588920ca78fbf26c0b4956c"
SALT=$(seth --to-bytes32 $(seth --to-hex 2121))
BYTECODE=$(jq -r ".contracts[\"src/Nftrade.sol\"].Nftrade.evm.bytecode.object" out/dapp.sol.json)
ARGS=$(seth abi-encode "constructor(address)" $ETH_FROM | cut -c 3-)
CONTRACT_ADDRESS=$(seth call $FACTORY_ADDRESS "$SALT$BYTECODE$ARGS")
seth send $FACTORY_ADDRESS $SALT$BYTECODE$ARGS --gas 1100000
echo "Deployed to address: $CONTRACT_ADDRESS"
@ezynda3
ezynda3 / generateCalldata.js
Created September 21, 2021 11:22
generateCalldata.js
const ethers = require("ethers");
async function main() {
if (!process.argv[2] || !process.argv[3]) {
console.log("\nUsage: node generateCalldata.js <function signature> <args>");
console.log('e.g node generateCalldata.js "myFunction((uint8,bool)[],uint256)" "[[1,true],[2,false]],12345678"');
console.log("\n")
throw Error
}
@ezynda3
ezynda3 / connextTest.ts
Last active September 4, 2021 16:18
Connext Test
import 'dotenv/config'
import { node_url } from '../utils/network'
import { providers, Wallet, utils } from 'ethers'
import { NxtpSdk, NxtpSdkEvents } from '@connext/nxtp-sdk'
import { NXTPFacet__factory, ERC20__factory } from '../typechain'
const tidy = (str: string): string =>
`${str.replace(/\n/g, '').replace(/ +/g, ' ')}`
async function main() {
@ezynda3
ezynda3 / swap.sol
Last active August 24, 2021 11:03
Swap Interface
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
import "./interfaces/ITransactionManager.sol";
contract CrossChain {
private immutable ITransactionManager transactionManager;
enum SwapType { ONE_INCH, PARASWAP, SUSHI }
@ezynda3
ezynda3 / id_rsa.pub
Created January 10, 2019 14:57
x360 pub key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDG2rplA3T9TVHpHzjfEGSwHLrpPS6qNPBXQGKgDKabIBcW7TLkRddTY3gKKt73YCwd5/MYPL/9k6XoB9XdSAYrWtQaAtNZVGg3xZ52/FGqVELjrktnPHxfuqE9eAGGcsmOtI8MVG0xoAlznObJZFKkBEsP5KOY+56nIYvaV9Oaiq1gqiVLthMvboZf7+KY+N0Blrc7Lr6Yjq8prwCSYZGt2tHp8QSe3TM21t3cMlmIIiDCBorFPwO0Vo3fUjntcn43i+XiSjuGuoRK+RnIw36mA+eq7/le+UHSduXl2pZJyMIkiA0ShBHm6l9lwYop4CJ8EVpx5P7KSMQ+wMBbo9Qj
@ezynda3
ezynda3 / wtf-ethclient.go
Created January 2, 2018 13:58
Golang Ethereum Connection Example
package main
import (
"context"
"fmt"
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
)