Skip to content

Commit e34a2c0

Browse files
authored
Chore: update deployments - pool factories, monad, and UnbalancedAddViaSwapRouter (#786)
* new pool factories & monad * add changeset * enable pool creator for stable, stablesurge, and weighted pool creation * add UnbalancedAddViaSwapRouter contract * only add poolCreator to relevant pool type types * fix tests * remove unused vars
1 parent 05bc57f commit e34a2c0

22 files changed

+1429
-118
lines changed

.changeset/calm-files-sink.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@balancer/sdk": minor
3+
---
4+
5+
new pool factories and monad contracts

examples/createAndInitPool/createAndInitPoolV3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ const createPoolInput: CreatePoolV3StableInput = {
7676
poolHooksContract: zeroAddress,
7777
pauseManager: zeroAddress,
7878
swapFeeManager: zeroAddress,
79+
poolCreator: zeroAddress,
7980
chainId,
8081
protocolVersion: 3,
8182
enableDonation: false,

scripts/scripts.types.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { Address, Abi } from 'viem';
2+
3+
export type SupportedNetworkResponse = {
4+
name: string;
5+
chainId: number;
6+
blockExplorer: string;
7+
};
8+
9+
export type SupportedNetwork = {
10+
networkName: string;
11+
chainId: number;
12+
deploymentsUrl: string;
13+
};
14+
15+
export type NetworkRegistryResponse = {
16+
[key: string]: {
17+
contracts: { name: string; address: Address }[];
18+
status: 'ACTIVE' | 'DEPRECATED' | 'SCRIPT';
19+
version: 'v2' | 'v3';
20+
};
21+
};
22+
23+
export type AbiResponse = {
24+
abi: Abi[];
25+
};
26+
27+
// {contractName: {chainId: address}, ...}
28+
export type ContractRegistry = {
29+
[key: string]: {
30+
[key: string]: Address;
31+
};
32+
};

scripts/updateDeployments.ts

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,16 @@
1-
import { Abi, Address } from 'viem';
1+
// pnpm run update:deployments
2+
3+
import { Address } from 'viem';
24
import { writeFileSync, readFileSync } from 'node:fs';
35
import { sonic } from 'viem/chains';
46
import { ChainId, PERMIT2 } from '../src/utils/constants';
5-
6-
type SupportedNetworkResponse = {
7-
name: string;
8-
chainId: number;
9-
blockExplorer: string;
10-
};
11-
12-
type SupportedNetwork = {
13-
networkName: string;
14-
chainId: number;
15-
deploymentsUrl: string;
16-
};
17-
18-
type NetworkRegistryResponse = {
19-
[key: string]: {
20-
contracts: { name: string; address: Address }[];
21-
status: 'ACTIVE' | 'DEPRECATED' | 'SCRIPT';
22-
version: 'v2' | 'v3';
23-
};
24-
};
25-
26-
type AbiResponse = {
27-
abi: Abi[];
28-
};
29-
30-
// {contractName: {chainId: address}, ...}
31-
type ContractRegistry = {
32-
[key: string]: {
33-
[key: string]: Address;
34-
};
35-
};
7+
import {
8+
ContractRegistry,
9+
SupportedNetwork,
10+
SupportedNetworkResponse,
11+
AbiResponse,
12+
NetworkRegistryResponse,
13+
} from './scripts.types';
3614

3715
// Create a map that looks like ['1': '[ChainId.MAINNET]', '10': '[ChainId.OPTIMISM]', ...]
3816
const chainIdToHumanKey = Object.fromEntries(
@@ -46,8 +24,7 @@ const targetContractsV2 = [
4624
'BalancerRelayer',
4725
'BalancerQueries',
4826
'WeightedPoolFactory',
49-
'Authorizer', // only ABI?
50-
// 'BatchRelayer', // Named "BatchRelayerLibrary" in SDK. TODO: investigate https://github.com/balancer/balancer-deployments/tree/master/v2/tasks/20231031-batch-relayer-v6
27+
'Authorizer',
5128
];
5229

5330
// Update this list to add new contracts
@@ -70,6 +47,7 @@ const targetContractsV3 = [
7047
'LBPMigrationRouter',
7148
'MevCaptureHook',
7249
'StableSurgeHook',
50+
'UnbalancedAddViaSwapRouter',
7351
];
7452

7553
const targetContracts = [...targetContractsV2, ...targetContractsV3];
@@ -323,7 +301,15 @@ function exportAbis() {
323301
}';`,
324302
);
325303

326-
const exportAbisV3 = targetContractsV3.map(
304+
const staticHelperAbisV3 = [
305+
'weightedPool',
306+
'stablePool',
307+
'liquidityBootstrappingPool',
308+
'gyro2CLP',
309+
'gyroECLP',
310+
];
311+
312+
const exportAbisV3 = [...staticHelperAbisV3, ...targetContractsV3].map(
327313
(contract) =>
328314
`export * from './${
329315
contract[0].toLowerCase() + contract.slice(1)

src/abi/v3/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
export * from './weightedPool';
2+
export * from './stablePool';
3+
export * from './liquidityBootstrappingPool';
4+
export * from './gyro2CLP';
5+
export * from './gyroECLP';
16
export * from './vault';
27
export * from './vaultAdmin';
38
export * from './vaultExtension';
@@ -12,12 +17,8 @@ export * from './gyroECLPPoolFactory';
1217
export * from './lBPoolFactory';
1318
export * from './fixedPriceLBPoolFactory';
1419
export * from './reClammPoolFactory';
15-
export * from './weightedPool';
16-
export * from './stablePool';
17-
export * from './liquidityBootstrappingPool';
18-
export * from './gyro2CLP';
19-
export * from './gyroECLP';
2020
export * from './mockGyroEclpPool';
21+
export * from './lBPMigrationRouter';
2122
export * from './mevCaptureHook';
2223
export * from './stableSurgeHook';
23-
export * from './lBPMigrationRouter';
24+
export * from './unbalancedAddViaSwapRouter';

src/abi/v3/stablePoolFactory.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,17 @@ export const stablePoolFactoryAbi_V3 = [
3737
},
3838
{
3939
inputs: [],
40-
name: 'Create2FailedDeployment',
40+
name: 'Disabled',
41+
type: 'error',
42+
},
43+
{
44+
inputs: [],
45+
name: 'FailedDeployment',
46+
type: 'error',
47+
},
48+
{
49+
inputs: [],
50+
name: 'IndexOutOfBounds',
4151
type: 'error',
4252
},
4353
{
@@ -53,17 +63,7 @@ export const stablePoolFactoryAbi_V3 = [
5363
type: 'uint256',
5464
},
5565
],
56-
name: 'Create2InsufficientBalance',
57-
type: 'error',
58-
},
59-
{
60-
inputs: [],
61-
name: 'Disabled',
62-
type: 'error',
63-
},
64-
{
65-
inputs: [],
66-
name: 'IndexOutOfBounds',
66+
name: 'InsufficientBalance',
6767
type: 'error',
6868
},
6969
{
@@ -86,6 +86,11 @@ export const stablePoolFactoryAbi_V3 = [
8686
name: 'StandardPoolWithCreator',
8787
type: 'error',
8888
},
89+
{
90+
inputs: [],
91+
name: 'VaultNotSet',
92+
type: 'error',
93+
},
8994
{
9095
anonymous: false,
9196
inputs: [],

src/abi/v3/stableSurgePoolFactory.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export const stableSurgePoolFactoryAbi_V3 = [
22
{
33
inputs: [
44
{
5-
internalType: 'contract StableSurgeHook',
5+
internalType: 'address',
66
name: 'stableSurgeHook',
77
type: 'address',
88
},
@@ -37,7 +37,17 @@ export const stableSurgePoolFactoryAbi_V3 = [
3737
},
3838
{
3939
inputs: [],
40-
name: 'Create2FailedDeployment',
40+
name: 'Disabled',
41+
type: 'error',
42+
},
43+
{
44+
inputs: [],
45+
name: 'FailedDeployment',
46+
type: 'error',
47+
},
48+
{
49+
inputs: [],
50+
name: 'IndexOutOfBounds',
4151
type: 'error',
4252
},
4353
{
@@ -53,17 +63,7 @@ export const stableSurgePoolFactoryAbi_V3 = [
5363
type: 'uint256',
5464
},
5565
],
56-
name: 'Create2InsufficientBalance',
57-
type: 'error',
58-
},
59-
{
60-
inputs: [],
61-
name: 'Disabled',
62-
type: 'error',
63-
},
64-
{
65-
inputs: [],
66-
name: 'IndexOutOfBounds',
66+
name: 'InsufficientBalance',
6767
type: 'error',
6868
},
6969
{
@@ -452,7 +452,7 @@ export const stableSurgePoolFactoryAbi_V3 = [
452452
name: 'getStableSurgeHook',
453453
outputs: [
454454
{
455-
internalType: 'contract IStableSurgeHook',
455+
internalType: 'address',
456456
name: '',
457457
type: 'address',
458458
},

0 commit comments

Comments
 (0)