diff --git a/cairoVM/cmd/main.go b/cairoVM/cmd/main.go index bcafabb..3809308 100644 --- a/cairoVM/cmd/main.go +++ b/cairoVM/cmd/main.go @@ -27,8 +27,8 @@ func main() { // declare TX declareTx, class, err := cairoVM.NewDeclare( - "data/erc20.sierra.json", - "data/erc20.casm.json", + "data/cool.sierra.json", + "data/cool.casm.json", ) if err != nil { panic(err) @@ -68,7 +68,7 @@ func main() { fmt.Println("call response", utils.FeltToBigInt(resp[0])) // deployContract TX - deployTx, err := cairoVM.NewDeployERC20() + deployTx, err := cairoVM.NewDeployCool() if err != nil { panic(err) } @@ -102,4 +102,38 @@ func main() { } fmt.Println("call response", utils.FeltToBigInt(resp[0])) + deployTx, err = cairoVM.NewDeployCoolOld() + if err != nil { + panic(err) + } + + trace, err = vm.HandleInvokeTx(deployTx) // Assuming there is a HandleInvokeTx function + if err != nil { + panic(err) + } + spew.Dump(trace) + + invokeTx, err = cairoVM.NewDeployInvokeTestCoolOld() + if err != nil { + panic(err) + } + + trace, err = vm.HandleInvokeTx(invokeTx) // Assuming there is a HandleInvokeTx function + if err != nil { + panic(err) + } + + new_address, _ = new(felt.Felt).SetString("0x77fcc62a59a2160f099493fcd0466c526120320c164a62a72c6ac9931db34d9") + + resp, err = vm.HandleCall(&rpc.FunctionCall{ + ContractAddress: *new_address, + EntryPointSelector: *utils.GetSelectorFromNameFelt("get_value"), + }, + callClassHash, + ) + if err != nil { + panic(err) + } + fmt.Println("call response", utils.FeltToBigInt(resp[0])) + } diff --git a/cairoVM/deploy.go b/cairoVM/deploy.go index 42f857b..1ec4fe1 100644 --- a/cairoVM/deploy.go +++ b/cairoVM/deploy.go @@ -14,7 +14,7 @@ var ( deployContractMethod string = "deployContract" ) -func NewDeployERC20() (*core.InvokeTransaction, error) { +func NewDeployCool() (*core.InvokeTransaction, error) { //InvokeTx := rpc.InvokeTxnV1{ // Version: rpc.TransactionV1, // Type: rpc.TransactionType_Invoke, @@ -96,3 +96,86 @@ func NewDeployInvokeTest() (*core.InvokeTransaction, error) { return &tx, nil } + +func NewDeployCoolOld() (*core.InvokeTransaction, error) { + //InvokeTx := rpc.InvokeTxnV1{ + // Version: rpc.TransactionV1, + // Type: rpc.TransactionType_Invoke, + //} + + // using UniversalDeploy address + contractAddress := new(felt.Felt).SetUint64(1) + + classHash, _ := new(felt.Felt).SetString("0x47f93257c3a6e42fc71162a646b3223dfad27c2d994f97f333492c66e31b8c8") + + salt, _ := new(felt.Felt).SetString("0x53eb1d3593b1fe9a8369a023ffa5d07d3b2050841cb75ad6ef00698d9307d10") + + uniq := new(felt.Felt).SetUint64(1) + + calldataLength := new(felt.Felt).SetUint64(0) + + // calldata := felt.Felt{} + + // params := new(felt.Felt).SetUint64(8088) + // Building the functionCall struct, where : + FnCall := rpc.FunctionCall{ + ContractAddress: contractAddress, //contractAddress is the contract that we want to call + EntryPointSelector: utils.GetSelectorFromNameFelt(deployContractMethod), //this is the function that we want to call + Calldata: []*felt.Felt{classHash, salt, uniq, calldataLength}, //this is the data that we want to pass to the function + } + + txCallData := account.FmtCallDataCairo2([]rpc.FunctionCall{FnCall}) + + fmt.Println("invoke calldata = ", txCallData) + + nonce := new(felt.Felt).SetUint64(4) + tx := core.InvokeTransaction{ + Nonce: nonce, + MaxFee: &felt.Zero, + Version: new(core.TransactionVersion).SetUint64(1), + ContractAddress: contractAddress, + EntryPointSelector: utils.GetSelectorFromNameFelt(deployContractMethod), + CallData: txCallData, + // CallData: []*felt.Felt{randata}, + } + + return &tx, nil + +} + +func NewDeployInvokeTestCoolOld() (*core.InvokeTransaction, error) { + //InvokeTx := rpc.InvokeTxnV1{ + // Version: rpc.TransactionV1, + // Type: rpc.TransactionType_Invoke, + //} + + // Converting the contractAddress from hex to felt + // contractAddress := new(felt.Felt).SetUint64(2) + 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) + + nonce := new(felt.Felt).SetUint64(5) + tx := core.InvokeTransaction{ + Nonce: nonce, + MaxFee: &felt.Zero, + Version: new(core.TransactionVersion).SetUint64(1), + ContractAddress: contractAddress, + EntryPointSelector: utils.GetSelectorFromNameFelt(contractMethod), + CallData: txCallData, + // CallData: []*felt.Felt{randata}, + } + + return &tx, nil + +} diff --git a/cairoVM/invoke.go b/cairoVM/invoke.go index b447d58..1bdfca4 100644 --- a/cairoVM/invoke.go +++ b/cairoVM/invoke.go @@ -2,6 +2,7 @@ package cairoVM import ( "fmt" + "github.com/NethermindEth/juno/core" "github.com/NethermindEth/juno/core/felt" "github.com/NethermindEth/starknet.go/account" diff --git a/data/cool.casm.json b/data/cool.casm.json new file mode 100644 index 0000000..ce697d6 --- /dev/null +++ b/data/cool.casm.json @@ -0,0 +1,968 @@ +{ + "prime": "0x800000000000011000000000000000000000000000000000000000000000001", + "compiler_version": "2.2.0", + "bytecode": [ + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0xffffffffffffffffffffffffffffd8be", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x88", + "0x4825800180007ffa", + "0x2742", + "0x400280007ff97fff", + "0x482680017ff98000", + "0x1", + "0x48297ffc80007ffd", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0xa", + "0x482680017ffc8000", + "0x1", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480a7ffc7fff8000", + "0x10780017fff7fff", + "0x8", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x20680017fff7ffe", + "0x5d", + "0x48127ffa7fff8000", + "0x480080007ffe8000", + "0x1104800180018000", + "0xe5", + "0x20680017fff7ffe", + "0x54", + "0x48127fef7fff8000", + "0x48127fef7fff8000", + "0x48307ffe80007fff", + "0x4824800180007fff", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x10", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ff77fff8000", + "0x48127fe57fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x1104800180018000", + "0x1d8", + "0x482480017fff8000", + "0x1d7", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007fe3", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007ff27fff", + "0x10780017fff7fff", + "0x20", + "0x4824800180007fe3", + "0x0", + "0x400080007ff37fff", + "0x48127fff7fff8000", + "0x480a7ffb7fff8000", + "0x48127ff37fff8000", + "0x1104800180018000", + "0xdd", + "0x482480017fd18000", + "0x1", + "0x20680017fff7ffc", + "0xc", + "0x40780017fff7fff", + "0x1", + "0x48127ffe7fff8000", + "0x48127ff87fff8000", + "0x48127ff87fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffb7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127fff7fff8000", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017ff08000", + "0x1", + "0x48127fde7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x48127ffd7fff8000", + "0x10780017fff7fff", + "0x5", + "0x40780017fff7fff", + "0xd", + "0x48127fed7fff8000", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4661696c656420746f20646573657269616c697a6520706172616d202331", + "0x400080007ffe7fff", + "0x48127ffd7fff8000", + "0x48127fe87fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0xa0680017fff8000", + "0x7", + "0x482680017ffa8000", + "0xffffffffffffffffffffffffffffd666", + "0x400280007ff97fff", + "0x10780017fff7fff", + "0x58", + "0x4825800180007ffa", + "0x299a", + "0x400280007ff97fff", + "0x48297ffc80007ffd", + "0x482680017ff98000", + "0x1", + "0x4824800180007ffe", + "0x0", + "0x20680017fff7fff", + "0x4", + "0x10780017fff7fff", + "0x10", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x400080007ffe7fff", + "0x48127ffc7fff8000", + "0x48127ff97fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x1104800180018000", + "0x159", + "0x482480017fff8000", + "0x158", + "0x480080007fff8000", + "0xa0680017fff8000", + "0x9", + "0x4824800180007ff7", + "0x0", + "0x482480017fff8000", + "0x100000000000000000000000000000000", + "0x400080007ff77fff", + "0x10780017fff7fff", + "0x21", + "0x4824800180007ff7", + "0x0", + "0x400080007ff87fff", + "0x482480017ff88000", + "0x1", + "0x48127ffe7fff8000", + "0x480a7ffb7fff8000", + "0x1104800180018000", + "0x74", + "0x20680017fff7ffd", + "0xe", + "0x40780017fff7fff", + "0x1", + "0x400080007fff7ffe", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x48127ff97fff8000", + "0x480680017fff8000", + "0x0", + "0x48127ffb7fff8000", + "0x482480017ffa8000", + "0x1", + "0x208b7fff7fff7ffe", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482480017ff58000", + "0x1", + "0x48127ff27fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x4f7574206f6620676173", + "0x400080007ffe7fff", + "0x482680017ff98000", + "0x1", + "0x480a7ffa7fff8000", + "0x480a7ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x482480017ff98000", + "0x1", + "0x208b7fff7fff7ffe", + "0xa0680017fff8000", + "0x16", + "0x480280007ffc8003", + "0x480280017ffc8003", + "0x4844800180017ffe", + "0x100000000000000000000000000000000", + "0x483180017ffd7ffd", + "0x482480017fff7ffd", + "0x800000000000010fffffffffffffffff7ffffffffffffef0000000000000001", + "0x20680017fff7ffc", + "0x6", + "0x402480017fff7ffd", + "0xffffffffffffffffffffffffffffffff", + "0x10780017fff7fff", + "0x4", + "0x402480017ffe7ffd", + "0xf7ffffffffffffef0000000000000000", + "0x400280027ffc7ffd", + "0x20680017fff7ffe", + "0xe", + "0x402780017fff7fff", + "0x1", + "0x400380007ffc7ffd", + "0x40780017fff7fff", + "0x5", + "0x482680017ffc8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x480a7ffd7fff8000", + "0x10780017fff7fff", + "0x8", + "0x482680017ffc8000", + "0x3", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x2c", + "0x20680017fff7ffd", + "0xb", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x1104800180018000", + "0x49", + "0x20680017fff7ffd", + "0xb", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1afeeaff0ed5cee7d05a21078399c2f56226b0cd5657062500cef4c4e736f85", + "0x480680017fff8000", + "0x53746f726167655772697465", + "0x400280007ffc7fff", + "0x400380017ffc7ffb", + "0x400280027ffc7ffd", + "0x400280037ffc7ffe", + "0x400380047ffc7ffd", + "0x480280067ffc8000", + "0x20680017fff7fff", + "0xd", + "0x480280057ffc8000", + "0x482680017ffc8000", + "0x7", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x10780017fff7fff", + "0x9", + "0x480280057ffc8000", + "0x482680017ffc8000", + "0x9", + "0x480680017fff8000", + "0x1", + "0x480280077ffc8000", + "0x480280087ffc8000", + "0x1104800180018000", + "0x41", + "0x20680017fff7ffd", + "0xb", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x48127ff67fff8000", + "0x48127ff67fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x208b7fff7fff7ffe", + "0x480a7ffb7fff8000", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1afeeaff0ed5cee7d05a21078399c2f56226b0cd5657062500cef4c4e736f85", + "0x1104800180018000", + "0x34", + "0x20680017fff7ffc", + "0x1a", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x48127ffd7fff8000", + "0x1104800180018000", + "0x69", + "0x20680017fff7ffd", + "0xb", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ffa7fff8000", + "0x48127ffa7fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x8", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x48127ff17fff8000", + "0x480680017fff8000", + "0x1", + "0x48127ff27fff8000", + "0x48127ff27fff8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffb", + "0x9", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x53746f7261676552656164", + "0x400280007ffb7fff", + "0x400380017ffb7ffa", + "0x400380027ffb7ffc", + "0x400380037ffb7ffd", + "0x480280057ffb8000", + "0x20680017fff7fff", + "0x28", + "0x480a7ff97fff8000", + "0x480280067ffb8000", + "0x1104800180018000", + "0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffff31", + "0x480280047ffb8000", + "0x482680017ffb8000", + "0x7", + "0x20680017fff7ffc", + "0xf", + "0x40780017fff7fff", + "0x2", + "0x48127ff97fff8000", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x48127ff57fff8000", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x1", + "0x480680017fff8000", + "0x53746f726555313238202d206e6f6e2075313238", + "0x400080007ffe7fff", + "0x48127ff97fff8000", + "0x48127ffb7fff8000", + "0x48127ffb7fff8000", + "0x480680017fff8000", + "0x1", + "0x480680017fff8000", + "0x0", + "0x48127ff97fff8000", + "0x482480017ff88000", + "0x1", + "0x208b7fff7fff7ffe", + "0x40780017fff7fff", + "0x11", + "0x480a7ff97fff8000", + "0x480280047ffb8000", + "0x482680017ffb8000", + "0x8", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x1", + "0x480280067ffb8000", + "0x480280077ffb8000", + "0x208b7fff7fff7ffe", + "0x20780017fff7ffb", + "0x8", + "0x480680017fff8000", + "0x0", + "0x480680017fff8000", + "0x0", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe", + "0x480680017fff8000", + "0x1", + "0x480a7ffc7fff8000", + "0x480a7ffd7fff8000", + "0x208b7fff7fff7ffe" + ], + "hints": [ + [ + 0, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x2742" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 48, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 67, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -28 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 88, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 106, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 127, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 141, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 156, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x299a" + }, + "rhs": { + "Deref": { + "register": "FP", + "offset": -6 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 175, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 194, + [ + { + "TestLessThanOrEqual": { + "lhs": { + "Immediate": "0x0" + }, + "rhs": { + "Deref": { + "register": "AP", + "offset": -8 + } + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 214, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 234, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 249, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 264, + [ + { + "TestLessThan": { + "lhs": { + "Deref": { + "register": "FP", + "offset": -3 + } + }, + "rhs": { + "Immediate": "0x100000000000000000000000000000000" + }, + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ], + [ + 266, + [ + { + "DivMod": { + "lhs": { + "Deref": { + "register": "FP", + "offset": -3 + } + }, + "rhs": { + "Immediate": "0x100000000000000000000000000000000" + }, + "quotient": { + "register": "AP", + "offset": 3 + }, + "remainder": { + "register": "AP", + "offset": 4 + } + } + } + ] + ], + [ + 361, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -4 + } + } + } + } + ] + ], + [ + 467, + [ + { + "SystemCall": { + "system": { + "Deref": { + "register": "FP", + "offset": -5 + } + } + } + } + ] + ], + [ + 492, + [ + { + "AllocSegment": { + "dst": { + "register": "AP", + "offset": 0 + } + } + } + ] + ] + ], + "pythonic_hints": [ + [ + 0, + [ + "memory[ap + 0] = 10050 <= memory[fp + -6]" + ] + ], + [ + 48, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 67, + [ + "memory[ap + 0] = 0 <= memory[ap + -28]" + ] + ], + [ + 88, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 106, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 127, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 141, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 156, + [ + "memory[ap + 0] = 10650 <= memory[fp + -6]" + ] + ], + [ + 175, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 194, + [ + "memory[ap + 0] = 0 <= memory[ap + -8]" + ] + ], + [ + 214, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 234, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 249, + [ + "memory[ap + 0] = segments.add()" + ] + ], + [ + 264, + [ + "memory[ap + 0] = memory[fp + -3] < 340282366920938463463374607431768211456" + ] + ], + [ + 266, + [ + "(memory[ap + 3], memory[ap + 4]) = divmod(memory[fp + -3], 340282366920938463463374607431768211456)" + ] + ], + [ + 361, + [ + "syscall_handler.syscall(syscall_ptr=memory[fp + -4])" + ] + ], + [ + 467, + [ + "syscall_handler.syscall(syscall_ptr=memory[fp + -5])" + ] + ], + [ + 492, + [ + "memory[ap + 0] = segments.add()" + ] + ] + ], + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x26813d396fdb198e9ead934e4f7a592a8b88a059e45ab0eb6ee53494e8d45b0", + "offset": 156, + "builtins": [ + "range_check" + ] + }, + { + "selector": "0x3d7905601c217734671143d457f0db37f7f8883112abd34b92c4abfeafde0c3", + "offset": 0, + "builtins": [ + "range_check" + ] + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [] + } +} \ No newline at end of file diff --git a/data/cool.sierra.json b/data/cool.sierra.json new file mode 100644 index 0000000..00512de --- /dev/null +++ b/data/cool.sierra.json @@ -0,0 +1,399 @@ +{ + "sierra_program": [ + "0x1", + "0x3", + "0x0", + "0x2", + "0x2", + "0x0", + "0xe4", + "0x1c", + "0x22", + "0x52616e6765436865636b", + "0x800000000000000100000000000000000000000000000000", + "0x75313238", + "0x800000000000000700000000000000000000000000000000", + "0x4172726179", + "0x800000000000000300000000000000000000000000000001", + "0x1", + "0x1e", + "0x456e756d", + "0x800000000000000300000000000000000000000000000003", + "0x0", + "0x2cf4ead4392e987c9b56754a10f0a8e0f13776791e096fa6503893f05582c51", + "0x2", + "0x537472756374", + "0x800000000000000300000000000000000000000000000002", + "0x2ee1e2b1b89f8c495f200e4956278a4d47395fe262f27b52e5865c9524c08c3", + "0x3", + "0x800000000000000f00000000000000000000000000000001", + "0x16a4c8d7c05909052238a862d8cc3e7975bf05a07b3a69c6b28951083a6d672", + "0x5", + "0x35db377e57ca049334bdd283ee9a74d991b437ea21f0760006234ec7e529d20", + "0x4", + "0x6", + "0x800000000000000f00000000000000000000000000000002", + "0x8", + "0xcc5e86243f861d2d64b08c35db21013e773ac5cf10097946fe0011304886d5", + "0x9", + "0x101dc0399934cc08fa0d6f6f2daead4e4a38cabeea1c743e1fc28d2d6e58e99", + "0x53746f7261676541646472657373", + "0x53746f726167654261736541646472657373", + "0x2912910c7080fc2a5c999feca92fca5e5816ab4843a7b812f0a8fe0720305e8", + "0x800000000000000f00000000000000000000000000000003", + "0xe", + "0x27e2f47c41564d79b736373a1fa9b95abd8817de85638ca556eef21e5bcf6e0", + "0xf", + "0x800000000000000700000000000000000000000000000002", + "0x2f23416cc60464d4158423619ba713070eb82b686c9d621a22c67bd37f6e0a9", + "0x11", + "0x536e617073686f74", + "0x800000000000000700000000000000000000000000000001", + "0x1baeba72e79e9db2587cf44fedb2f3700b2075a5e8e39a562584862c4b71f62", + "0x13", + "0x14", + "0x1e14d0fecb502521f658e5dfecea251107bfdc8a6d743be0ff52ea8b2fa6068", + "0x16", + "0x3f3cd2a51359b64b8f6195446096f575e524a6999e093bc63feb6f9ce692312", + "0x17", + "0x4275696c74696e436f737473", + "0x53797374656d", + "0x9931c641b913035ae674b400b61a51476d506bbe8bba2ff8a6272790aba9e6", + "0x15", + "0x753332", + "0x800000000000000700000000000000000000000000000003", + "0x1909a2057b9c1373b889e003e050a09f431d8108e0659d03444ced99a6eea68", + "0x66656c74323532", + "0x426f78", + "0x29d7d57c04a880978e7b3689f6218e507f3be17588744b58dc17762447ad0e7", + "0x1f", + "0x4761734275696c74696e", + "0x7a", + "0x7265766f6b655f61705f747261636b696e67", + "0x77697468647261775f676173", + "0x6272616e63685f616c69676e", + "0x7374727563745f6465636f6e737472756374", + "0x656e61626c655f61705f747261636b696e67", + "0x73746f72655f74656d70", + "0x61727261795f736e617073686f745f706f705f66726f6e74", + "0x656e756d5f696e6974", + "0x20", + "0x6a756d70", + "0x7374727563745f636f6e737472756374", + "0x656e756d5f6d61746368", + "0x756e626f78", + "0x72656e616d65", + "0x66756e6374696f6e5f63616c6c", + "0x1d", + "0x61727261795f6c656e", + "0x736e617073686f745f74616b65", + "0x1c", + "0x64726f70", + "0x7533325f636f6e7374", + "0x7533325f6571", + "0x64697361626c655f61705f747261636b696e67", + "0x61727261795f6e6577", + "0x66656c743235325f636f6e7374", + "0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473", + "0x61727261795f617070656e64", + "0x1b", + "0x21", + "0x1a", + "0x6765745f6275696c74696e5f636f737473", + "0x19", + "0x77697468647261775f6761735f616c6c", + "0x18", + "0x4f7574206f6620676173", + "0x4661696c656420746f20646573657269616c697a6520706172616d202331", + "0x12", + "0x753132385f746f5f66656c74323532", + "0x75313238735f66726f6d5f66656c74323532", + "0x10", + "0x73746f726167655f626173655f616464726573735f636f6e7374", + "0x1afeeaff0ed5cee7d05a21078399c2f56226b0cd5657062500cef4c4e736f85", + "0x73746f726167655f616464726573735f66726f6d5f62617365", + "0xc", + "0x73746f726167655f77726974655f73797363616c6c", + "0xb", + "0x7", + "0xa", + "0xd", + "0x73746f726167655f726561645f73797363616c6c", + "0x53746f726555313238202d206e6f6e2075313238", + "0x1b7", + "0xffffffffffffffff", + "0x7d", + "0x6c", + "0x67", + "0x23", + "0x24", + "0x36", + "0x25", + "0x26", + "0x27", + "0x28", + "0x29", + "0x2a", + "0x2b", + "0x2c", + "0x2d", + "0x2e", + "0x2f", + "0x30", + "0x31", + "0x59", + "0x32", + "0x33", + "0x34", + "0x35", + "0x39", + "0x3a", + "0x3b", + "0x3c", + "0x37", + "0x38", + "0x3d", + "0x52", + "0x3e", + "0x3f", + "0x40", + "0x41", + "0x42", + "0x43", + "0x44", + "0x45", + "0x46", + "0x47", + "0x48", + "0x49", + "0x4a", + "0x4b", + "0x4c", + "0x4d", + "0x4e", + "0x4f", + "0x50", + "0x51", + "0x53", + "0x54", + "0x55", + "0x56", + "0x57", + "0x58", + "0x70", + "0x5a", + "0x5b", + "0x5c", + "0x5d", + "0x5e", + "0x5f", + "0x60", + "0x61", + "0x62", + "0x63", + "0x64", + "0x65", + "0x66", + "0x68", + "0x69", + "0x6a", + "0x6b", + "0xdc", + "0xa7", + "0xcf", + "0xc8", + "0xf0", + "0xf7", + "0x10c", + "0x122", + "0x139", + "0x13e", + "0x149", + "0x16f", + "0x168", + "0x17c", + "0x6d", + "0x6e", + "0x6f", + "0x71", + "0x1a2", + "0x194", + "0x72", + "0x73", + "0x74", + "0x75", + "0x76", + "0x77", + "0x78", + "0x79", + "0x1b1", + "0x8b", + "0xea", + "0xfa", + "0x112", + "0x129", + "0x150", + "0x176", + "0x182", + "0x1ab", + "0x108d", + "0x100b0a0e130b120e1107100b0f0e0d0707070c0b0a09080706050403020100", + "0x917071b071a0b0a091907100b180e100b120e17071607150b0a090d071407", + "0x17072307220b0a0919072107100b200e1f0b120e041e041d0d0719071c0b0a", + "0xe2b07100b240e2a07290b240e0d07282717072607250b0a090707100b240e", + "0x3307320b0a090231043017072f072e0b0a0919072d07100b200e21072c0b18", + "0xb3d3c023b19073a07390b350908072838043719070707360b350904341707", + "0x707422a0707420b0d45070d44080707430b0707420b412b0707400b3f0b3e", + "0x74b080707420807074a0807074945070748070d45070d44190707470b4645", + "0x424f07074a0b0d07514f0707504f07074e0807074d2b0707474c0707480d11", + "0x170707471407074708070757560d075508070754070707500b530b524f0707", + "0x47210707470b5d5c0707420b5b580707425a07074259070742070d58070d44", + "0xd0707500d07074e2f0707505e0707481111074b070707422d0707422d0707", + "0x4e2b070750600d07552a070750190707505f0d07550b0d58070d4433070747", + "0xb630b620707074a0707074e26070740610707481611074b2d0707502d0707", + "0x707422d0707404c07074a0b07074a070d4c070d444c0707420b0d4c070d44", + "0x5e070d445e0707420b0d5e070d442f07074723070740640707481411074b21", + "0x67660d0765070d61070d44610707420b0d61070d44260707471711074b070d", + "0x70d6a070d446a0707420b0d6a070d440b6968070742210707502107074e0b", + "0x44640707420b0d64070d44230707471b0707406c0707486b11074b6a07074a", + "0x7481b11074b11070742160707406b0707481911074b6d070742070d64070d", + "0x470b0d11070d440b6e070d6c070d446c0707420b0d6c070d441b0707476a07", + "0x748070d11070d44070d6b070d446f0d07556b0707420b0d6b070d44160707", + "0x110b0b71070b0d0b6b170d7214160d710d070b0d070b0b71070b0b0b701107", + "0x7686c1b0d710d1907170b160771071607140b0b71070b160b190771071107", + "0x2107710768071b0b6d0771071b07190b680771076c076b0b0b71070b0d0b6a", + "0x6a07190b640771072307680b230771070b6a0b0b71070b0d0b0b26070b6c0b", + "0x210b0b71070b0d0b6107732607710d21076d0b2107710764071b0b6d077107", + "0xb5e0771072b07640b2f0771071607140b2b0771072a07230b2a0771072607", + "0x76d072a0b0b71070b0d0b5a07745c07710d2d07610b2d330d71075e2f0d26", + "0x4c07330b4c0771074f072b0b4f0771074f07190b4f0771075807110b580771", + "0x72d0b00590d71074507330b450771070b2f0b0b710708072d0b3a080d7107", + "0xd5a0b7507710775075c0b7607710700075e0b750771073a075e0b0b710759", + "0x71070b4c0b0b71075c074f0b0b71070b580b0b71070b0d0b0b770b710d7675", + "0x71070b450b7a07710779780d3a0b790771077907640b790771070b080b7807", + "0x1407750b7e0771073307140b7d0771077c07000b7c0771077a7b0d590b7b07", + "0x71070b0d0b81807f7e1607810771077d07780b800771070d07760b7f077107", + "0xd710d821433117b0b8207710782077a0b820771070b790b0b71070b580b0b", + "0x8407750b8907710788077d0b880771070b7c0b0b71070b0d0b87860d858483", + "0x16800b8d0771075c077f0b8c07710789077e0b8b0771070d07760b8a077107", + "0xd0b9207919007710d8f07810b830771078307140b8f8e771171078d8c8b8a", + "0x9407840b95940d71079307830b930771070b4c0b0b71079007820b0b71070b", + "0x8307140b980771079707870b970771079607860b9607710795072a0b0b7107", + "0x9916079c0771079807780b9b0771078e07760b9a0771077707750b99077107", + "0x71077707750b9e0771078307140b9d0771079207000b0b71070b0d0b9c9b9a", + "0xb0b71070b0d0ba1a09f9e1607a10771079d07780ba00771078e07760b9f07", + "0xd3a0ba3077107a307640ba30771070b880ba20771070b4c0b0b71075c074f", + "0xba60771079107000b91077107a4a50d590ba50771070b450ba4077107a3a2", + "0xaa077107a607780ba90771070d07760ba80771078707750ba7077107860714", + "0x73307140b0b71076d07770b0b71075a07890b0b71070b0d0baaa9a8a71607", + "0x140b0b71076d07770b0b71076107890b0b71070b0d0b0bac070b6c0bab0771", + "0x7ad07640bad0771070b8e0b850771070b4c0b0b71070b580bab0771071607", + "0x7000bb0077107aeaf0d590baf0771070b450bae077107ad850d3a0bad0771", + "0x780bb40771070d07760bb30771071407750bb2077107ab07140bb1077107b0", + "0x771070b4c0b0b710711078f0b0b71070b0d0bb5b4b3b21607b5077107b107", + "0x771070b450bb8077107b7b60d3a0bb7077107b707640bb70771070b880bb6", + "0x76b07750bbb0771071707140bba0771077407000b74077107b8b90d590bb9", + "0xb71070b0b0b73bdbcbb160773077107ba07780bbd0771070d07760bbc0771", + "0x72b0b190771071107110b0b71070b0d0b6b170dbe14160d710d070b0d070b", + "0x7330b680771070b2f0b0b71076c072d0b6a6c0d71071b07330b1b07710719", + "0x5c0b6407710721075e0b230771076a075e0b0b71076d072d0b216d0d710768", + "0xb0b71070b0d0b0bbf0b710d64230d5a0b160771071607140b230771072307", + "0xb2a07710761260d3a0b610771076107640b610771070b080b260771070b4c", + "0x2f0771071607140b2d0771073307000b330771072a2b0d590b2b0771070b45", + "0xb5a5c5e2f16075a0771072d07780b5c0771070d07760b5e0771071407750b", + "0x4c4f0d710d581416117b0b5807710758077a0b580771070b790b0b71070b0d", + "0x710759078a0b5907710745077d0b450771070b7c0b0b71070b0d0b3a080dc0", + "0x70d07760b7c0771074c07750b7b0771074f07140b0b710700078b0b75000d", + "0x710d7a078d0b7a7978761671077e7d7c7b168c0b7e07710775077e0b7d0771", + "0x78207920b820771077f07900b810771070b4c0b0b71070b0d0b8007c17f07", + "0x810d3a0b870771078607940b860771078407930b0b710783074f0b84830d71", + "0x860b8e07710777072a0b0b71078907840b77890d71078807830b8807710787", + "0xb8c0771077807750b8b0771077607140b8a0771078f07870b8f0771078e07", + "0x8007000b0b71070b0d0b908d8c8b1607900771078a07780b8d077107790776", + "0x7780b950771077907760b940771077807750b930771077607140b92077107", + "0x980771070b880b970771070b4c0b0b71070b0d0b9695949316079607710792", + "0x7107999a0d590b9a0771070b450b9907710798970d3a0b980771079807640b", + "0x70d07760b9e0771073a07750b9d0771070807140b9c0771079b07000b9b07", + "0xb0b710711078f0b0b71070b0d0ba09f9e9d1607a00771079c07780b9f0771", + "0xba3077107a2a10d3a0ba2077107a207640ba20771070b880ba10771070b4c", + "0xa60771071707140b91077107a507000ba5077107a3a40d590ba40771070b45", + "0xba9a8a7a61607a90771079107780ba80771070d07760ba70771076b07750b", + "0x7140b6b0771071107960b0b71070b0d0b17141611c2110d0d710d070b0d95", + "0x710714074f0b0b71070b0d0b0bc3070b6c0b1b0771076b07970b190771070d", + "0x190771071607140b6a0771076c07980b6c0771070b6a0b0b710717074f0b0b", + "0x79b0b6d680d076d0771071b079a0b680771071907990b1b0771076a07970b", + "0x7f0b6c07710716079c0b1b0771070707760b190771070b07750b160771070d", + "0xb6d07c46807710d6b079e0b6b17141171076a6c1b19169d0b6a0771071107", + "0x77d0b640771070b6a0b0b71072307890b23210d710768079f0b0b71070b0d", + "0xb2b0771071407750b2a0771076107a10b6107710764260da00b2607710721", + "0x76d07a30b0b71070b0d0b2d332b11072d0771072a07a20b33077107170776", + "0x5c5e11075a0771072f07a20b5c0771071707760b5e0771071407750b2f0771", + "0x71070d07760b6c0771070707750b1b0771070b07140b1607710711079b0b5a", + "0x7710d19078d0b196b1714167107686a6c1b16a40b6807710716079c0b6a07", + "0x76407910b640771072307a50b230771076d07900b0b71070b0d0b2107c56d", + "0x2607a60b2b0771076b07760b2a0771071707750b610771071407140b260771", + "0x771071407140b2d0771072107a70b0b71070b0d0b332b2a61160733077107", + "0x5a5c5e2f16075a0771072d07a60b5c0771076b07760b5e0771071707750b2f", + "0xb6b0771070b2f0b170771071607a90b140771071107940b160771070ba80b", + "0x170771071707850b6b0771076b075c0b0b71071b07ab0b1b190d71070d07aa", + "0x230771070b6a0b0b71070b0d0b216d6811c66a6c0d710d14176b070b14ad0b", + "0x771076407af0b610771076a07760b260771076c07750b640771072307ae0b", + "0x760b260771076807750b2b0771072107b00b0b71070b0d0b0bc7070b6c0b2a", + "0xb330771072d07b20b2d0771072a07b10b2a0771072b07af0b610771076d07", + "0x71075c190db50b5c0771072f07b40b0b71070b0d0b5e07c82f07710d3307b3", + "0x75807b70b4c0771076107760b4f0771072607750b580771075a07b60b5a07", + "0x750b3a0771075e07b80b0b71071907ab0b0b71070b0d0b084c4f1107080771", + "0x1107ab0b0059451107000771073a07b70b590771076107760b450771072607", + "0x71070707750b6c0771070b07140b140771070b2f0b160771070ba80b0b7107", + "0x6a6c14740b210771071607b90b6d07710714075c0b680771070d07760b6a07", + "0x2307bb0b0b71070b0d0b6407c92307710d1b07ba0b1b196b17167107216d68", + "0x3307ca2b07710d61078d0b610771072a07bd0b2a0771072607bc0b26077107", + "0xb5e0771072f07910b2f0771072d07a50b2d0771072b07900b0b71070b0d0b", + "0x4f0771075e07a60b580771071907760b5a0771076b07750b5c077107170714", + "0x7750b080771071707140b4c0771073307a70b0b71070b0d0b4f585a5c1607", + "0x70b0d0b59453a081607590771074c07a60b450771071907760b3a0771076b", + "0x71907760b760771076b07750b750771071707140b000771076407a70b0b71", + "0xb0d0b0d07cb0707710d0b07730b797876751607790771070007a60b780771", + "0xb140707140771071607ce0b160771071107cd0b110771070707cc0b0b7107", + "0xce0b190771076b07ac0b6b0771070d170d590b170771070b450b0b71070b0d", + "0xd0196b1711710d14110d0716cf0b140771071607a90b1b07071b0771071907", + "0x23210d260b230771071907640b210771070b07140b0b71070b0d0b6a6c1b11", + "0x7d16407710d6d07610b6b0771076b07760b170771071707750b6d680d7107", + "0x2b0771072a07d40b2a0771076107d30b610771076407d20b0b71070b0d0b26", + "0x771072b07d50b2f0771076b07760b2d0771071707750b330771076807140b", + "0x70bd60b5c0771070b4c0b0b71072607890b0b71070b0d0b5e2f2d3316075e", + "0x4f0d590b4f0771070b450b580771075a5c0d3a0b5a0771075a07640b5a0771", + "0x760b450771071707750b3a0771076807140b080771074c07d70b4c07710758", + "0x76a07d80b0b71070b0d0b0059453a1607000771070807d50b590771076b07", + "0x1b07750b790771070b07140b780771077607d40b760771077507d30b750771", + "0xd0b07d90b7c7b7a7916077c0771077807d50b7b0771076c07760b7a077107", + "0x7a60b160771071107910b110771070707a50b0b71070b0d0b0d07da070771", + "0xb6b0771070d170d590b170771070b450b0b71070b0d0b1407071407710716", + "0x70b585a590b162b5a590b166c1b07071b0771071907a60b190771076b07a7", + "0x2d5a5916dc070b4c0b0d080b0ddb110d070b585a590b162b5a590b160b110d", + "0x1107215a5916de110d070b615a590b162d5a590b16dd110d070b5e5a591107", + "0xb14e10b6c076a07e0110d070b615a590b16215a590b16df110d070b645a59", + "0xe30b61071107e216110d070b6b5a590b166d4f5a59" + ], + "sierra_program_debug_info": { + "type_names": [], + "libfunc_names": [], + "user_func_names": [] + }, + "contract_class_version": "0.1.0", + "entry_points_by_type": { + "EXTERNAL": [ + { + "selector": "0x26813d396fdb198e9ead934e4f7a592a8b88a059e45ab0eb6ee53494e8d45b0", + "function_idx": 1 + }, + { + "selector": "0x3d7905601c217734671143d457f0db37f7f8883112abd34b92c4abfeafde0c3", + "function_idx": 0 + } + ], + "L1_HANDLER": [], + "CONSTRUCTOR": [] + }, + "abi": "[{\"type\": \"function\",\"name\": \"set_value\",\"inputs\": [{\"name\": \"_value\",\"type\": \"core::integer::u128\"}],\"outputs\": [],\"state_mutability\": \"external\"},{\"type\": \"function\",\"name\": \"get_value\",\"inputs\": [],\"outputs\": [{\"type\": \"core::integer::u128\"}],\"state_mutability\": \"view\"},{\"type\": \"event\",\"name\": \"cool::cool::cool::Event\",\"kind\": \"enum\",\"variants\": []}]" +} \ No newline at end of file