Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Commit

Permalink
refine some code
Browse files Browse the repository at this point in the history
Signed-off-by: Qiang Zhou <[email protected]>
  • Loading branch information
zhouqiang-cl committed Feb 2, 2024
1 parent 92e55ee commit 10c3535
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 55 deletions.
4 changes: 2 additions & 2 deletions cairoVM/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func main() {
}
spew.Dump(trace)

invokeTx, err = cairoVM.NewDeployInvokeTest()
invokeTx, err = cairoVM.SetCoolValue("0x7f2f788bcd85c25ece505a4fe359c577be77841c5afb971648af03391e5e834", 9099)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -112,7 +112,7 @@ func main() {
}
spew.Dump(trace)

invokeTx, err = cairoVM.NewDeployInvokeTestCoolOld()
invokeTx, err = cairoVM.SetCoolValue("0x77fcc62a59a2160f099493fcd0466c526120320c164a62a72c6ac9931db34d9", 1111)
if err != nil {
panic(err)
}
Expand Down
53 changes: 0 additions & 53 deletions cairoVM/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

}

0 comments on commit 10c3535

Please sign in to comment.