Skip to content

Instantly share code, notes, and snippets.

@coburncoburn
coburncoburn / existence_check.sol
Created January 10, 2019 23:44
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 {
function verify() public {
}
}
contract SimpleTest {
SupplyPolicyHook public hook;
mapping(bytes4 => bool) public shouldDefend;
@coburncoburn
coburncoburn / existence_check.sol
Created January 11, 2019 00:09
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 {
function verify() public {
}
}
contract SimpleTest {
SupplyPolicyHook public hook;
mapping(bytes4 => bool) public shouldDefend;
@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;
@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 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 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 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 / 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 / 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 {
{"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