Skip to content
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

Remove display of V1 treasury #110

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pages/treasury.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { fetchWebconfig } from "../services/webconfig";
export async function getServerSideProps() {
const webconfig = fetchWebconfig();
const results = await Promise.all([
Treasuries.fetchList(),
// V1 no longer used
Treasuries.fetchList().then(list => list.filter(type => type !== 'V1')),
Blocks.fetchLast(),
]);
const names = results[0];
Expand Down
12 changes: 9 additions & 3 deletions services/treasuries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ export const Treasuries = {
? null
: new ethers.Contract(token.address, abiERC20, jsonRpc);
for (const [contractAddress, contractType] of mapAddresses.entries()) {
const tokenBalance = tokenContract
? await tokenContract.balanceOf(contractAddress)
: await jsonRpc.getBalance(contractAddress);
let tokenBalance;
// The V1 treasury no longer holds any tokens
if (contractType === TreasuryType.V1) {
tokenBalance = 0;
} else {
tokenBalance = tokenContract
? await tokenContract.balanceOf(contractAddress)
: await jsonRpc.getBalance(contractAddress);
}

const value = withDecimals(tokenBalance.toString(), token.decimals);
console.log(contractType, tokenSymbol, value);
Expand Down
Loading