Skip to content

Commit

Permalink
chore: add mainnet deployment addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
nymmrx committed May 18, 2021
1 parent bc345c3 commit b1ebb0a
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 103 deletions.
9 changes: 9 additions & 0 deletions examples/common.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const YearnGovernance = "0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52";
export const Addresses = !process.env.WEB3_PROVIDER && {
adapters: {
registryV2: "0xFbD588c72B438faD4Cf7cD879c8F730Faa213Da0",
ironBank: "0xed00238F9A0F7b4d93842033cdF56cCB32C781c2"
},
helper: "0x420b1099B9eF5baba6D92029594eF45E19A04A4A",
oracle: "0xE7eD6747FaC5360f88a2EFC03E00d25789F69291"
};
40 changes: 40 additions & 0 deletions examples/ironbank.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import Table from "cli-table3";

import { JsonRpcProvider } from "@ethersproject/providers";
import { YearnGovernance, Addresses } from "./common.mjs";

import { Yearn } from "../dist/index.js";

const url = process.env.WEB3_PROVIDER || "http://localhost:8545";
const provider = new JsonRpcProvider(url);

const yearn = new Yearn(1, {
provider,
addresses: Addresses
});

async function main() {
const ironBank = await yearn.ironBank.get();

const ironBankTable = new Table();
ironBankTable.push(...ironBank.map(market => [market.name, market.address, market.typeId]));

console.log("IronBank markets:");
console.log(ironBankTable.toString());

const ironBankGeneralPositionTable = new Table();
const ironBankGeneralPosition = await yearn.ironBank.generalPositionOf(YearnGovernance);

ironBankGeneralPositionTable.push(...Object.entries(ironBankGeneralPosition));
console.log("Yearn Multisig general IronBank position:");
console.log(ironBankGeneralPositionTable.toString());

const ironBankUserMetadataTable = new Table();
const ironBankUserMetadata = await yearn.ironBank.userMetadata(YearnGovernance);

ironBankUserMetadataTable.push(...ironBankUserMetadata.map(market => Object.values(market)));
console.log("Yearn Multisig IronBank user metadata:");
console.log(ironBankUserMetadataTable.toString());
}

main();
95 changes: 0 additions & 95 deletions examples/mvp.js

This file was deleted.

31 changes: 31 additions & 0 deletions examples/token.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Table from "cli-table3";

import { JsonRpcProvider } from "@ethersproject/providers";
import { YearnGovernance, Addresses } from "./common.mjs";

import { Yearn } from "../dist/index.js";

const url = process.env.WEB3_PROVIDER || "http://localhost:8545";
const provider = new JsonRpcProvider(url);

const yearn = new Yearn(1, {
provider,
addresses: Addresses
});

async function main() {
// Get all tokens supported by zapper
const supported = await yearn.tokens.supported();
console.log("Zapper supported tokens:", supported.length);

// Get token balances for common coins in ETH mainnet
const balances = await yearn.tokens.balances(YearnGovernance);

const balancesTable = new Table();
balancesTable.push(...balances.map(balance => [balance.token.name, balance.balance, balance.balanceUsdc]));

console.log("Yearn Multisig token balances:");
console.log(balancesTable.toString());
}

main();
39 changes: 39 additions & 0 deletions examples/vault.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Table from "cli-table3";

import { JsonRpcProvider } from "@ethersproject/providers";
import { YearnGovernance, Addresses } from "./common.mjs";

import { Yearn } from "../dist/index.js";

const url = process.env.WEB3_PROVIDER || "http://localhost:8545";
const provider = new JsonRpcProvider(url);

const yearn = new Yearn(1, {
provider,
addresses: Addresses
});

async function main() {
const vaults = await yearn.vaults.get();

const vaultsTable = new Table();
vaultsTable.push(...vaults.map(vault => [vault.name, vault.address, vault.typeId]));

console.log("V1 & V2 vaults:");
console.log(vaultsTable.toString());

const positions = await yearn.vaults.positionsOf(YearnGovernance);

const positionsTable = new Table();
positionsTable.push(
...positions.map(position => {
const vault = vaults.find(vault => (vault.address = position.assetAddress));
return [vault.name, position.balance];
})
);

console.log("Yearn Multisig vault positions:");
console.log(positionsTable.toString());
}

main();
4 changes: 2 additions & 2 deletions src/services/adapters/ironbank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export class IronBankAdapter<T extends ChainId> extends ContractService {
switch (chainId) {
case 1:
case 1337:
return "0x21670dDB429B6D80B5bE4e65532576bB14b7cC62";
return "0xFF0bd2d0C7E9424ccB149ED3757155eEf41a793D";
case 250: // FIXME: doesn't actually exist
return "0x21670dDB429B6D80B5bE4e65532576bB14b7cC62";
return "0xFF0bd2d0C7E9424ccB149ED3757155eEf41a793D";
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/services/adapters/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export class RegistryV2Adapter<T extends ChainId> extends ContractService implem
switch (chainId) {
case 1:
case 1337:
return "0xE75E51566C5761896528B4698a88C92A54B3C954";
return "0x240315db938d44bb124ae619f5fd0269a02d1271";
case 250: // FIXME: doesn't actually exist
return "0xE75E51566C5761896528B4698a88C92A54B3C954";
return "0x240315db938d44bb124ae619f5fd0269a02d1271";
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/services/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export class HelperService<T extends ChainId> extends ContractService {

static addressByChain(chainId: ChainId): string {
switch (chainId) {
case 1: // FIXME: doesn't actually exist
case 250: // ditto
case 1337: // ditto
return "0x420b1099B9eF5baba6D92029594eF45E19A04A4A";
case 1:
case 1337:
case 250: // FIXME: doesn't actually exist
return "0x5AACD0D03096039aC4381CD814637e9FB7C34a6f";
}
}

Expand Down

0 comments on commit b1ebb0a

Please sign in to comment.