Skip to content

Commit

Permalink
feat: add ZK network
Browse files Browse the repository at this point in the history
  • Loading branch information
fedorovdg committed Aug 19, 2024
1 parent 931a581 commit cdaed0f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 38 deletions.
28 changes: 14 additions & 14 deletions src/constants/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,23 +241,23 @@ export const ALIASES_CELO = lowerCaseValues({
});

export const ALIASES_ZKSYNC = lowerCaseValues({
"crv": "0x0a7432cF27F1aE3825c313F3C81e7D3efD7639aB", // <--- TODO CHANGE
"gauge_factory": "0x0000000000000000000000000000000000000000", // <-- CHANGED
"voting_escrow": "0x0000000000000000000000000000000000000000", // <-- DUMMY
"fee_distributor": "0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc", // <-- DUMMY
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB", // <--- TODO CHANGE
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383", // <--- TODO CHANGE
"crv": "0x5945932099f124194452a4c62d34bB37f16183B2",
"gauge_factory": "0x0000000000000000000000000000000000000000",
"voting_escrow": "0x0000000000000000000000000000000000000000",
"fee_distributor": "0x0000000000000000000000000000000000000000",
"gauge_controller": "0x0000000000000000000000000000000000000000",
"address_provider": "0x0000000000000000000000000000000000000000",
"router": "0x7C915390e109CA66934f1eB285854375D1B127FA",
"deposit_and_stake": "0x0000000000000000000000000000000000000000",
"deposit_and_stake": "0x253548e98C769aD2850da8DB3E4c2b2cE46E3839",
"stable_calc": "0x0000000000000000000000000000000000000000",
"crypto_calc": '0x0000000000000000000000000000000000000000',
"factory": '0xAF5261eD780fd5b80CF6E206b6BF90CbB97F511B',
"crvusd_factory": '0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d', // <-- DUMMY
"eywa_factory": '0x37F22A0B028f2152e6CAcef210e0C4d3b875f367', // <--- DUMMY
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99', // <--- TODO CHANGE
"twocrypto_factory": '0x0000000000000000000000000000000000000000', // <--- NEW
"tricrypto_factory": '0x0c0e5f2fF0ff18a3be9b835635039256dC4B4963', // <--- TODO CHANGE
"stable_ng_factory": '0x0000000000000000000000000000000000000000', // <--- DUMMY
"factory": '0x0000000000000000000000000000000000000000',
"crvusd_factory": '0x0000000000000000000000000000000000000000',
"eywa_factory": '0x0000000000000000000000000000000000000000',
"crypto_factory": '0x0000000000000000000000000000000000000000',
"twocrypto_factory": '0xf3a546AF64aFd6BB8292746BA66DB33aFAE72114',
"tricrypto_factory": '0x5d4174C40f1246dABe49693845442927d5929f0D',
"stable_ng_factory": '0xFcAb5d04e8e031334D5e8D2C166B08daB0BE6CaE',
"factory_admin": "0x0000000000000000000000000000000000000000",
});

