Skip to content

Instantly share code, notes, and snippets.

@gg2001
gg2001 / CToken.py
Last active October 6, 2021 10:11
Python implementation of Compound's CToken & InterestRateModel contract
import abc
def truncate(n: int, decimals: int = 18) -> float:
return n / (10 ** decimals)
def apy(ratePerBlock: int) -> float:
return ((((((ratePerBlock / 1e18) * 6570) + 1) ** 365)) - 1) * 100
@gg2001
gg2001 / Global.gitignore
Last active May 21, 2020 13:09
Global .gitignore for macOS, Linux, Windows, Emacs, Vim, VS Code, Sublime Text
### Begin Global.gitignore (https://github.com/github/gitignore)
### https://gist.github.com/gg2001/6a838a9bbae3138e0a2f7c1712058708
## macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride