const Compound = require('@compound-finance/compound-js');
const provider = 'https://mainnet.infura.io/v3/' + process.env.infuraApiKey;
const cTokenToGetCompApy = Compound.cUSDC; // Pick an asset
const underlying = cTokenToGetCompApy.slice(1, 10);
const underlyingDecimals = Compound.decimals[underlying];
This file contains 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
" When git complains about line endings with this message: | |
" \ No newline at end of file | |
" the easier fix is to use the following VIM command: | |
set noendofline binary |
This file contains 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
/// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 | |
/// @param a The multiplicand | |
/// @param b The multiplier | |
/// @param denominator The divisor | |
/// @return result The 256-bit result | |
/// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv | |
function mulDiv( | |
uint256 a, | |
uint256 b, | |
uint256 denominator |
This file contains 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
pragma solidity ^0.5.0; | |
contract MillerRabin | |
{ | |
function modexp_rsa2048(uint256[8] memory b, uint256 e) | |
public view returns(uint256[8] memory result) | |
{ | |
bool success; | |
assembly { | |
let freemem := mload(0x40) |
This file contains 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
" status bar colors | |
au InsertEnter * hi statusline guifg=black guibg=#d7afff ctermfg=black ctermbg=magenta | |
au InsertLeave * hi statusline guifg=black guibg=#8fbfdc ctermfg=black ctermbg=cyan | |
hi statusline guifg=black guibg=#8fbfdc ctermfg=black ctermbg=cyan | |
" Status line | |
" default: set statusline=%f\ %h%w%m%r\ %=%(%l,%c%V\ %=\ %P%) | |
" Status Line Custom | |
let g:currentmode={ |
This file contains 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
pragma solidity ^0.4.17; | |
contract ModExp { | |
// Wrapper for built-in bigint_modexp (contract 0x5) as described here https://github.com/ethereum/EIPs/pull/198 | |
function modexp(bytes memory _base, bytes memory _exp, bytes memory _mod) public view returns(bytes memory ret) { | |
uint256 bl = _base.length; | |
uint256 el = _exp.length; | |
uint256 ml = _mod.length; |
This file contains 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
cmake_minimum_required(VERSION 3.3) | |
project(bitcoin) | |
set(CMAKE_CXX_STANDARD 11) | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |
add_custom_target(build-bitcoin ALL | |
COMMAND ./autogen.sh | |
COMMAND ./configure | |
COMMAND $(MAKE) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
This file contains 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
contract BinarySearch { | |
///@why3 | |
/// requires { arg_data.length < UInt256.max_uint256 } | |
/// requires { 0 <= to_int arg_begin <= to_int arg_end <= arg_data.length } | |
/// requires { forall i j: int. 0 <= i <= j < arg_data.length -> to_int arg_data[i] <= to_int arg_data[j] } | |
/// variant { to_int arg_end - to_int arg_begin } | |
/// ensures { | |
/// to_int result < UInt256.max_uint256 -> (to_int arg_begin <= to_int result < to_int arg_end && to_int arg_data[to_int result] = to_int arg_value) | |
/// } | |
/// ensures { |