-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple Calculator Tool for Accessed Funds Total #250
base: main
Are you sure you want to change the base?
Conversation
Also just a note, I'm simply bumping the github actions workflows for now. We're using some egregiously old versions. Thats the only really unrelated change. |
impl Token { | ||
pub fn get_instance_of(token_name: TokenName) -> Token { | ||
match token_name { | ||
TokenName::Usdc => Token { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if all of these are effectively constants, they should be named statics
you could also re-use assets.rs from the nomad nft server
pub name: TokenName,
pub id: &'static str,
pub decimals: f64,
pub contract_address: &'static str,
pub recovered_total: f64,
}
static CQT: Token = oken {
name: TokenName::Cqt,
id: "covalent",
decimals: 18.0,
contract_address: "0xD417144312DbF50465b1C641d016962017Ef6240",
recovered_total: 34_082_775.751_599_7,
};
let mut total_accessed_value: f64 = 0.0; | ||
for token in tokens { | ||
let balance: f64 = get_token_balance(&token, address).await?; | ||
let accessed: f64 = token.recovered_total - balance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
danger math :o
Motivation
Simple tool to automate calculating the amount of funds that have been accessed by people relative to the amount that has been recovered.
Solution
Quick and simple binary crate to get the current quantity of each token in the NFT accountant, then get the price data for each token to calculate a quick total. This uses all publicly available information, the initial totals are sourced from the
nomad-xyz/hack-data
repository, the current quantities in the wallet are sourced from the public etherscan api, and the price data is sourced from the coingecko public api.PR Checklist