Skip to content

Instantly share code, notes, and snippets.

@subhodi
subhodi / QuickSort.sol
Created December 14, 2017 08:31
Quick sort in Solidity for Ethereum network
pragma solidity ^0.4.18;
contract QuickSort {
function sort(uint[] data) public constant returns(uint[]) {
quickSort(data, int(0), int(data.length - 1));
return data;
}
function quickSort(uint[] memory arr, int left, int right) internal{
@karmacoma-eth
karmacoma-eth / sending-ether-cheat-sheet.md
Last active July 17, 2024 23:30
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}("")

@cwhinfrey
cwhinfrey / bridge_hacks.md
Last active July 20, 2024 16:39
Bridge Hack List

Gas Fee Models on EVM Chains

Chain Type Min Tx Gas Model Explanation
Arbitrum Optimistic Rollup 35-70k Multifunctional gas limit Bake L1 data fee into L2 gas limit
BNB Chain Sidechain 21k EVM Same as vanilla EVM
Gnosis Sidechain 21k EVM Same as vanilla EVM
OP Stack Optimistic Rollup 21k Two-dimensional fees Explicit L2 execution fee and implicit L1 DA fee
Polygon Sidechain 21k EVM Same as vanilla EVM