MCPcopy Create free account
hub / github.com/across-protocol/relayer / deployConfigStore

Function deployConfigStore

test/utils/utils.ts:137–174  ·  view source on GitHub ↗
(
  signer: SignerWithAddress,
  tokensToAdd: Contract[],
  maxL1TokensPerPoolRebalanceLeaf: number = MAX_L1_TOKENS_PER_POOL_REBALANCE_LEAF,
  maxRefundPerRelayerRefundLeaf: number = MAX_REFUNDS_PER_RELAYER_REFUND_LEAF,
  rateModel: unknown = sampleRateModel,
  additionalChainIdIndices?: number[]
)

Source from the content-addressed store, hash-verified

135}
136
137export async function deployConfigStore(
138 signer: SignerWithAddress,
139 tokensToAdd: Contract[],
140 maxL1TokensPerPoolRebalanceLeaf: number = MAX_L1_TOKENS_PER_POOL_REBALANCE_LEAF,
141 maxRefundPerRelayerRefundLeaf: number = MAX_REFUNDS_PER_RELAYER_REFUND_LEAF,
142 rateModel: unknown = sampleRateModel,
143 additionalChainIdIndices?: number[]
144): Promise<{ configStore: AcrossConfigStore; deploymentBlock: number }> {
145 const configStore = (await (
146 await utils.getContractFactory("AcrossConfigStore", signer)
147 ).deploy()) as AcrossConfigStore;
148 const { blockNumber: deploymentBlock } = await configStore.deployTransaction.wait();
149
150 for (const token of tokensToAdd) {
151 await configStore.updateTokenConfig(
152 token.address,
153 JSON.stringify({
154 rateModel: rateModel,
155 })
156 );
157 }
158 await configStore.updateGlobalConfig(
159 utf8ToHex(GLOBAL_CONFIG_STORE_KEYS.MAX_POOL_REBALANCE_LEAF_SIZE),
160 maxL1TokensPerPoolRebalanceLeaf.toString()
161 );
162 await configStore.updateGlobalConfig(
163 utf8ToHex(GLOBAL_CONFIG_STORE_KEYS.MAX_RELAYER_REPAYMENT_LEAF_SIZE),
164 maxRefundPerRelayerRefundLeaf.toString()
165 );
166
167 if (additionalChainIdIndices) {
168 await configStore.updateGlobalConfig(
169 utf8ToHex(GLOBAL_CONFIG_STORE_KEYS.CHAIN_ID_INDICES),
170 JSON.stringify([...constants.PROTOCOL_DEFAULT_CHAIN_ID_INDICES, ...additionalChainIdIndices])
171 );
172 }
173 return { configStore, deploymentBlock };
174}
175
176export async function deployAndConfigureHubPool(
177 signer: SignerWithAddress,

Calls

no outgoing calls

Tested by

no test coverage detected