Skip to content

Commit 46df27c

Browse files
committed
Rename runAndReturn to run on VM Bridge bootstrap
1 parent fe45331 commit 46df27c

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

fvm/bootstrap.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
10751075
txIndex := uint32(0)
10761076
events := flow.EventsList{}
10771077

1078-
runAndReturn := func(tx *flow.TransactionBody, failMSG string) ProcedureOutput {
1078+
run := func(tx *flow.TransactionBody, failMSG string) ProcedureOutput {
10791079
txOutput, err := b.runMetaTransaction(ctx, Transaction(tx, txIndex))
10801080

10811081
if err != nil {
@@ -1095,7 +1095,7 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
10951095
if err != nil {
10961096
panic(fmt.Sprintf("failed to build COA contract transaction: %s", err))
10971097
}
1098-
runAndReturn(txBody, "failed to create COA in Service Account: %s")
1098+
_ = run(txBody, "failed to create COA in Service Account: %s")
10991099

11001100
// Arbitrary high gas limit that can be used for all the
11011101
// EVM transactions to ensure none of them run out of gas
@@ -1110,7 +1110,7 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
11101110
if err != nil {
11111111
panic(fmt.Sprintf("failed to build EVM contract transaction: %s", err))
11121112
}
1113-
txOutput := runAndReturn(txBody, "failed to deploy the Factory in the Service Account COA: %s")
1113+
txOutput := run(txBody, "failed to deploy the Factory in the Service Account COA: %s")
11141114

11151115
factoryAddress, err := getContractAddressFromEVMEvent(txOutput)
11161116
if err != nil {
@@ -1125,7 +1125,7 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
11251125
if err != nil {
11261126
panic(fmt.Sprintf("failed to build Solidity Registry contract to the service account's COA transaction: %s", err))
11271127
}
1128-
txOutput = runAndReturn(txBody, "failed to deploy the Registry in the Service Account COA: %s")
1128+
txOutput = run(txBody, "failed to deploy the Registry in the Service Account COA: %s")
11291129

11301130
registryAddress, err := getContractAddressFromEVMEvent(txOutput)
11311131
if err != nil {
@@ -1140,7 +1140,7 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
11401140
if err != nil {
11411141
panic(fmt.Sprintf("failed to build Solidity ERC20 Deployer contract to the service account's COA transaction: %s", err))
11421142
}
1143-
txOutput = runAndReturn(txBody, "failed to deploy the ERC20 Deployer in the Service Account COA: %s")
1143+
txOutput = run(txBody, "failed to deploy the ERC20 Deployer in the Service Account COA: %s")
11441144

11451145
erc20DeployerAddress, err := getContractAddressFromEVMEvent(txOutput)
11461146
if err != nil {
@@ -1154,7 +1154,7 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
11541154
if err != nil {
11551155
panic(fmt.Sprintf("failed to build ERC721 deployer contract to the service account's COA transaction: %s", err))
11561156
}
1157-
txOutput = runAndReturn(txBody, "failed to deploy the ERC721 Deployer in the Service Account COA: %s")
1157+
txOutput = run(txBody, "failed to deploy the ERC721 Deployer in the Service Account COA: %s")
11581158

11591159
erc721DeployerAddress, err := getContractAddressFromEVMEvent(txOutput)
11601160
if err != nil {
@@ -1174,13 +1174,13 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
11741174
if err != nil {
11751175
panic(fmt.Sprintf("failed to build FlowEVMBridgeUtils transaction: %s", err))
11761176
}
1177-
runAndReturn(txBody, "failed to deploy FlowEVMBridgeUtils contract: %s")
1177+
_ = run(txBody, "failed to deploy FlowEVMBridgeUtils contract: %s")
11781178
} else {
11791179
txBody, err := blueprints.DeployContractTransaction(serviceAddress, contract, name).Build()
11801180
if err != nil {
11811181
panic(fmt.Sprintf("failed to build "+name+" contract transaction: %s", err))
11821182
}
1183-
runAndReturn(txBody, "failed to deploy "+name+" contract: %s")
1183+
_ = run(txBody, "failed to deploy "+name+" contract: %s")
11841184
}
11851185
}
11861186

@@ -1189,49 +1189,49 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
11891189
if err != nil {
11901190
panic(fmt.Sprintf("failed to build pause the bridge contracts transaction: %s", err))
11911191
}
1192-
runAndReturn(txBody, "failed to pause the bridge contracts: %s")
1192+
_ = run(txBody, "failed to pause the bridge contracts: %s")
11931193

11941194
// Set the factory as registrar in the registry
11951195
txBody, err = blueprints.SetRegistrarTransaction(*env, bridgeEnv, serviceAddress, registryAddress)
11961196
if err != nil {
11971197
panic(fmt.Sprintf("failed to build set the factory as register transaction: %s", err))
11981198
}
1199-
runAndReturn(txBody, "failed to set the factory as registrar: %s")
1199+
_ = run(txBody, "failed to set the factory as registrar: %s")
12001200

12011201
// Add the registry to the factory
12021202
txBody, err = blueprints.SetDeploymentRegistryTransaction(*env, bridgeEnv, serviceAddress, registryAddress)
12031203
if err != nil {
12041204
panic(fmt.Sprintf("failed to build add the registry to the factory transaction: %s", err))
12051205
}
1206-
runAndReturn(txBody, "failed to add the registry to the factory: %s")
1206+
_ = run(txBody, "failed to add the registry to the factory: %s")
12071207

12081208
// Set the factory as delegated deployer in the ERC20 deployer
12091209
txBody, err = blueprints.SetDelegatedDeployerTransaction(*env, bridgeEnv, serviceAddress, erc20DeployerAddress)
12101210
if err != nil {
12111211
panic(fmt.Sprintf("failed to build set the erc20 deployer as delegated deployer transaction: %s", err))
12121212
}
1213-
runAndReturn(txBody, "failed to set the erc20 deployer as delegated deployer: %s")
1213+
_ = run(txBody, "failed to set the erc20 deployer as delegated deployer: %s")
12141214

12151215
// Set the factory as delegated deployer in the ERC721 deployer
12161216
txBody, err = blueprints.SetDelegatedDeployerTransaction(*env, bridgeEnv, serviceAddress, erc721DeployerAddress)
12171217
if err != nil {
12181218
panic(fmt.Sprintf("failed to build set the erc721 deployer as delegated deployer transaction: %s", err))
12191219
}
1220-
runAndReturn(txBody, "failed to set the erc721 deployer as delegated deployer: %s")
1220+
_ = run(txBody, "failed to set the erc721 deployer as delegated deployer: %s")
12211221

12221222
// Add the ERC20 Deployer as a deployer in the factory
12231223
txBody, err = blueprints.AddDeployerTransaction(*env, bridgeEnv, serviceAddress, "ERC20", erc20DeployerAddress)
12241224
if err != nil {
12251225
panic(fmt.Sprintf("failed to build add the erc20 deployer in the factory transaction: %s", err))
12261226
}
1227-
runAndReturn(txBody, "failed to add the erc20 deployer in the factory: %s")
1227+
_ = run(txBody, "failed to add the erc20 deployer in the factory: %s")
12281228

12291229
// Add the ERC721 Deployer as a deployer in the factory
12301230
txBody, err = blueprints.AddDeployerTransaction(*env, bridgeEnv, serviceAddress, "ERC721", erc721DeployerAddress)
12311231
if err != nil {
12321232
panic(fmt.Sprintf("failed to build add the erc721 in the factory transaction: %s", err))
12331233
}
1234-
runAndReturn(txBody, "failed to add the erc721 deployer in the factory: %s")
1234+
_ = run(txBody, "failed to add the erc721 deployer in the factory: %s")
12351235

12361236
// /* --- EVM Contract Integration --- */
12371237

@@ -1240,28 +1240,28 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
12401240
if err != nil {
12411241
panic(fmt.Sprintf("failed to build deploy FlowEVMBridgeAccessor transaction: %s", err))
12421242
}
1243-
runAndReturn(txBody, "failed to deploy FlowEVMBridgeAccessor contract: %s")
1243+
_ = run(txBody, "failed to deploy FlowEVMBridgeAccessor contract: %s")
12441244

12451245
// Integrate the EVM contract with the BridgeAccessor
12461246
txBody, err = blueprints.IntegrateEVMWithBridgeAccessorTransaction(*env, bridgeEnv, serviceAddress)
12471247
if err != nil {
12481248
panic(fmt.Sprintf("failed to build integrate the EVM contract with the BridgeAccessor transaction: %s", err))
12491249
}
1250-
runAndReturn(txBody, "failed to integrate the EVM contract with the BridgeAccessor: %s")
1250+
_ = run(txBody, "failed to integrate the EVM contract with the BridgeAccessor: %s")
12511251

12521252
// Set the bridge onboarding fees
12531253
txBody, err = blueprints.UpdateOnboardFeeTransaction(*env, bridgeEnv, serviceAddress, 1.0)
12541254
if err != nil {
12551255
panic(fmt.Sprintf("failed to build update the bridge onboarding fees transaction: %s", err))
12561256
}
1257-
runAndReturn(txBody, "failed to update the bridge onboarding fees: %s")
1257+
_ = run(txBody, "failed to update the bridge onboarding fees: %s")
12581258

12591259
// Set the bridge base fee
12601260
txBody, err = blueprints.UpdateBaseFeeTransaction(*env, bridgeEnv, serviceAddress, 0.001)
12611261
if err != nil {
12621262
panic(fmt.Sprintf("failed to build update the bridge base fees transaction: %s", err))
12631263
}
1264-
runAndReturn(txBody, "failed to update the bridge base fees: %s")
1264+
_ = run(txBody, "failed to update the bridge base fees: %s")
12651265

12661266
tokenChunks := bridge.GetCadenceTokenChunkedJSONArguments(false)
12671267
nftChunks := bridge.GetCadenceTokenChunkedJSONArguments(true)
@@ -1271,14 +1271,14 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
12711271
if err != nil {
12721272
panic(fmt.Sprintf("failed to build add the FT template code chunks transaction: %s", err))
12731273
}
1274-
runAndReturn(txBody, "failed to add the FT template code chunks: %s")
1274+
_ = run(txBody, "failed to add the FT template code chunks: %s")
12751275

12761276
// Add the NFT Template Cadence Code Chunks
12771277
txBody, err = blueprints.UpsertContractCodeChunksTransaction(*env, bridgeEnv, serviceAddress, "bridgedNFT", nftChunks)
12781278
if err != nil {
12791279
panic(fmt.Sprintf("failed to build add the NFT template code chunks transaction: %s", err))
12801280
}
1281-
runAndReturn(txBody, "failed to add the NFT template code chunks: %s")
1281+
_ = run(txBody, "failed to add the NFT template code chunks: %s")
12821282

12831283
// Retrieve the WFLOW bytecode from the JSON args
12841284
wflowBytecode, err := bridge.GetSolidityContractCode("WFLOW")
@@ -1291,7 +1291,7 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
12911291
if err != nil {
12921292
panic(fmt.Sprintf("failed to build WFLOW contract in the Service Account COA transaction: %s", err))
12931293
}
1294-
txOutput = runAndReturn(txBody, "failed to deploy the WFLOW contract in the Service Account COA: %s")
1294+
txOutput = run(txBody, "failed to deploy the WFLOW contract in the Service Account COA: %s")
12951295

12961296
wflowAddress, err := getContractAddressFromEVMEvent(txOutput)
12971297
if err != nil {
@@ -1303,7 +1303,7 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
13031303
if err != nil {
13041304
panic(fmt.Sprintf("failed to build create the WFLOW token handler transaction: %s", err))
13051305
}
1306-
runAndReturn(txBody, "failed to create the WFLOW token handler: %s")
1306+
_ = run(txBody, "failed to create the WFLOW token handler: %s")
13071307

13081308
// Enable WFLOW Token Handler, supplying the Cadence FlowToken.Vault type
13091309
flowVaultType := "A." + env.FlowTokenAddress + ".FlowToken.Vault"
@@ -1312,14 +1312,14 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
13121312
if err != nil {
13131313
panic(fmt.Sprintf("failed to build enable the WFLOW token handler transaction: %s", err))
13141314
}
1315-
runAndReturn(txBody, "failed to enable the WFLOW token handler: %s")
1315+
_ = run(txBody, "failed to enable the WFLOW token handler: %s")
13161316

13171317
// Unpause the bridge
13181318
txBody, err = blueprints.PauseBridgeTransaction(*env, bridgeEnv, serviceAddress, false)
13191319
if err != nil {
13201320
panic(fmt.Sprintf("failed to build un-pause the bridge contracts transaction: %s", err))
13211321
}
1322-
runAndReturn(txBody, "failed to un-pause the bridge contracts: %s")
1322+
_ = run(txBody, "failed to un-pause the bridge contracts: %s")
13231323

13241324
b.output.Events = events
13251325
}

0 commit comments

Comments
 (0)