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

Commit

Permalink
increase_value
Browse files Browse the repository at this point in the history
  • Loading branch information
Lawliet-Chan committed Jan 31, 2024
1 parent 09591ea commit 2cfe304
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions cairoVM/cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

import (
"fmt"
"testbot/cairoVM"

"github.com/NethermindEth/juno/core/felt"
"github.com/davecgh/go-spew/spew"
// "github.com/NethermindEth/juno/core"
)

Expand All @@ -19,7 +19,8 @@ func main() {
if err != nil {
panic(err)
}
spew.Dump(trace)
// spew.Dump(trace)
fmt.Println("trace type ", trace.Type)

// declare TX
declareTx, class, err := cairoVM.NewDeclare(
Expand All @@ -34,7 +35,7 @@ func main() {
if err != nil {
panic(err)
}
spew.Dump(trace)
// spew.Dump(trace)

invokeTx, err := cairoVM.NewInvoke()
if err != nil {
Expand All @@ -45,6 +46,6 @@ func main() {
if err != nil {
panic(err)
}
spew.Dump(trace)
// spew.Dump(trace)

}
8 changes: 4 additions & 4 deletions cairoVM/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var (
contractMethod string = "set_value"
contractMethod string = "increase_value"
)

func NewInvoke() (*core.InvokeTransaction, error) {
Expand All @@ -22,15 +22,15 @@ func NewInvoke() (*core.InvokeTransaction, error) {
// Converting the contractAddress from hex to felt
contractAddress := new(felt.Felt).SetUint64(2)

randata := new(felt.Felt).SetUint64(111)
// randata := new(felt.Felt).SetUint64(111)
// 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{randata}, //this is the data that we want to pass to the function
//Calldata: []*felt.Felt{randata}, //this is the data that we want to pass to the function
}

txCallData := account.FmtCalldataCairo2([]rpc.FunctionCall{FnCall})
txCallData := account.FmtCalldataCairo0([]rpc.FunctionCall{FnCall})

fmt.Println("invoke calldata = ", txCallData)

Expand Down

0 comments on commit 2cfe304

Please sign in to comment.