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
const Compound = require('@compound-finance/compound-js'); | |
const provider = 'https://mainnet.infura.io/v3/' + process.env.infuraApiKey; | |
// mainnet | |
const CompoundLens = Compound.util.getAddress(Compound.CompoundLens); | |
const LensAbi = Compound.util.getAbi(Compound.CompoundLens); | |
const COMP = Compound.util.getAddress(Compound.COMP); | |
const Comptroller = Compound.util.getAddress(Compound.Comptroller); | |
const me = '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'; |
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
// Based on https://github.com/ethereum/EIPs/blob/master/assets/eip-712/Example.js | |
const ethers = require('ethers'); | |
function abiRawEncode(encTypes, encValues) { | |
const hexStr = ethers.utils.defaultAbiCoder.encode(encTypes, encValues); | |
return Buffer.from(hexStr.slice(2, hexStr.length), 'hex'); | |
} | |
function keccak256(arg) { |
Get the value of COMP earned for an address that uses the Compound protocol. This can be done using the Lens contract with JSON RPC or another Smart Contract. If you do an eth_call
with JSON RPC, it is free (no gas costs).
- Use the
getCompBalanceMetadataExt
method in the Lens contract https://etherscan.io/address/0xdCbDb7306c6Ff46f77B349188dC18cEd9DF30299#code - Lens address is posted here https://github.com/compound-finance/compound-protocol/blob/master/networks/mainnet.json#L31
- Here is the definition https://github.com/compound-finance/compound-protocol/blob/master/contracts/Lens/CompoundLens.sol#L453
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
********This Text Adventure is Copyright 1993, by Erica Sadun******** | |
ALL RIGHTS RESERVED. Known bugs and differences from Infocom games? say ‘news’. Unfamiliar with certain words? say ‘jargon’ | |
PIRATING | |
To hack and to slash with the best of the best | |
Means you must have a spirit which is steely and cold | |
You must fight without mercy, from earliest dawn | |
The heart of a pirate is ruthless and bold. | |
Richard T. Pettyheart, Scholar | |
Treatise on Pirates, 1638 |
- Proposal: SE-nnnnnnnn
- Authors: Chris Lattner, Erica Sadun
- Review Manager: TBD
- Status: Awaiting implementation
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
#!/usr/bin/env bash | |
set -euo pipefail | |
trap 'error "$(printf "Command \`%s\` on line $LINENO failed with exit code $?" "$BASH_COMMAND")"' ERR | |
## setup functions for use throughout the script | |
function error { | |
>&2 printf "\033[31mERROR\033[0m: $@\n" | |
} | |
function :: { |
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
#!/usr/bin/env bash | |
cpuname=$(sysctl -n machdep.cpu.brand_string) | |
# Patch Lightroom Classic first | |
sudo perl -i -pe 's|\x90\x90\x90\x90\x56\xE8\x3A\x00|\x90\x90\x90\x90\x56\xE8\x1A\x00|sg' /Applications/Adobe\ Lightroom\ Classic/Adobe\ Lightroom\ Classic.app/Contents/Frameworks/CameraRaw.lrtoolkit/CameraRaw | |
sudo perl -i -pe 's|\x90\x90\x90\x90\x56\xE8\x5A\x00|\x90\x90\x90\x90\x56\xE8\x3A\x00|sg' /Applications/Adobe\ Lightroom\ Classic/Adobe\ Lightroom\ Classic.app/Contents/Frameworks/CameraRaw.lrtoolkit/CameraRaw | |
# Patch MMXCore and FastCore instances in all other applications | |
find /Applications/Adobe* -type f -name "MMXCore" -print0 | sudo xargs -0 -I "{}" perl -i -pe 's|\x90\x90\x90\x90\x56\xE8\x5A\x00|\x90\x90\x90\x90\x56\xE8\x3A\x00|sg' "{}" |
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
#### | |
# Retag | |
retag = "!f(){ name=`git tag`; git tag -d \"$name\"; echo "Retagged $name"; remote=`git remote -v`; \ | |
if [ \"$remote\" != \"\" ]; then git push origin --delete \"$name\"; fi; \ | |
git tag \"$name\"; \ | |
if [ \"$remote\" != \"\" ]; then git push --tags; else echo "No remote"; fi; };f" | |
untag = "!f(){ name=`git tag`; git tag -d \"$name\"; remote=`git remote -v`; \ | |
if [ \"$remote\" != \"\" ]; then git push origin --delete \"$name\"; \ | |
else echo "No remote"; fi; };f" | |
tagit = "!f(){ git tag \"$@\"; echo "Tagged $name"; remote=`git remote -v`; \ |