Skip to content

Commit

Permalink
feat: support multiple stakers
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio-altr committed Nov 12, 2024
1 parent 5ea3027 commit 42152da
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion scripts/createTokenBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export const createERC20Bridge = async (
networkFeeReceiver: config.networkFeeReceiver,
infrastructureFeeCollector: config.infrastructureFeeCollector,
batchPoster: config.batchPoster,
staker: config.staker,
stakers: config.stakers,
chainOwner: config.chainOwner,
chainName: config.chainName,
chainId: config.chainId,
Expand Down
2 changes: 1 addition & 1 deletion scripts/l3ConfigType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface L3Config {
infrastructureFeeCollector: string
l1PricingRewardRecipient: string
batchPoster: string
staker: string
stakers: string[]
chainId: number
chainName: string
parentChainId: number
Expand Down
4 changes: 2 additions & 2 deletions scripts/runTimeState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export interface RuntimeState {

interface EtherSent {
batchPoster: boolean
staker: boolean
stakers: boolean[]
}

export const defaultRunTimeState: RuntimeState = {
chainId: 0,
etherSent: {
batchPoster: false,
staker: false,
stakers: [false,false,false,false,false,false,false,false,false,false],
},
nativeTokenDeposit: false,
tokenBridgeDeployed: false,
Expand Down
30 changes: 16 additions & 14 deletions scripts/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,22 @@ async function main() {
rs.etherSent.batchPoster = true
}

if (!rs.etherSent.staker) {
console.log(
`Funding staker accounts on parent chain with ${INITIAL_FUND_AMOUNT_STAKER} ETH`
)
const tx2 = await signer.sendTransaction({
to: config.staker,
value: ethers.utils.parseEther(INITIAL_FUND_AMOUNT_STAKER),
})
console.log(`Transaction hash on parent chain: ${tx2.hash}`)
const receipt2 = await tx2.wait()
console.log(
`Transaction was mined in block ${receipt2.blockNumber} on parent chain`
)
rs.etherSent.staker = true
for (let index = 0; index < config.stakers.length; index++) {
if (!rs.etherSent.stakers[index]) {
console.log(
`Funding staker account ${config.stakers[index]} on parent chain with ${INITIAL_FUND_AMOUNT_STAKER} ETH`
)
const tx2 = await signer.sendTransaction({
to: config.stakers[index],
value: ethers.utils.parseEther(INITIAL_FUND_AMOUNT_STAKER),
})
console.log(`Transaction hash on parent chain: ${tx2.hash}`)
const receipt2 = await tx2.wait()
console.log(
`Transaction was mined in block ${receipt2.blockNumber} on parent chain`
)
rs.etherSent.stakers[index] = true
}
}

if (!rs.nativeTokenDeposit) {
Expand Down

0 comments on commit 42152da

Please sign in to comment.