Expand Down
4 changes: 2 additions & 2 deletions src/constants/tricryptoDeployImplementations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const tricryptoDeployImplementations = {
implementationIdx: 1,
},
324: { // ZKSYNC
amm_native_transfers_disabled: '0x0000000000000000000000000000000000000000'.toLowerCase(),
amm_native_transfers_enabled: '0x0000000000000000000000000000000000000000'.toLowerCase(),
amm_native_transfers_disabled: '0x1BD7d40CF9bBb63537746C89992f421bC35C6716'.toLowerCase(),
amm_native_transfers_enabled: '0x18d01726FeDaBd91579A9368DFB2F8A24f905280'.toLowerCase(),
implementationIdx: 0,
},
1284: { // MOONBEAM
Expand Down
16 changes: 8 additions & 8 deletions src/curve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ class Curve implements ICurve {

this.setContract(this.constants.ALIASES.factory, factoryABI);

if (this.chainId !== 1313161554 && this.chainId !== 252 && this.chainId !== 196 && this.chainId !== 5000) {
if (this.chainId !== 1313161554 && this.chainId !== 252 && this.chainId !== 324 && this.chainId !== 196 && this.chainId !== 5000) {
const factoryContract = this.contracts[this.constants.ALIASES.factory].contract;
this.constants.ALIASES.factory_admin = (await factoryContract.admin(this.constantOptions) as string).toLowerCase();
this.setContract(this.constants.ALIASES.factory_admin, factoryAdminABI);
Expand Down Expand Up @@ -811,7 +811,7 @@ class Curve implements ICurve {
}

fetchFactoryPools = async (useApi = true): Promise<void> => {
if ([196, 252, 5000, 1313161554].includes(this.chainId)) return;
if ([196, 252, 324, 5000, 1313161554].includes(this.chainId)) return;

if (useApi) {
this.constants.FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(await getFactoryPoolsDataFromApi.call(this, "factory"));
Expand Down Expand Up @@ -867,7 +867,7 @@ class Curve implements ICurve {
}

fetchTworyptoFactoryPools = async (useApi = true): Promise<void> => {
if ([324, 1284].includes(this.chainId)) return;
if ([1284].includes(this.chainId)) return;

if (useApi) {
this.constants.TWOCRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(await getFactoryPoolsDataFromApi.call(this, "factory-twocrypto"));
Expand All @@ -881,7 +881,7 @@ class Curve implements ICurve {
}

fetchTricryptoFactoryPools = async (useApi = true): Promise<void> => {
if ([324, 1284].includes(this.chainId)) return;
if ([1284].includes(this.chainId)) return;

if (useApi) {
this.constants.TRICRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(await getFactoryPoolsDataFromApi.call(this, "factory-tricrypto"));
Expand Down Expand Up @@ -948,7 +948,7 @@ class Curve implements ICurve {
}

fetchNewTwocryptoFactoryPools = async (): Promise<string[]> => {
if ([324, 1284].includes(this.chainId)) return [];
if ([1284].includes(this.chainId)) return [];

const currentPoolIds = Object.keys(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
Expand All @@ -960,7 +960,7 @@ class Curve implements ICurve {
}

fetchNewTricryptoFactoryPools = async (): Promise<string[]> => {
if ([324, 1284].includes(this.chainId)) return [];
if ([1284].includes(this.chainId)) return [];

const currentPoolIds = Object.keys(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
Expand Down Expand Up @@ -1001,7 +1001,7 @@ class Curve implements ICurve {
}

fetchRecentlyDeployedTwocryptoFactoryPool = async (poolAddress: string): Promise<string> => {
if ([324, 1284].includes(this.chainId)) return '';
if ([1284].includes(this.chainId)) return '';
const poolData = lowerCasePoolDataAddresses(await getTwocryptoFactoryPoolData.call(this, 0, poolAddress));
this.constants.TWOCRYPTO_FACTORY_POOLS_DATA = { ...this.constants.TWOCRYPTO_FACTORY_POOLS_DATA, ...poolData };
this._updateDecimalsAndGauges(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
Expand All @@ -1010,7 +1010,7 @@ class Curve implements ICurve {
}

fetchRecentlyDeployedTricryptoFactoryPool = async (poolAddress: string): Promise<string> => {
if ([324, 1284].includes(this.chainId)) return '';
if ([1284].includes(this.chainId)) return '';
const poolData = lowerCasePoolDataAddresses(await getTricryptoFactoryPoolData.call(this, 0, poolAddress));
this.constants.TRICRYPTO_FACTORY_POOLS_DATA = { ...this.constants.TRICRYPTO_FACTORY_POOLS_DATA, ...poolData };
this._updateDecimalsAndGauges(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
Expand Down
16 changes: 2 additions & 14 deletions src/factory/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,20 +356,8 @@ export const implementationABIDictCelo: IDict<any> = lowerCaseKeys({
});

export const implementationABIDictZkSync: IDict<any> = lowerCaseKeys({
"0x7c2a205C52361410233540008f7095dEF5915843": Plain2BasicABI,
"0xEF04fC6b95b1658AfdFd527aF9b947cd7BD46bde": Plain2BalancesABI,
"0x4887ef1a68f30364a25a8b0bAA13EeeA7eeBE574": Plain2ETHABI,
"0x044f8F31078c0CB898f25fff3286cE905C18434e": Plain2OptimizedABI,

"0x2e6De7148Afc6e4B1ee766D070DDeff0C84831a5": Plain3BasicABI,
"0x5D18b28C052Bb0C1573d90Ea055b13048026d83F": Plain3BalancesABI,
"0x9707Bbf96eBB136B67788aa7E46d771Ec18895f4": Plain3ETHABI,
"0xb274f2cdCff70A0bac146e9Ca5a8a28f59a3f812": Plain3OptimizedABI,

"0x30eb3F0EF60993584e8dD231dF7539db31800555": Plain4BasicABI,
"0x3D21E268d6A526948e978ad1595052c949927e54": Plain4BalancesABI,
"0xD46aed59fBd5eB6c134b1AFb364240bb62dA0451": Plain4ETHABI,
"0xE80AeF1a4782eA7b7f9Ad9F0c2ed9343861934e3": Plain4OptimizedABI,
"0x04D0095a1A4Ae881a078ae61F36945E85464e6d7": PlainStableSwapNGABI,
"0xC5d5402481aefec461Ab86b1051AC26dF05BeE3B": MetaStableSwapNGABI,
})

export const implementationABIDictBase: IDict<any> = lowerCaseKeys({
Expand Down

0 comments on commit cdaed0f

Please sign in to comment.