Skip to content

Instantly share code, notes, and snippets.

@AmyBlur
AmyBlur / contract_deploy.ts
Created April 19, 2023 18:40
部署合约。用 ethers 的 ContractFactory 和 abi bytecode provide wallet 。
import { ethers } from "ethers";
// 定义智能合约的 ABI 和 bytecode
const abi = [...];
const bytecode = "0x6080604052...";
// 连接到以太坊网络
const provider = new ethers.providers.JsonRpcProvider("http://localhost:8545");
// 创建一个以太坊钱包
@AmyBlur
AmyBlur / dydxFlashLoanTemplate.sol
Created April 13, 2021 07:47 — forked from cryptoscopia/dydxFlashLoanTemplate.sol
A single-file simplest possible template for a contract that obtains a flash loan from dydx, does things, and pays it back.
// SPDX-License-Identifier: AGPL-3.0-or-later
// The ABI encoder is necessary, but older Solidity versions should work
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// These definitions are taken from across multiple dydx contracts, and are
// limited to just the bare minimum necessary to make flash loans work.
library Types {
enum AssetDenomination { Wei, Par }
@AmyBlur
AmyBlur / ensDomainTransfer.js
Created March 28, 2021 22:03 — forked from andrekorol/ensDomainTransfer.js
Flashbots ENS domain transfer
const hre = require('hardhat');
const { map } = require('underscore');
require('dotenv').config();
const {
FlashbotsBundleProvider,
} = require('@flashbots/ethers-provider-bundle');
const ENS = require('./ENSABI.json');