Skip to content

Instantly share code, notes, and snippets.

View janndriessen's full-sized avatar
🍊

JD janndriessen

🍊
View GitHub Profile
import { BigNumber } from '@ethersproject/bignumber';
import { ethers } from 'ethers';
type APRType = {
apr: number
feesEarned0: BigNumber
feesEarned1: BigNumber
}
const X96 = BigNumber.from(2).pow(BigNumber.from(96))
@karmacoma-eth
karmacoma-eth / sending-ether-cheat-sheet.md
Last active June 14, 2024 04:11
Sending Ether Cheat Sheet

Sending Ether Cheat Sheet

TLDR

🥇 Instead of sending Ether, use the withdrawal pattern

🥈 If you really need to send Ether, use a safe wrapper like OpenZeppelin's Address.sendValue(addr, amount)

🥉 If you really need to send Ether without dependencies, use (bool success, ) = addr.call{value: amount}("")

@joeblau
joeblau / pre-commit
Created June 1, 2019 16:57
Pre commit git hook to run SwiftLint and SwiftFormat
#!/bin/bash
# Place this file in `.git/hooks/`
if which swiftlint >/dev/null; then
swiftlint autocorrect
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
git diff --diff-filter=d --staged --name-only | grep -e '\(.*\).swift$' | while read line; do