Skip to content

Commit 010edc2

Browse files
committed
add setupVMBridge and first step for setup
1 parent b505c94 commit 010edc2

File tree

8 files changed

+75
-40
lines changed

8 files changed

+75
-40
lines changed

fvm/blueprints/bridge.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package blueprints
22

33
import (
44
_ "embed"
5-
"fmt"
65

76
"github.com/onflow/cadence"
87
jsoncdc "github.com/onflow/cadence/encoding/json"
@@ -16,12 +15,12 @@ import (
1615
// CreateCOATransaction returns the transaction body for the create COA transaction
1716
func CreateCOATransaction(service flow.Address, bridgeEnv bridge.Environment, env templates.Environment) *flow.TransactionBody {
1817
txScript, _ := bridge.GetCadenceTransactionCode("cadence/transactions/evm/create_account.cdc", bridgeEnv, env)
19-
fmt.Println(string(txScript))
2018
return flow.NewTransactionBody().
2119
SetScript([]byte(
2220
txScript,
2321
),
2422
).
23+
AddArgument(jsoncdc.MustEncode(cadence.UFix64(0.0))).
2524
AddAuthorizer(service)
2625
}
2726

fvm/bootstrap.go

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,20 +1018,56 @@ func (b *bootstrapExecutor) setupVMBridge(serviceAddress flow.Address, env *temp
10181018
)
10191019
panicOnMetaInvokeErrf("failed to create COA in Service Account: %s", txError, err)
10201020

1021-
gasLimit := 15000000
1022-
deploymentValue := 0.0
1021+
// gasLimit := 15000000
1022+
// deploymentValue := 0.0
10231023

1024-
// Retrieve the factory bytecode from the JSON args
1025-
factoryBytecode := bridge.GetBytecodeFromArgsJSON("cadence/args/deploy-factory-args.json")
1024+
// // Retrieve the factory bytecode from the JSON args
1025+
// factoryBytecode := bridge.GetBytecodeFromArgsJSON("cadence/args/deploy-factory-args.json")
10261026

1027-
// deploy the Solidity Factory contract to the service account's COA
1028-
tx = blueprints.DeployEVMContractTransaction(serviceAddress, factoryBytecode, gasLimit, deploymentValue, bridgeEnv, *env)
1027+
// // deploy the Solidity Factory contract to the service account's COA
1028+
// tx = blueprints.DeployEVMContractTransaction(serviceAddress, factoryBytecode, gasLimit, deploymentValue, bridgeEnv, *env)
1029+
1030+
// txError, err = b.invokeMetaTransaction(
1031+
// NewContextFromParent(b.ctx, WithEVMEnabled(true)),
1032+
// Transaction(tx, 0),
1033+
// )
1034+
// panicOnMetaInvokeErrf("failed to deploy the Factory in the Service Account COA: %s", txError, err)
1035+
1036+
// // Retrieve the factory bytecode from the JSON args
1037+
// registryBytecode := bridge.GetBytecodeFromArgsJSON("cadence/args/deploy-registry-args.json")
1038+
1039+
// // deploy the Solidity Registry contract to the service account's COA
1040+
// tx = blueprints.DeployEVMContractTransaction(serviceAddress, registryBytecode, gasLimit, deploymentValue, bridgeEnv, *env)
1041+
1042+
// txError, err = b.invokeMetaTransaction(
1043+
// NewContextFromParent(b.ctx, WithEVMEnabled(true)),
1044+
// Transaction(tx, 0),
1045+
// )
1046+
// panicOnMetaInvokeErrf("failed to deploy the Registry in the Service Account COA: %s", txError, err)
1047+
1048+
// // Retrieve the erc20Deployer bytecode from the JSON args
1049+
// erc20DeployerBytecode := bridge.GetBytecodeFromArgsJSON("cadence/args/deploy-erc20-deployer-args.json")
1050+
1051+
// // deploy the Solidity ERC20 Deployer contract to the service account's COA
1052+
// tx = blueprints.DeployEVMContractTransaction(serviceAddress, erc20DeployerBytecode, gasLimit, deploymentValue, bridgeEnv, *env)
1053+
1054+
// txError, err = b.invokeMetaTransaction(
1055+
// NewContextFromParent(b.ctx, WithEVMEnabled(true)),
1056+
// Transaction(tx, 0),
1057+
// )
1058+
// panicOnMetaInvokeErrf("failed to deploy the ERC20 Deployer in the Service Account COA: %s", txError, err)
1059+
1060+
// erc721DeployerBytecode := bridge.GetBytecodeFromArgsJSON("cadence/args/deploy-erc721-deployer-args.json")
1061+
1062+
// // deploy the Solidity Registry contract to the service account's COA
1063+
// tx = blueprints.DeployEVMContractTransaction(serviceAddress, erc721DeployerBytecode, gasLimit, deploymentValue, bridgeEnv, *env)
1064+
1065+
// txError, err = b.invokeMetaTransaction(
1066+
// NewContextFromParent(b.ctx, WithEVMEnabled(true)),
1067+
// Transaction(tx, 0),
1068+
// )
1069+
// panicOnMetaInvokeErrf("failed to deploy the ERC721 Deployer in the Service Account COA: %s", txError, err)
10291070

1030-
txError, err = b.invokeMetaTransaction(
1031-
NewContextFromParent(b.ctx, WithEVMEnabled(true)),
1032-
Transaction(tx, 0),
1033-
)
1034-
panicOnMetaInvokeErrf("failed to deploy the Factory in the Service Account COA: %s", txError, err)
10351071
}
10361072
}
10371073

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ require (
5151
github.com/onflow/cadence v1.3.1
5252
github.com/onflow/crypto v0.25.2
5353
github.com/onflow/flow v0.3.4
54-
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview
55-
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview
54+
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0
55+
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0
5656
github.com/onflow/flow-go-sdk v1.3.1
5757
github.com/onflow/flow/protobuf/go/flow v0.4.9
5858
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
@@ -108,7 +108,7 @@ require (
108108
github.com/libp2p/go-libp2p-routing-helpers v0.7.4
109109
github.com/mitchellh/mapstructure v1.5.0
110110
github.com/onflow/bridged-usdc/lib/go/contracts v1.0.0
111-
github.com/onflow/flow-evm-bridge v0.0.0-20250211192700-061a964fb304
111+
github.com/onflow/flow-evm-bridge v0.0.0-20250218172042-26b9284449c7
112112
github.com/onflow/go-ethereum v1.14.7
113113
github.com/onflow/nft-storefront/lib/go/contracts v1.0.0
114114
github.com/onflow/wal v1.0.2

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -921,12 +921,12 @@ github.com/onflow/crypto v0.25.2 h1:GjHunqVt+vPcdqhxxhAXiMIF3YiLX7gTuTR5O+VG2ns=
921921
github.com/onflow/crypto v0.25.2/go.mod h1:fY7eLqUdMKV8EGOw301unP8h7PvLVy8/6gVR++/g0BY=
922922
github.com/onflow/flow v0.3.4 h1:FXUWVdYB90f/rjNcY0Owo30gL790tiYff9Pb/sycXYE=
923923
github.com/onflow/flow v0.3.4/go.mod h1:lzyAYmbu1HfkZ9cfnL5/sjrrsnJiUU8fRL26CqLP7+c=
924-
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview h1:W+QkNQcIbhtR+zXVROKq0bdDEnvzUfUrQrCmegmwzvc=
925-
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview/go.mod h1:LyCICUK6sK1jtEyb+3GuRw5tYfHT1uxACLwLTLxw/0I=
926-
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview h1:C0PraQFfwpav4nJAf/RPE9BJyYD6lUMvt+cJyiMDeis=
927-
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64=
928-
github.com/onflow/flow-evm-bridge v0.0.0-20250211192700-061a964fb304 h1:Xs+uHo0+5Yv3TcchCNhkTbGsRkSFZJPfY62FMzxCKyo=
929-
github.com/onflow/flow-evm-bridge v0.0.0-20250211192700-061a964fb304/go.mod h1:nkSI3mdfrDuu8uIZjEbONmMbsK/LuF3fgEFTteJ9LHA=
924+
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0 h1:zbJaqR3bHicNz68YFJ/6gieUkxnMYz8dKxQrUUCc+/M=
925+
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0/go.mod h1:ufT77Epq1gfXAHQQk13WcAHWEv+Aarecn5PMnljWJ1A=
926+
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0 h1:hVlyGbZ+gkeX0mTxTC4D65HulJCUbbVFgOvVWdMfRI8=
927+
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64=
928+
github.com/onflow/flow-evm-bridge v0.0.0-20250218172042-26b9284449c7 h1:ZOfbkNg8KaoJgarpv3Jxj6mNyWHnKLaf5aZPF334ycI=
929+
github.com/onflow/flow-evm-bridge v0.0.0-20250218172042-26b9284449c7/go.mod h1:9mPDXd/YuYabK0KIx2K7/EzWP980gPBwPjFM23aS1/A=
930930
github.com/onflow/flow-ft/lib/go/contracts v1.0.1 h1:Ts5ob+CoCY2EjEd0W6vdLJ7hLL3SsEftzXG2JlmSe24=
931931
github.com/onflow/flow-ft/lib/go/contracts v1.0.1/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A=
932932
github.com/onflow/flow-ft/lib/go/templates v1.0.1 h1:FDYKAiGowABtoMNusLuRCILIZDtVqJ/5tYI4VkF5zfM=

insecure/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ require (
205205
github.com/onflow/atree v0.9.0 // indirect
206206
github.com/onflow/bridged-usdc/lib/go/contracts v1.0.0 // indirect
207207
github.com/onflow/cadence v1.3.1 // indirect
208-
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview // indirect
209-
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview // indirect
210-
github.com/onflow/flow-evm-bridge v0.0.0-20250211192700-061a964fb304 // indirect
208+
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0 // indirect
209+
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0 // indirect
210+
github.com/onflow/flow-evm-bridge v0.0.0-20250218172042-26b9284449c7 // indirect
211211
github.com/onflow/flow-ft/lib/go/contracts v1.0.1 // indirect
212212
github.com/onflow/flow-ft/lib/go/templates v1.0.1 // indirect
213213
github.com/onflow/flow-go-sdk v1.3.1 // indirect

insecure/go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,12 +867,12 @@ github.com/onflow/cadence v1.3.1 h1:bs9TFHQy8HHbwTtCtg5cLdyndWhmwq55RSwID1cb220=
867867
github.com/onflow/cadence v1.3.1/go.mod h1:6/47FljVAdl3/31tShI8JOJW0sXYZHK1PwXkE+yk0qA=
868868
github.com/onflow/crypto v0.25.2 h1:GjHunqVt+vPcdqhxxhAXiMIF3YiLX7gTuTR5O+VG2ns=
869869
github.com/onflow/crypto v0.25.2/go.mod h1:fY7eLqUdMKV8EGOw301unP8h7PvLVy8/6gVR++/g0BY=
870-
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview h1:W+QkNQcIbhtR+zXVROKq0bdDEnvzUfUrQrCmegmwzvc=
871-
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview/go.mod h1:LyCICUK6sK1jtEyb+3GuRw5tYfHT1uxACLwLTLxw/0I=
872-
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview h1:C0PraQFfwpav4nJAf/RPE9BJyYD6lUMvt+cJyiMDeis=
873-
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64=
874-
github.com/onflow/flow-evm-bridge v0.0.0-20250211192700-061a964fb304 h1:Xs+uHo0+5Yv3TcchCNhkTbGsRkSFZJPfY62FMzxCKyo=
875-
github.com/onflow/flow-evm-bridge v0.0.0-20250211192700-061a964fb304/go.mod h1:nkSI3mdfrDuu8uIZjEbONmMbsK/LuF3fgEFTteJ9LHA=
870+
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0 h1:zbJaqR3bHicNz68YFJ/6gieUkxnMYz8dKxQrUUCc+/M=
871+
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0/go.mod h1:ufT77Epq1gfXAHQQk13WcAHWEv+Aarecn5PMnljWJ1A=
872+
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0 h1:hVlyGbZ+gkeX0mTxTC4D65HulJCUbbVFgOvVWdMfRI8=
873+
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64=
874+
github.com/onflow/flow-evm-bridge v0.0.0-20250218172042-26b9284449c7 h1:ZOfbkNg8KaoJgarpv3Jxj6mNyWHnKLaf5aZPF334ycI=
875+
github.com/onflow/flow-evm-bridge v0.0.0-20250218172042-26b9284449c7/go.mod h1:9mPDXd/YuYabK0KIx2K7/EzWP980gPBwPjFM23aS1/A=
876876
github.com/onflow/flow-ft/lib/go/contracts v1.0.1 h1:Ts5ob+CoCY2EjEd0W6vdLJ7hLL3SsEftzXG2JlmSe24=
877877
github.com/onflow/flow-ft/lib/go/contracts v1.0.1/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A=
878878
github.com/onflow/flow-ft/lib/go/templates v1.0.1 h1:FDYKAiGowABtoMNusLuRCILIZDtVqJ/5tYI4VkF5zfM=

integration/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ require (
2222
github.com/libp2p/go-libp2p v0.38.2
2323
github.com/onflow/cadence v1.3.1
2424
github.com/onflow/crypto v0.25.2
25-
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview
26-
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview
25+
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0
26+
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0
2727
github.com/onflow/flow-go v0.38.0-preview.0.0.20241021221952-af9cd6e99de1
2828
github.com/onflow/flow-go-sdk v1.3.1
2929
github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000
@@ -245,7 +245,7 @@ require (
245245
github.com/olekukonko/tablewriter v0.0.5 // indirect
246246
github.com/onflow/atree v0.9.0 // indirect
247247
github.com/onflow/bridged-usdc/lib/go/contracts v1.0.0 // indirect
248-
github.com/onflow/flow-evm-bridge v0.0.0-20250211192700-061a964fb304 // indirect
248+
github.com/onflow/flow-evm-bridge v0.0.0-20250218172042-26b9284449c7 // indirect
249249
github.com/onflow/flow-ft/lib/go/contracts v1.0.1 // indirect
250250
github.com/onflow/flow-ft/lib/go/templates v1.0.1 // indirect
251251
github.com/onflow/flow-nft/lib/go/contracts v1.2.3 // indirect

integration/go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -740,12 +740,12 @@ github.com/onflow/cadence v1.3.1 h1:bs9TFHQy8HHbwTtCtg5cLdyndWhmwq55RSwID1cb220=
740740
github.com/onflow/cadence v1.3.1/go.mod h1:6/47FljVAdl3/31tShI8JOJW0sXYZHK1PwXkE+yk0qA=
741741
github.com/onflow/crypto v0.25.2 h1:GjHunqVt+vPcdqhxxhAXiMIF3YiLX7gTuTR5O+VG2ns=
742742
github.com/onflow/crypto v0.25.2/go.mod h1:fY7eLqUdMKV8EGOw301unP8h7PvLVy8/6gVR++/g0BY=
743-
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview h1:W+QkNQcIbhtR+zXVROKq0bdDEnvzUfUrQrCmegmwzvc=
744-
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.1-preview/go.mod h1:LyCICUK6sK1jtEyb+3GuRw5tYfHT1uxACLwLTLxw/0I=
745-
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview h1:C0PraQFfwpav4nJAf/RPE9BJyYD6lUMvt+cJyiMDeis=
746-
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.1-preview/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64=
747-
github.com/onflow/flow-evm-bridge v0.0.0-20250211192700-061a964fb304 h1:Xs+uHo0+5Yv3TcchCNhkTbGsRkSFZJPfY62FMzxCKyo=
748-
github.com/onflow/flow-evm-bridge v0.0.0-20250211192700-061a964fb304/go.mod h1:nkSI3mdfrDuu8uIZjEbONmMbsK/LuF3fgEFTteJ9LHA=
743+
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0 h1:zbJaqR3bHicNz68YFJ/6gieUkxnMYz8dKxQrUUCc+/M=
744+
github.com/onflow/flow-core-contracts/lib/go/contracts v1.6.0/go.mod h1:ufT77Epq1gfXAHQQk13WcAHWEv+Aarecn5PMnljWJ1A=
745+
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0 h1:hVlyGbZ+gkeX0mTxTC4D65HulJCUbbVFgOvVWdMfRI8=
746+
github.com/onflow/flow-core-contracts/lib/go/templates v1.6.0/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64=
747+
github.com/onflow/flow-evm-bridge v0.0.0-20250218172042-26b9284449c7 h1:ZOfbkNg8KaoJgarpv3Jxj6mNyWHnKLaf5aZPF334ycI=
748+
github.com/onflow/flow-evm-bridge v0.0.0-20250218172042-26b9284449c7/go.mod h1:9mPDXd/YuYabK0KIx2K7/EzWP980gPBwPjFM23aS1/A=
749749
github.com/onflow/flow-ft/lib/go/contracts v1.0.1 h1:Ts5ob+CoCY2EjEd0W6vdLJ7hLL3SsEftzXG2JlmSe24=
750750
github.com/onflow/flow-ft/lib/go/contracts v1.0.1/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A=
751751
github.com/onflow/flow-ft/lib/go/templates v1.0.1 h1:FDYKAiGowABtoMNusLuRCILIZDtVqJ/5tYI4VkF5zfM=

0 commit comments

Comments
 (0)