Skip to content

Commit

Permalink
chore: refactor to support base sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
njokuScript committed Feb 5, 2024
1 parent 260ff31 commit 50b7290
Show file tree
Hide file tree
Showing 26 changed files with 27,669 additions and 19,755 deletions.
3,811 changes: 1,840 additions & 1,971 deletions src/contracts/abis/Currency.json

Large diffs are not rendered by default.

2,552 changes: 1,034 additions & 1,518 deletions src/contracts/abis/Feed.json

Large diffs are not rendered by default.

1,068 changes: 1,068 additions & 0 deletions src/contracts/abis/Rate.json

Large diffs are not rendered by default.

17,800 changes: 8,661 additions & 9,139 deletions src/contracts/abis/Vault.json

Large diffs are not rendered by default.

7,450 changes: 3,956 additions & 3,494 deletions src/contracts/abis/VaultGetters.json

Large diffs are not rendered by default.

11,411 changes: 9,363 additions & 2,048 deletions src/contracts/abis/VaultRouter.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/contracts/abis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export default {
VaultRouterAbi: require('./VaultRouter.json'),
VaultGetterAbi: require('./VaultGetter.json'),
VaultAbi: require('./Vault.json'),
RateAbi: require('./Rate.json'),
};
47 changes: 36 additions & 11 deletions src/contracts/getContractAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,57 @@ import { ContractName, SupportedNetwork } from './types';

const addresses: Record<ContractName, Partial<Record<SupportedNetwork | string, string>>> = {
Vault: {
[SupportedNetwork.GOERLI]: '0xE2386C5eF4deC9d5815C60168e36c7153ba00D0C',
[SupportedNetwork.BASE_GOERLI]: '0xE2386C5eF4deC9d5815C60168e36c7153ba00D0C',
[SupportedNetwork.BASE_SEPOLIA]: '0x18196CCaA8C2844c82B40a8bDCa27349C7466280',
},
MultiStaticcall: {
[SupportedNetwork.GOERLI]: '0x5226c32C94acdd44743FC5c376582d6782FA7592',
[SupportedNetwork.BASE_GOERLI]: '0x5226c32C94acdd44743FC5c376582d6782FA7592',
[SupportedNetwork.BASE_SEPOLIA]: '0x53D0ec27F7221535e72C11BA85BA1a1De34298c5',
},
VaultGetters: {
[SupportedNetwork.GOERLI]: '0x63642E2E49922DA2095cFDB0781cFf01a0d69786',
[SupportedNetwork.BASE_GOERLI]: '0x63642E2E49922DA2095cFDB0781cFf01a0d69786',
[SupportedNetwork.BASE_SEPOLIA]: '0x50fC21F951Bc42421815e104d21C5f094da9e70C',
},
VaultRouter: {
[SupportedNetwork.GOERLI]: '0x7FCF3897429Af4e5f3A397330AD638D819e53328',
[SupportedNetwork.BASE_GOERLI]: '0x7FCF3897429Af4e5f3A397330AD638D819e53328',
[SupportedNetwork.BASE_SEPOLIA]: '0x7F46a4944F9C3ecF4Ea622364132b3fE9aBa1015',
},
Currency: {
[SupportedNetwork.GOERLI]: '0xee2bDAE7896910c49BeA25106B9f8e9f4B671c82',
[SupportedNetwork.BASE_GOERLI]: '0xee2bDAE7896910c49BeA25106B9f8e9f4B671c82',
[SupportedNetwork.BASE_SEPOLIA]: '0x5d0583Ef20884C0b175046d515Ec227200C12C89',
},
Feed: {
[SupportedNetwork.GOERLI]: '0x970066EE55DF2134D1b52451afb49034AE5Fa29a',
[SupportedNetwork.BASE_GOERLI]: '0x970066EE55DF2134D1b52451afb49034AE5Fa29a',
[SupportedNetwork.BASE_SEPOLIA]: '0x94D80B2EA3cda86bF350DD7860e1171701F284c8',
},
USDC: {
[SupportedNetwork.GOERLI]: '0xF175520C52418dfE19C8098071a252da48Cd1C19',
[SupportedNetwork.BASE_GOERLI]: '0xF175520C52418dfE19C8098071a252da48Cd1C19',
[SupportedNetwork.BASE_SEPOLIA]: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
},
Rate: {
[SupportedNetwork.BASE_SEPOLIA]: '0x774843f6Baa4AAE62F026a8aF3c1C6FF3e55Ca39',
},
};

export const getContractAddress = (contractName: ContractName) => {
export const getContractAddress = (
contractName: ContractName,
network: SupportedNetwork | string,
) => {
try {
return addresses[contractName];
} catch {
throw new Error(`No address for contract ${contractName}`);
const contractAddresses = addresses[contractName];

if (!contractAddresses) {
throw new Error(`No addresses defined for contract ${contractName}`);
}

const address = contractAddresses[network];

if (!address) {
throw new Error(`No address defined for network ${network} for contract ${contractName}`);
}

return address;
} catch (error) {
throw new Error(`Error getting contract address: ${error.message}`);
}
};
6 changes: 4 additions & 2 deletions src/contracts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ export type ContractName =
| 'MultiStaticcall'
| 'VaultGetters'
| 'VaultRouter'
| 'Feed';
| 'Feed'
| 'Rate';

export enum SupportedNetwork {
GOERLI = '84531',
BASE_GOERLI = '84531',
BASE_SEPOLIA = '84532',
}
Loading

0 comments on commit 50b7290

Please sign in to comment.