This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I got tired of seeing examples of mongo healthchecks that weren't actually doing anything | |
# They appear to work only because the mongo server happens to be up by the time the first health check happens | |
# But they don't actually assess whether it's ok or not | |
# This one does | |
services: | |
mongo-express: | |
image: mongo-express:1.0 | |
ports: | |
- 8081:8081 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this function takes in an object whose values are all promises | |
// and returns a single promise that resolves to an object with all the same keys with resolved values | |
async function promiseAllObjectValues<T>( | |
object: { | |
[TK in keyof T]: Promise<T[TK]>; | |
} | |
): Promise<T> { | |
return Promise.all( | |
Object.entries(object).map(async ([name, promise]) => [ | |
name, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BigNumberish, Signature, utils, providers, Contract } from "ethers"; | |
// this is designed to work with USDC | |
export async function signPermit( | |
signer: providers.JsonRpcSigner, | |
token: Contract, | |
chainId: BigNumberish, | |
spender: string, | |
value: BigNumberish, | |
deadline: BigNumberish |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ethers } from "ethers"; | |
const provider = new ethers.providers.Web3Provider((window as any).ethereum); | |
const multiCallAddresses = { | |
1: "0xeefba1e63905ef1d7acba5a8513c70307c1ce441", | |
3: "0x53C43764255c17BD724F74c4eF150724AC50a3ed", // ropsten | |
4: "0x42ad527de7d4e9d9d011ac45b31d8551f8fe9821", // rinkeby | |
5: "0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e", // goerli | |
42: "0x2cc8688c5f75e365aaeeb4ea8d6a480405a48d2a", // kovan |