Skip to content

Instantly share code, notes, and snippets.

@coburncoburn
coburncoburn / Untitled.sol
Created June 13, 2020 00:21
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.6+commit.6c089d02.js&optimize=false&gist=
contract Test {
for (uint i = 0; i < messages.length; i++) { for (uint i = 0; i < messages.length; i++) {
string memory symbol = OpenOraclePriceData(address(data)).put(messages[i], signatures[i]); OpenOraclePriceData(address(data)).put(messages[i], signatures[i]);
// Possibly add to the unique symbol set
bool found = false;
for (uint j = 0; j < symbols.length; j++) {
if (keccak256(abi.encodePacked(symbol)) == keccak256(abi.encodePacked(symbols[j]))) {
found = true;
break;
@coburncoburn
coburncoburn / Untitled.sol
Created August 13, 2019 17:24
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.10+commit.5a6ea5b1.js&optimize=true&gist=
contract Test {
for (uint i = 0; i < messages.length; i++) { for (uint i = 0; i < messages.length; i++) {
string memory symbol = OpenOraclePriceData(address(data)).put(messages[i], signatures[i]); OpenOraclePriceData(address(data)).put(messages[i], signatures[i]);
// Possibly add to the unique symbol set
bool found = false;
for (uint j = 0; j < symbols.length; j++) {
if (keccak256(abi.encodePacked(symbol)) == keccak256(abi.encodePacked(symbols[j]))) {
found = true;
break;
{"SELECT s0.\"account\", s0.\"token_addresses\", s0.\"token_borrow_balance_underlyings\", s0.\"token_supply_balance_underlyings\", s0.\"total_liquidity_value\", s0.\"total_borrow_value\", s0.\"total_collateral_value\", ( s0.\"total_collateral_value\" )::numeric / NULLIF((s0.\"total_borrow_value\")::numeric, 0) FROM (SELECT s0.\"account\" AS \"account\", array_agg(s0.\"token_address\"::text) AS \"token_addresses\", json_object_agg(s0.\"token_address\", s0.\"borrow_balance_underlying\") AS \"token_borrow_balance_underlyings\", json_object_agg(s0.\"token_address\", s0.\"supply_balance_underlying\") AS \"token_supply_balance_underlyings\", sum(s0.\"liquidity_value\") AS \"total_liquidity_value\", sum(s0.\"borrow_value\") AS \"total_borrow_value\", sum(s0.\"collateral_value\") AS \"total_collateral_value\" FROM (SELECT s0.\"id\" AS \"id\", s0.\"account\" AS \"account\", s0.\"block_number\" AS \"block_number\", s0.\"log_index\" AS \"log_index\", s0.\"supply\" AS \"supply\", s0.\"borrow\" AS \"borrow\", s0.\"interes
@coburncoburn
coburncoburn / merp.sol
Created April 8, 2019 18:22
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.7+commit.6da8b019.js&optimize=false&gist=
pragma solidity ^0.5.7;
contract Logalitos {
event Log(address x, string y);
function logger() public {
emit Log(msg.sender, "logger");
}
function outsideLog() public {
@coburncoburn
coburncoburn / merp.sol
Created February 20, 2019 01:33
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.4+commit.9549d8ff.js&optimize=false&gist=
pragma solidity ^0.5.2;
contract StoraTheExplora {
address delegate;
constructor() public {
}
function setBacon(uint a) public {
(bool success, bytes memory data) = delegate.delegatecall(abi.encodePacked(bytes4(keccak256("setBacon(uint256)")), a));
}
@coburncoburn
coburncoburn / inputs_test.sol
Created February 20, 2019 01:33
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.4+commit.9549d8ff.js&optimize=false&gist=
pragma solidity ^0.5.4;
contract AddressSetHaver {
uint[] public testList = [1,2,3,4,5,6];
uint[] public smallList = [5];
function emptySmallList() public {
smallList.length --;
}
@coburncoburn
coburncoburn / inputs_test.sol
Created February 20, 2019 01:32
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.4+commit.9549d8ff.js&optimize=false&gist=
pragma solidity ^0.5.4;
contract AddressSetHaver {
uint[] public testList = [1,2,3,4,5,6];
uint[] public smallList = [5];
function emptySmallList() public {
smallList.length --;
}
@coburncoburn
coburncoburn / inputs_test.sol
Created January 12, 2019 00:59
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.2+commit.1df8f40c.js&optimize=false&gist=
pragma solidity ^0.5.2;
contract AssetsListTest {
uint8[] arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29];
uint8[] nearlyFull = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28];
uint8[] empty;
constructor() public {
@coburncoburn
coburncoburn / inputs_test.sol
Created January 11, 2019 01:06
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.2+commit.1df8f40c.js&optimize=false&gist=
contract SupplyPolicyHook {
struct SupplyLocalVars {
uint startingBalance;
uint newSupplyIndex;
uint userSupplyCurrent;
uint userSupplyUpdated;
uint newTotalSupply;
uint currentCash;
uint updatedCash;
uint newSupplyRateMantissa;
@coburncoburn
coburncoburn / inputs_test.sol
Created January 11, 2019 00:58
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.2+commit.1df8f40c.js&optimize=false&gist=
contract SupplyPolicyHook {
struct SupplyLocalVars {
uint startingBalance;
uint newSupplyIndex;
uint userSupplyCurrent;
uint userSupplyUpdated;
uint newTotalSupply;
uint currentCash;
uint updatedCash;
uint newSupplyRateMantissa;