From 10c3535b888009887be497298db9c53ad70601d8 Mon Sep 17 00:00:00 2001 From: Qiang Zhou Date: Fri, 2 Feb 2024 12:36:37 +0800 Subject: [PATCH] refine some code Signed-off-by: Qiang Zhou --- cairoVM/cmd/main.go | 4 ++-- cairoVM/deploy.go | 53 --------------------------------------------- 2 files changed, 2 insertions(+), 55 deletions(-) diff --git a/cairoVM/cmd/main.go b/cairoVM/cmd/main.go index 78ac5ed..ab85a76 100644 --- a/cairoVM/cmd/main.go +++ b/cairoVM/cmd/main.go @@ -78,7 +78,7 @@ func main() { } spew.Dump(trace) - invokeTx, err = cairoVM.NewDeployInvokeTest() + invokeTx, err = cairoVM.SetCoolValue("0x7f2f788bcd85c25ece505a4fe359c577be77841c5afb971648af03391e5e834", 9099) if err != nil { panic(err) } @@ -112,7 +112,7 @@ func main() { } spew.Dump(trace) - invokeTx, err = cairoVM.NewDeployInvokeTestCoolOld() + invokeTx, err = cairoVM.SetCoolValue("0x77fcc62a59a2160f099493fcd0466c526120320c164a62a72c6ac9931db34d9", 1111) if err != nil { panic(err) } diff --git a/cairoVM/deploy.go b/cairoVM/deploy.go index bdfe5ff..9a15911 100644 --- a/cairoVM/deploy.go +++ b/cairoVM/deploy.go @@ -57,33 +57,6 @@ func NewDeployCool() (*core.InvokeTransaction, error) { } -func NewDeployInvokeTest() (*core.InvokeTransaction, error) { - contractAddress, _ := new(felt.Felt).SetString("0x7f2f788bcd85c25ece505a4fe359c577be77841c5afb971648af03391e5e834") - - params := new(felt.Felt).SetUint64(9099) - // Building the functionCall struct, where : - FnCall := rpc.FunctionCall{ - ContractAddress: contractAddress, //contractAddress is the contract that we want to call - EntryPointSelector: utils.GetSelectorFromNameFelt(contractMethod), //this is the function that we want to call - Calldata: []*felt.Felt{params}, //this is the data that we want to pass to the function - } - - txCallData := account.FmtCallDataCairo2([]rpc.FunctionCall{FnCall}) - - fmt.Println("invoke calldata = ", txCallData) - - tx := core.InvokeTransaction{ - Version: new(core.TransactionVersion).SetUint64(1), - ContractAddress: contractAddress, - EntryPointSelector: utils.GetSelectorFromNameFelt(contractMethod), - CallData: txCallData, - // CallData: []*felt.Felt{randata}, - } - - return &tx, nil - -} - func NewDeployCoolOld() (*core.InvokeTransaction, error) { contractAddress := new(felt.Felt).SetUint64(1) @@ -119,29 +92,3 @@ func NewDeployCoolOld() (*core.InvokeTransaction, error) { return &tx, nil } - -func NewDeployInvokeTestCoolOld() (*core.InvokeTransaction, error) { - contractAddress, _ := new(felt.Felt).SetString("0x77fcc62a59a2160f099493fcd0466c526120320c164a62a72c6ac9931db34d9") - - params := new(felt.Felt).SetUint64(1111) - // Building the functionCall struct, where : - FnCall := rpc.FunctionCall{ - ContractAddress: contractAddress, //contractAddress is the contract that we want to call - EntryPointSelector: utils.GetSelectorFromNameFelt(contractMethod), //this is the function that we want to call - Calldata: []*felt.Felt{params}, //this is the data that we want to pass to the function - } - - txCallData := account.FmtCallDataCairo2([]rpc.FunctionCall{FnCall}) - - fmt.Println("invoke calldata = ", txCallData) - - tx := core.InvokeTransaction{ - Version: new(core.TransactionVersion).SetUint64(1), - ContractAddress: contractAddress, - EntryPointSelector: utils.GetSelectorFromNameFelt(contractMethod), - CallData: txCallData, - } - - return &tx, nil - -}