Skip to content

Commit

Permalink
Merge remote-tracking branch 'yearn/main' into main-updated
Browse files Browse the repository at this point in the history
Resolved Conflicts:
	src/common.ts
	src/interfaces/vault.ts
	src/yearn.ts
  • Loading branch information
kernelwhisperer committed Dec 16, 2022
2 parents 55fd197 + 546e583 commit 764b59f
Show file tree
Hide file tree
Showing 24 changed files with 3,502 additions and 683 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: size
on:
- pull_request
# on:
# - pull_request
jobs:
size:
runs-on: ubuntu-latest
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yfi/sdk",
"version": "3.0.0-alpha.5",
"version": "3.0.0-alpha.11",
"description": "Interaction framework for the yearn protocol",
"author": "nymmrx <[email protected]>",
"license": "MIT",
Expand All @@ -18,7 +18,7 @@
"test:coverage": "tsdx test --coverage",
"lint": "run-p lint:*",
"lint:eslint": "eslint src",
"lint:typescript": "tsc --noEmit",
"lint:typescript": "tsc --noEmit --skipLibCheck",
"docs": "typedoc --out docs src/index.ts",
"size": "size-limit",
"analyze": "size-limit --why",
Expand Down Expand Up @@ -62,6 +62,7 @@
"typescript": "^4.6.3"
},
"dependencies": {
"@cowprotocol/cow-sdk": "1.0.0-RC.5",
"bignumber.js": "9.0.1",
"cross-fetch": "3.1.5",
"dotenv": "10.0.0",
Expand Down
12 changes: 8 additions & 4 deletions src/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ export const NETWORK_SETTINGS: NetworkSettings = {
decimals: 18,
address: NATIVE_TOKEN_ADDRESS,
},
simulationsEnabled: false,
zapsEnabled: false,
wrappedTokenAddress: "0x4200000000000000000000000000000000000006",
simulationsEnabled: true,
zapsEnabled: true,
zapOutTokenSymbols: ["ETH", "DAI", "USDC", "USDT", "WBTC"],
blockExplorerUrl: "https://optimistic.etherscan.io",
},
250: {
Expand Down Expand Up @@ -134,8 +136,10 @@ export const NETWORK_SETTINGS: NetworkSettings = {
decimals: 18,
address: NATIVE_TOKEN_ADDRESS,
},
simulationsEnabled: false,
zapsEnabled: false,
wrappedTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
simulationsEnabled: true,
zapsEnabled: true,
zapOutTokenSymbols: ["ETH", "DAI", "USDC", "USDT", "WBTC"],
blockExplorerUrl: "https://arbiscan.io",
},
};
5 changes: 4 additions & 1 deletion src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ export enum ContractAddressId {
portalsZapOut = "PORTALS_ZAP_OUT",
pickleZapIn = "PICKLE_ZAP_IN",
widoZapRouter = "WIDO_ZAP_ROUTER",
yearnZapEth = "YEARN_ZAP_ETH",
propertiesAggregator = "PROPERTIES_AGGREGATOR",
gaugeRegistry = "GAUGE_REGISTRY",
cowProtocolRelayer = "COW_PROTOCOL_RELAYER",
veYfiRegistry = "VEYFI_REGISTRY",
veYfi = "VEYFI",
claimRewardsZap = "CLAIM_REWARDS_ZAP",
unused = "UNUSED",
}
Expand Down
7 changes: 6 additions & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export interface ReadWriteProvider {
*/
export interface SimulationConfiguration extends TelegramConfiguration {
dashboardUrl?: string;
apiUrl: string;
apiKey?: string;
}

/**
Expand Down Expand Up @@ -82,7 +84,10 @@ const DefaultContext: ContextValue = {
// see https://docs.zapper.fi/zapper-api/endpoints
zapper: "96e0cc51-a62e-42ca-acee-910ea7d2a241",
// The default tenderly dashboard for Yearn
simulation: { dashboardUrl: "https://dashboard.tenderly.co/yearn/yearn-web" },
simulation: {
dashboardUrl: "https://dashboard.tenderly.co/yearn/yearn-web",
apiUrl: "https://simulate.yearn.network",
},
cache: { useCache: true, url: "https://cache.yearn.finance" },
zaps: {
zapInWith: ["widoZapIn", "portalsZapIn"],
Expand Down
5 changes: 5 additions & 0 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ import { toBN } from "./utils";
export const ZeroAddress = "0x0000000000000000000000000000000000000000";
export const EthAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
export const WethAddress = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
export const YvWethAddress = "0xa258C4606Ca8206D8aA700cE2143D7db854D168c";
export const NativeTokenAddress = ZeroAddress;

// Returns truthy if address is defined as a native token address of a network
export function isNativeToken(address: Address): boolean {
return [EthAddress, NativeTokenAddress].includes(address);
}

export function isWethVault(address: Address): boolean {
return address === YvWethAddress;
}

// Returns wrapper token address if it exists and its the native token address of a network
export function getWrapperIfNative(address: Address, chainId: ChainId): Address {
const networkSettings = NETWORK_SETTINGS[chainId];
Expand Down
10 changes: 5 additions & 5 deletions src/interfaces/gauge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const GaugeAbi = [
"function getReward() external returns (bool)",
];

const GaugeRegistryAbi = [
const VeYfiRegistryAbi = [
"function getVaults() public view returns (address[] memory)",
"function gauges(address _addr) public view returns (address)",
];
Expand Down Expand Up @@ -567,11 +567,11 @@ export class GaugeInterface<T extends ChainId> extends ServiceInterface<T> {
}

private async getSupportedAddresses({ addresses }: { addresses?: Address[] }): Promise<Address[]> {
const gaugeRegistryAddress = await this.yearn.addressProvider.addressById(ContractAddressId.gaugeRegistry);
const gaugeRegistryContract = new Contract(gaugeRegistryAddress, GaugeRegistryAbi, this.ctx.provider.read);
const vaultAddresses: Address[] = await gaugeRegistryContract.getVaults();
const veYfiRegistryAddress = await this.yearn.addressProvider.addressById(ContractAddressId.veYfiRegistry);
const veYfiRegistryContract = new Contract(veYfiRegistryAddress, VeYfiRegistryAbi, this.ctx.provider.read);
const vaultAddresses: Address[] = await veYfiRegistryContract.getVaults();
const gaugesAddressesPromises = vaultAddresses.map(async (address) => {
const gaugeAddress: Address = await gaugeRegistryContract.gauges(address);
const gaugeAddress: Address = await veYfiRegistryContract.gauges(address);
return gaugeAddress;
});
const gaugeAddresses = await Promise.all(gaugesAddressesPromises);
Expand Down
Loading

0 comments on commit 764b59f

Please sign in to comment.