From e5d924733e84dc752ac9eece94c617792bcfcba4 Mon Sep 17 00:00:00 2001 From: rishikpulhani Date: Tue, 17 Sep 2024 16:47:28 +0530 Subject: [PATCH 1/8] added the TestEnumTypeSerialisation test and also fixed some things in decode.go --- Athena | 1 + athena_abi/cairo_type_decoders_test.go | 81 ++++++++++++++++++++++++++ athena_abi/decode.go | 17 ++++-- 3 files changed, 94 insertions(+), 5 deletions(-) create mode 160000 Athena diff --git a/Athena b/Athena new file mode 160000 index 00000000..83dbe60f --- /dev/null +++ b/Athena @@ -0,0 +1 @@ +Subproject commit 83dbe60f110edf4879714509447a76b640539987 diff --git a/athena_abi/cairo_type_decoders_test.go b/athena_abi/cairo_type_decoders_test.go index 2b3127ca..2b1fd7ca 100644 --- a/athena_abi/cairo_type_decoders_test.go +++ b/athena_abi/cairo_type_decoders_test.go @@ -36,3 +36,84 @@ func TestArrayDecoding(t *testing.T) { assert.Equal(t, 0, len(_calldata)) } } +func TestEnumTypeSerialization(t *testing.T) { + variedTypeEnum := StarknetEnum{ + Name: "Enum A", + Variants: []struct { + Name string + Type StarknetType + }{ + {Name: "a", Type: U256}, + {Name: "b", Type: U128}, + {Name: "c", Type: StarknetStruct{ + Name: "Struct A", + Members: []AbiParameter{ + {Name: "my_option", Type: StarknetOption{InnerType: U128}}, + {Name: "my_uint", Type: U256}, + }, + }}, + }, + } + + testCases := []struct { + name string + calldata []*big.Int + decoded map[string]interface{} + //encodingInput map[string]interface{} + }{ + { + name: "Case 1", + calldata: []*big.Int{big.NewInt(0), big.NewInt(100), big.NewInt(0)}, + //decoded: map[string]interface{}{"a": []interface{}{big.NewInt(100)}}, + decoded: map[string]interface{}{"a": big.NewInt(100)}, // Same as previous decoded value + }, + { + name: "Case 2", + calldata: []*big.Int{big.NewInt(1), big.NewInt(200)}, + //decoded: map[string]interface{}{"b": []interface{}{big.NewInt(200)}}, + decoded: map[string]interface{}{"b": big.NewInt(200)}, // Same as previous decoded value + }, + { + name: "Case 3", + calldata: []*big.Int{big.NewInt(2), big.NewInt(0), big.NewInt(300), big.NewInt(300), big.NewInt(0)}, + /*decoded: map[string]interface{}{ + "c": []interface{}{ + map[string]interface{}{ + "my_option": big.NewInt(300), + "my_uint": big.NewInt(300), + }, + }, + },*/ + decoded: map[string]interface{}{ + "c": map[string]interface{}{ // Same as previous decoded value + "my_option": big.NewInt(300), + "my_uint": big.NewInt(300), + }, + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + calldata := make([]*big.Int, len(tc.calldata)) + copy(calldata, tc.calldata) + + // Decode the calldata using the DecodeFromTypes function + decodedValues, err := DecodeFromTypes([]StarknetType{variedTypeEnum}, &calldata) + assert.NoError(t, err, "DecodeFromTypes should not return an error") + + // Assert that all calldata is consumed + assert.Empty(t, calldata, "All calldata should be consumed during decoding") + + // Encode the values back into calldata using encodingInput + encodedCalldata, err := EncodeFromTypes([]StarknetType{variedTypeEnum}, []interface{}{tc.decoded}) + assert.NoError(t, err, "EncodeFromTypes should not return an error") + + // Assert that the encoded calldata matches the original calldata + assert.Equal(t, tc.calldata, encodedCalldata, "Encoded calldata should match original") + + // Assert that the decoded values match the expected decoded data + assert.Equal(t, tc.decoded, decodedValues[0], "Decoded values should match expected") + }) + } +} diff --git a/athena_abi/decode.go b/athena_abi/decode.go index 5328a706..f465cc45 100644 --- a/athena_abi/decode.go +++ b/athena_abi/decode.go @@ -168,7 +168,7 @@ func DecodeFromTypes(types []StarknetType, callData *[]*big.Int) ([]interface{}, if err != nil { return nil, err } - outputData = append(outputData, decoded...) + outputData = append(outputData, decoded[0]) } case StarknetOption: optionPresent, err := pop(callData) @@ -177,15 +177,22 @@ func DecodeFromTypes(types []StarknetType, callData *[]*big.Int) ([]interface{}, Msg: fmt.Sprintf("not enough calldata to decode %s", starknet_type.idStr()), } } - if optionPresent.Cmp(big.NewInt(0)) == 0 { + if optionPresent.Cmp(big.NewInt(0)) == 1 { outputData = append(outputData, nil) } else { decoded, err := DecodeFromTypes([]StarknetType{t.InnerType}, callData) if err != nil { return nil, err } - outputData = append(outputData, decoded...) + outputData = append(outputData, decoded[0]) } + case StarknetStruct: + decodedStruct, err := DecodeFromParams(t.Members, callData) + if err != nil { + return nil, err + } + outputData = append(outputData, decodedStruct) + case StarknetEnum: enumIndex, err := pop(callData) if err != nil { @@ -198,14 +205,14 @@ func DecodeFromTypes(types []StarknetType, callData *[]*big.Int) ([]interface{}, if err != nil { return nil, err } - outputData = append(outputData, map[string]interface{}{variantName: decoded}) + outputData = append(outputData, map[string]interface{}{variantName: decoded[0]}) //change made case StarknetTuple: for _, tupleMembers := range t.Members { decoded, err := DecodeFromTypes([]StarknetType{tupleMembers}, callData) if err != nil { return nil, err } - outputData = append(outputData, decoded...) + outputData = append(outputData, decoded[0]) } case StarknetNonZero: decoded, err := DecodeFromTypes([]StarknetType{t.InnerType}, callData) From 87114c4e9d33142fda40eb5c5386f3d0df5047b5 Mon Sep 17 00:00:00 2001 From: rishikpulhani Date: Thu, 19 Sep 2024 15:25:14 +0530 Subject: [PATCH 2/8] completed cairo_types_decoders_test --- athena_abi/cairo_type_decoders_test.go | 421 +++++++++++++++++++++++-- athena_abi/decode.go | 8 +- 2 files changed, 406 insertions(+), 23 deletions(-) diff --git a/athena_abi/cairo_type_decoders_test.go b/athena_abi/cairo_type_decoders_test.go index 2b1fd7ca..3332780c 100644 --- a/athena_abi/cairo_type_decoders_test.go +++ b/athena_abi/cairo_type_decoders_test.go @@ -7,35 +7,69 @@ import ( "github.com/stretchr/testify/assert" ) -func TestArrayDecoding(t *testing.T) { +func TestArrayDecodingAndEncoding(t *testing.T) { tests := []struct { + name string starknetType StarknetType calldata []*big.Int - decoded []*big.Int + decoded interface{} }{ - {StarknetArray{U256}, []*big.Int{big.NewInt(0)}, []*big.Int{}}, - {StarknetArray{U256}, []*big.Int{big.NewInt(2), big.NewInt(16), big.NewInt(0), big.NewInt(48), big.NewInt(0)}, []*big.Int{big.NewInt(16), big.NewInt(48)}}, + { + name: "Empty U256 Array", + starknetType: StarknetArray{InnerType: U256}, + calldata: []*big.Int{big.NewInt(0)}, + decoded: []interface{}(nil), + }, + { + name: "U256 Array with Two Elements", + starknetType: StarknetArray{InnerType: U256}, + calldata: []*big.Int{big.NewInt(2), big.NewInt(16), big.NewInt(0), big.NewInt(48), big.NewInt(0)}, + decoded: []interface{}{big.NewInt(16), big.NewInt(48)}, + }, + { + name: "Nested Arrays with U32", + starknetType: StarknetArray{ + InnerType: StarknetArray{ + InnerType: StarknetArray{ + InnerType: U32, + }, + }, + }, + calldata: []*big.Int{big.NewInt(1), big.NewInt(1), big.NewInt(2), big.NewInt(22), big.NewInt(38)}, + decoded: []interface{}{ + []interface{}{ + []interface{}{ + big.NewInt(22), + big.NewInt(38), + }, + }, + }, + }, } - for _, test := range tests { - _calldata := make([]*big.Int, len(test.calldata)) - copy(_calldata, test.calldata) - decodedValues, err := DecodeFromTypes([]StarknetType{test.starknetType}, &_calldata) - assert.Equal(t, nil, err) - for i := 0; i < len(test.decoded); i++ { - assert.Equal(t, test.decoded[i], decodedValues[i]) - } - // needed to convert []*big.Int into []interface{} - interfaceSlice := make([]interface{}, len(test.decoded)) - for i, v := range test.decoded { - interfaceSlice[i] = v - } - encodedCalldata, err := EncodeFromTypes([]StarknetType{test.starknetType}, []interface{}{interfaceSlice}) - assert.Equal(t, nil, err) - assert.Equal(t, test.calldata, encodedCalldata) - assert.Equal(t, 0, len(_calldata)) + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Copy calldata + calldata := make([]*big.Int, len(tt.calldata)) + copy(calldata, tt.calldata) + + // Test decoding + decodedValues, err := DecodeFromTypes([]StarknetType{tt.starknetType}, &calldata) + assert.NoError(t, err, "DecodeFromTypes should not return an error") + assert.Equal(t, tt.decoded, decodedValues[0], "Decoded values should match expected") + //here we check deep equality + + // Test encoding + encodedCalldata, err := EncodeFromTypes([]StarknetType{tt.starknetType}, []interface{}{tt.decoded}) + assert.NoError(t, err, "EncodeFromTypes should not return an error") + assert.Equal(t, tt.calldata, encodedCalldata, "Encoded calldata should match original") + + // Check if calldata is empty after decoding + assert.Empty(t, calldata, "Calldata should be empty after decoding") + }) } } + func TestEnumTypeSerialization(t *testing.T) { variedTypeEnum := StarknetEnum{ Name: "Enum A", @@ -117,3 +151,348 @@ func TestEnumTypeSerialization(t *testing.T) { }) } } + +func TestValidBoolValues(t *testing.T) { + testCases := []struct { + calldata []int64 + decoded bool + }{ + {[]int64{0}, false}, + {[]int64{1}, true}, + } + + for _, tc := range testCases { + calldata := make([]*big.Int, len(tc.calldata)) + for i, v := range tc.calldata { + calldata[i] = big.NewInt(v) + } + + _calldata := make([]*big.Int, len(calldata)) + copy(_calldata, calldata) + + decodedValues, err := DecodeFromTypes([]StarknetType{Bool}, &_calldata) + assert.NoError(t, err) + + encodedCalldata, err := EncodeFromTypes([]StarknetType{Bool}, []interface{}{tc.decoded}) + assert.NoError(t, err) + + assert.Equal(t, tc.decoded, decodedValues[0]) + assert.Equal(t, 1, len(decodedValues)) + assert.Equal(t, calldata, encodedCalldata) + assert.Equal(t, 0, len(_calldata)) + } +} + +func TestLiteralEnum(t *testing.T) { + literalEnum := StarknetEnum{ + Name: "TxStatus", + Variants: []struct { + Name string + Type StarknetType + }{ + {Name: "Submitted", Type: NoneType}, + {Name: "Executed", Type: NoneType}, + {Name: "Finalized", Type: NoneType}, + }, + } + + testCases := []struct { + calldata []int64 + decoded map[string]interface{} + }{ + {[]int64{0}, map[string]interface{}{"Submitted": ""}}, + {[]int64{1}, map[string]interface{}{"Executed": ""}}, + {[]int64{2}, map[string]interface{}{"Finalized": ""}}, + } + + for _, tc := range testCases { + calldata := make([]*big.Int, len(tc.calldata)) + for i, v := range tc.calldata { + calldata[i] = big.NewInt(v) + } + + _calldata := make([]*big.Int, len(calldata)) + copy(_calldata, calldata) + + decodedValues, err := DecodeFromTypes([]StarknetType{literalEnum}, &_calldata) + assert.NoError(t, err) + + encodedCalldata, err := EncodeFromTypes([]StarknetType{literalEnum}, []interface{}{tc.decoded}) + assert.NoError(t, err) + + assert.Equal(t, tc.decoded, decodedValues[0]) + assert.Equal(t, calldata, encodedCalldata) + assert.Equal(t, 0, len(_calldata)) + } +} +func TestHexTypes(t *testing.T) { + testCases := []struct { + starknetType StarknetCoreType + calldata []*big.Int + decoded string + }{ + { + starknetType: Felt, + calldata: []*big.Int{big.NewInt(0x0123456789ABCDEF)}, + decoded: "0x0123456789abcdef", + }, + { + starknetType: ContractAddress, + calldata: func() []*big.Int { + val, _ := new(big.Int).SetString("049D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7", 16) + return []*big.Int{val} + }(), + decoded: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", + }, + { + starknetType: ClassHash, + calldata: func() []*big.Int { + val, _ := new(big.Int).SetString("05FFBCFEB50D200A0677C48A129A11245A3FC519D1D98D76882D1C9A1B19C6ED", 16) + return []*big.Int{val} + }(), + decoded: "0x05ffbcfeb50d200a0677c48a129a11245a3fc519d1d98d76882d1c9a1b19c6ed", + }, + } + + for _, tc := range testCases { + t.Run(tc.starknetType.String(), func(t *testing.T) { + calldata := make([]*big.Int, len(tc.calldata)) + copy(calldata, tc.calldata) + + decodedValues, err := DecodeFromTypes([]StarknetType{tc.starknetType}, &calldata) + assert.NoError(t, err) + + encodedCalldata, err := EncodeFromTypes([]StarknetType{tc.starknetType}, []interface{}{tc.decoded}) + assert.NoError(t, err) + + assert.Equal(t, tc.calldata, encodedCalldata) + assert.Equal(t, tc.decoded, decodedValues[0]) + assert.Len(t, calldata, 0) + }) + } +} + +func TestOptionSerializer(t *testing.T) { + testCases := []struct { + starknetType StarknetType + decoded interface{} + calldata []*big.Int + }{ + { + starknetType: StarknetOption{InnerType: U128}, + decoded: big.NewInt(123), + calldata: []*big.Int{big.NewInt(0), big.NewInt(123)}, + }, + { + starknetType: StarknetOption{InnerType: U256}, + decoded: big.NewInt(1), + calldata: []*big.Int{big.NewInt(0), big.NewInt(1), big.NewInt(0)}, + }, + { + starknetType: StarknetOption{InnerType: U128}, + decoded: nil, + calldata: []*big.Int{big.NewInt(1)}, + }, + { + starknetType: StarknetOption{InnerType: U256}, + decoded: nil, + calldata: []*big.Int{big.NewInt(1)}, + }, + } + + for _, tc := range testCases { + t.Run(tc.starknetType.idStr(), func(t *testing.T) { + calldata := make([]*big.Int, len(tc.calldata)) + copy(calldata, tc.calldata) + + decodedValues, err := DecodeFromTypes([]StarknetType{tc.starknetType}, &calldata) + assert.NoError(t, err) + + encodedCalldata, err := EncodeFromTypes([]StarknetType{tc.starknetType}, []interface{}{tc.decoded}) + assert.NoError(t, err) + + assert.Equal(t, tc.calldata, encodedCalldata) + assert.Equal(t, tc.decoded, decodedValues[0]) + assert.Empty(t, calldata) + }) + } +} + +func TestStructSerializerValidValues(t *testing.T) { + testCases := []struct { + name string + structType StarknetStruct + calldata []*big.Int + decoded map[string]interface{} + }{ + { + name: "CartesianPoint", + structType: StarknetStruct{ + Name: "CartesianPoint", + Members: []AbiParameter{ + {Name: "x", Type: U128}, + {Name: "y", Type: U128}, + }, + }, + calldata: []*big.Int{big.NewInt(1), big.NewInt(2)}, + decoded: map[string]interface{}{ + "x": big.NewInt(1), + "y": big.NewInt(2), + }, + }, + { + name: "Queue", + structType: StarknetStruct{ + Name: "Queue", + Members: []AbiParameter{ + {Name: "head", Type: U8}, + {Name: "items", Type: StarknetArray{InnerType: U128}}, + {Name: "metadata", Type: StarknetStruct{ + Name: "MetaData", + Members: []AbiParameter{ + {Name: "version", Type: U8}, + {Name: "init_timestamp", Type: U64}, + }, + }}, + }, + }, + calldata: []*big.Int{ + big.NewInt(22), big.NewInt(2), big.NewInt(38), big.NewInt(334), + big.NewInt(5), big.NewInt(123456), + }, + decoded: map[string]interface{}{ + "head": big.NewInt(22), + "items": []interface{}{big.NewInt(38), big.NewInt(334)}, + "metadata": map[string]interface{}{ + "version": big.NewInt(5), + "init_timestamp": big.NewInt(123456), + }, + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + calldata := make([]*big.Int, len(tc.calldata)) + copy(calldata, tc.calldata) + + decodedValues, err := DecodeFromTypes([]StarknetType{tc.structType}, &calldata) + assert.NoError(t, err, "DecodeFromTypes should not return an error") + assert.Equal(t, tc.decoded, decodedValues[0], "Decoded values should match expected") + + encodedCalldata, err := EncodeFromTypes([]StarknetType{tc.structType}, []interface{}{tc.decoded}) + assert.NoError(t, err, "EncodeFromTypes should not return an error") + assert.Equal(t, tc.calldata, encodedCalldata, "Encoded calldata should match original") + + assert.Empty(t, calldata, "Calldata should be empty after decoding") + }) + } +} + +func TestTupleValidValues(t *testing.T) { + tests := []struct { + name string + starknetType StarknetType + calldata []*big.Int + decoded interface{} + }{ + { + name: "Simple U32 Tuple", + starknetType: StarknetTuple{Members: []StarknetType{U32, U32}}, + calldata: []*big.Int{big.NewInt(1), big.NewInt(2)}, + decoded: []interface{}{big.NewInt(1), big.NewInt(2)}, + }, + { + name: "U32 and Array Tuple", + starknetType: StarknetTuple{Members: []StarknetType{ + U32, + StarknetArray{InnerType: U32}, + }}, + calldata: []*big.Int{big.NewInt(1), big.NewInt(2), big.NewInt(22), big.NewInt(38)}, + decoded: []interface{}{ + big.NewInt(1), + []interface{}{big.NewInt(22), big.NewInt(38)}, + }, + }, + { + name: "Three Nested Tuples", + starknetType: StarknetTuple{Members: []StarknetType{ + StarknetTuple{Members: []StarknetType{ + StarknetTuple{Members: []StarknetType{U32}}, + }}, + Bool, + }}, + calldata: []*big.Int{big.NewInt(1), big.NewInt(0)}, + decoded: []interface{}{ + []interface{}{ + []interface{}{big.NewInt(1)}, + }, + false, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Copy calldata + calldata := make([]*big.Int, len(tt.calldata)) + copy(calldata, tt.calldata) + + // Test decoding + decodedValues, err := DecodeFromTypes([]StarknetType{tt.starknetType}, &calldata) + assert.NoError(t, err, "DecodeFromTypes should not return an error") + assert.Equal(t, tt.decoded, decodedValues[0], "Decoded values should match expected") + + // Test encoding + encodedCalldata, err := EncodeFromTypes([]StarknetType{tt.starknetType}, []interface{}{tt.decoded}) + assert.NoError(t, err, "EncodeFromTypes should not return an error") + assert.Equal(t, tt.calldata, encodedCalldata, "Encoded calldata should match original") + + // Check if calldata is empty after decoding + assert.Empty(t, calldata, "Calldata should be empty after decoding") + }) + } +} + +func TestBytes31(t *testing.T) { + tests := []struct { + name string + calldata []*big.Int + decoded string + }{ + { + name: "Bytes31 Decoding and Encoding", + calldata: func() []*big.Int { + val, _ := new(big.Int).SetString("3DC782D803B8A574D29E3383A4885EBDDDA9D8D7E15CD5A5F1FB1651EE052E", 16) + return []*big.Int{val} + }(), + decoded: "0x3dc782d803b8a574d29e3383a4885ebddda9d8d7e15cd5a5f1fb1651ee052e", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Copy calldata + calldata := make([]*big.Int, len(tt.calldata)) + copy(calldata, tt.calldata) + + // Test decoding + decodedValues, err := DecodeFromTypes([]StarknetType{Bytes31}, &calldata) + assert.NoError(t, err, "DecodeFromTypes should not return an error") + + assert.Equal(t, 1, len(decodedValues), "Should have one decoded value") + decodedStr, ok := decodedValues[0].(string) + assert.True(t, ok, "Decoded value should be a string") + assert.Equal(t, 62, len(decodedStr[2:]), "Decoded string should have 62 characters (excluding '0x')") + assert.Equal(t, tt.decoded, decodedStr, "Decoded value should match expected") + + // Test encoding + encodedCalldata, err := EncodeFromTypes([]StarknetType{Bytes31}, []interface{}{tt.decoded}) + assert.NoError(t, err, "EncodeFromTypes should not return an error") + assert.Equal(t, tt.calldata, encodedCalldata, "Encoded calldata should match original") + + // Check if calldata is empty after decoding + assert.Empty(t, calldata, "Calldata should be empty after decoding") + }) + } +} diff --git a/athena_abi/decode.go b/athena_abi/decode.go index f465cc45..75fc7846 100644 --- a/athena_abi/decode.go +++ b/athena_abi/decode.go @@ -163,13 +163,15 @@ func DecodeFromTypes(types []StarknetType, callData *[]*big.Int) ([]interface{}, Msg: fmt.Sprintf("not enough calldata to decode %s", starknet_type.idStr()), } } + var arrayItems []interface{} for i := 0; i < int(arrayLen.Int64()); i++ { decoded, err := DecodeFromTypes([]StarknetType{t.InnerType}, callData) if err != nil { return nil, err } - outputData = append(outputData, decoded[0]) + arrayItems = append(arrayItems, decoded[0]) } + outputData = append(outputData, arrayItems) case StarknetOption: optionPresent, err := pop(callData) if err != nil { @@ -207,13 +209,15 @@ func DecodeFromTypes(types []StarknetType, callData *[]*big.Int) ([]interface{}, } outputData = append(outputData, map[string]interface{}{variantName: decoded[0]}) //change made case StarknetTuple: + var tupleItems []interface{} for _, tupleMembers := range t.Members { decoded, err := DecodeFromTypes([]StarknetType{tupleMembers}, callData) if err != nil { return nil, err } - outputData = append(outputData, decoded[0]) + tupleItems = append(tupleItems, decoded[0]) } + outputData = append(outputData, tupleItems) case StarknetNonZero: decoded, err := DecodeFromTypes([]StarknetType{t.InnerType}, callData) if err != nil { From 1640c349ffc8dd966f10b52b90596bb031a6e606 Mon Sep 17 00:00:00 2001 From: rishikpulhani Date: Sat, 21 Sep 2024 03:00:00 +0530 Subject: [PATCH 3/8] partially finished parse_struct_test.go and made some changes in parse.go --- athena_abi/abis/v1/account_compiled.json | 112 ++ athena_abi/abis/v1/argent_v0.json | 537 ++++++ athena_abi/abis/v1/complex_array.json | 428 +++++ athena_abi/abis/v1/contract_abi.json | 329 ++++ athena_abi/abis/v1/erc20_compiled.json | 230 +++ athena_abi/abis/v1/hello_compiled.json | 503 +++++ .../abis/v1/hello_starknet_compiled.json | 25 + athena_abi/abis/v1/legacy_named_tuple.json | 650 +++++++ .../abis/v1/test_contract_compiled.json | 89 + athena_abi/abis/v1/test_option_compiled.json | 62 + athena_abi/abis/v1/token_bridge_compiled.json | 148 ++ athena_abi/abis/v2/abi_types_compiled.json | 105 ++ athena_abi/abis/v2/account_compiled.json | 118 ++ athena_abi/abis/v2/argent_account.json | 895 +++++++++ athena_abi/abis/v2/argent_account_v3.json | 1657 +++++++++++++++++ athena_abi/abis/v2/erc20_compiled.json | 278 +++ athena_abi/abis/v2/erc20_key_events.json | 712 +++++++ athena_abi/abis/v2/hello2_compiled.json | 679 +++++++ .../abis/v2/hello_starknet_compiled.json | 31 + athena_abi/abis/v2/starknet_eth.json | 1029 ++++++++++ athena_abi/abis/v2/starknet_usdc.json | 1029 ++++++++++ athena_abi/abis/v2/storage_address.json | 218 +++ .../abis/v2/test_contract_compiled.json | 135 ++ athena_abi/abis/v2/test_enum_compiled.json | 78 + athena_abi/abis/v2/test_option_compiled.json | 124 ++ athena_abi/abis/v2/token_bridge_compiled.json | 208 +++ athena_abi/parse.go | 60 +- athena_abi/parse_struct_test.go | 143 ++ athena_abi/utils.go | 22 + 29 files changed, 10628 insertions(+), 6 deletions(-) create mode 100644 athena_abi/abis/v1/account_compiled.json create mode 100644 athena_abi/abis/v1/argent_v0.json create mode 100644 athena_abi/abis/v1/complex_array.json create mode 100644 athena_abi/abis/v1/contract_abi.json create mode 100644 athena_abi/abis/v1/erc20_compiled.json create mode 100644 athena_abi/abis/v1/hello_compiled.json create mode 100644 athena_abi/abis/v1/hello_starknet_compiled.json create mode 100644 athena_abi/abis/v1/legacy_named_tuple.json create mode 100644 athena_abi/abis/v1/test_contract_compiled.json create mode 100644 athena_abi/abis/v1/test_option_compiled.json create mode 100644 athena_abi/abis/v1/token_bridge_compiled.json create mode 100644 athena_abi/abis/v2/abi_types_compiled.json create mode 100644 athena_abi/abis/v2/account_compiled.json create mode 100644 athena_abi/abis/v2/argent_account.json create mode 100644 athena_abi/abis/v2/argent_account_v3.json create mode 100644 athena_abi/abis/v2/erc20_compiled.json create mode 100644 athena_abi/abis/v2/erc20_key_events.json create mode 100644 athena_abi/abis/v2/hello2_compiled.json create mode 100644 athena_abi/abis/v2/hello_starknet_compiled.json create mode 100644 athena_abi/abis/v2/starknet_eth.json create mode 100644 athena_abi/abis/v2/starknet_usdc.json create mode 100644 athena_abi/abis/v2/storage_address.json create mode 100644 athena_abi/abis/v2/test_contract_compiled.json create mode 100644 athena_abi/abis/v2/test_enum_compiled.json create mode 100644 athena_abi/abis/v2/test_option_compiled.json create mode 100644 athena_abi/abis/v2/token_bridge_compiled.json create mode 100644 athena_abi/parse_struct_test.go diff --git a/athena_abi/abis/v1/account_compiled.json b/athena_abi/abis/v1/account_compiled.json new file mode 100644 index 00000000..eee22b85 --- /dev/null +++ b/athena_abi/abis/v1/account_compiled.json @@ -0,0 +1,112 @@ +[ + { + "type": "function", + "name": "constructor", + "inputs": [ + { + "name": "public_key_", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "__validate_deploy__", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + }, + { + "name": "contract_address_salt", + "type": "core::felt252" + }, + { + "name": "public_key_", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "__validate_declare__", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "__validate__", + "inputs": [ + { + "name": "contract_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "entry_point_selector", + "type": "core::felt252" + }, + { + "name": "calldata", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "struct", + "name": "account::account::Call", + "members": [ + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "selector", + "type": "core::felt252" + }, + { + "name": "calldata", + "type": "core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "__execute__", + "inputs": [ + { + "name": "calls", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "external" + } +] diff --git a/athena_abi/abis/v1/argent_v0.json b/athena_abi/abis/v1/argent_v0.json new file mode 100644 index 00000000..f868d94d --- /dev/null +++ b/athena_abi/abis/v1/argent_v0.json @@ -0,0 +1,537 @@ +[ + { + "members": [ + { + "name": "to", + "offset": 0, + "type": "felt" + }, + { + "name": "selector", + "offset": 1, + "type": "felt" + }, + { + "name": "data_offset", + "offset": 2, + "type": "felt" + }, + { + "name": "data_len", + "offset": 3, + "type": "felt" + } + ], + "name": "CallArray", + "size": 4, + "type": "struct" + }, + { + "data": [ + { + "name": "new_signer", + "type": "felt" + } + ], + "keys": [], + "name": "signer_changed", + "type": "event" + }, + { + "data": [ + { + "name": "new_guardian", + "type": "felt" + } + ], + "keys": [], + "name": "guardian_changed", + "type": "event" + }, + { + "data": [ + { + "name": "new_guardian", + "type": "felt" + } + ], + "keys": [], + "name": "guardian_backup_changed", + "type": "event" + }, + { + "data": [ + { + "name": "active_at", + "type": "felt" + } + ], + "keys": [], + "name": "escape_guardian_triggered", + "type": "event" + }, + { + "data": [ + { + "name": "active_at", + "type": "felt" + } + ], + "keys": [], + "name": "escape_signer_triggered", + "type": "event" + }, + { + "data": [], + "keys": [], + "name": "escape_canceled", + "type": "event" + }, + { + "data": [ + { + "name": "new_guardian", + "type": "felt" + } + ], + "keys": [], + "name": "guardian_escaped", + "type": "event" + }, + { + "data": [ + { + "name": "new_signer", + "type": "felt" + } + ], + "keys": [], + "name": "signer_escaped", + "type": "event" + }, + { + "data": [ + { + "name": "new_implementation", + "type": "felt" + } + ], + "keys": [], + "name": "account_upgraded", + "type": "event" + }, + { + "data": [ + { + "name": "account", + "type": "felt" + }, + { + "name": "key", + "type": "felt" + }, + { + "name": "guardian", + "type": "felt" + } + ], + "keys": [], + "name": "account_created", + "type": "event" + }, + { + "data": [ + { + "name": "hash", + "type": "felt" + }, + { + "name": "response_len", + "type": "felt" + }, + { + "name": "response", + "type": "felt*" + } + ], + "keys": [], + "name": "transaction_executed", + "type": "event" + }, + { + "inputs": [ + { + "name": "call_array_len", + "type": "felt" + }, + { + "name": "call_array", + "type": "CallArray*" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "__validate__", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "call_array_len", + "type": "felt" + }, + { + "name": "call_array", + "type": "CallArray*" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "__execute__", + "outputs": [ + { + "name": "retdata_size", + "type": "felt" + }, + { + "name": "retdata", + "type": "felt*" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "class_hash", + "type": "felt" + } + ], + "name": "__validate_declare__", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "selector", + "type": "felt" + }, + { + "name": "calldata_size", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "__validate_deploy__", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "hash", + "type": "felt" + }, + { + "name": "sig_len", + "type": "felt" + }, + { + "name": "sig", + "type": "felt*" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "name": "isValid", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "interfaceId", + "type": "felt" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "name": "success", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "signer", + "type": "felt" + }, + { + "name": "guardian", + "type": "felt" + } + ], + "name": "initialize", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "implementation", + "type": "felt" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "upgrade", + "outputs": [ + { + "name": "retdata_len", + "type": "felt" + }, + { + "name": "retdata", + "type": "felt*" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "call_array_len", + "type": "felt" + }, + { + "name": "call_array", + "type": "CallArray*" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "execute_after_upgrade", + "outputs": [ + { + "name": "retdata_len", + "type": "felt" + }, + { + "name": "retdata", + "type": "felt*" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "newSigner", + "type": "felt" + } + ], + "name": "changeSigner", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "newGuardian", + "type": "felt" + } + ], + "name": "changeGuardian", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "newGuardian", + "type": "felt" + } + ], + "name": "changeGuardianBackup", + "outputs": [], + "type": "function" + }, + { + "inputs": [], + "name": "triggerEscapeGuardian", + "outputs": [], + "type": "function" + }, + { + "inputs": [], + "name": "triggerEscapeSigner", + "outputs": [], + "type": "function" + }, + { + "inputs": [], + "name": "cancelEscape", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "newGuardian", + "type": "felt" + } + ], + "name": "escapeGuardian", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "newSigner", + "type": "felt" + } + ], + "name": "escapeSigner", + "outputs": [], + "type": "function" + }, + { + "inputs": [], + "name": "getSigner", + "outputs": [ + { + "name": "signer", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGuardian", + "outputs": [ + { + "name": "guardian", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGuardianBackup", + "outputs": [ + { + "name": "guardianBackup", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEscape", + "outputs": [ + { + "name": "activeAt", + "type": "felt" + }, + { + "name": "type", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVersion", + "outputs": [ + { + "name": "version", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getName", + "outputs": [ + { + "name": "name", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "hash", + "type": "felt" + }, + { + "name": "sig_len", + "type": "felt" + }, + { + "name": "sig", + "type": "felt*" + } + ], + "name": "is_valid_signature", + "outputs": [ + { + "name": "is_valid", + "type": "felt" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/athena_abi/abis/v1/complex_array.json b/athena_abi/abis/v1/complex_array.json new file mode 100644 index 00000000..3b43a311 --- /dev/null +++ b/athena_abi/abis/v1/complex_array.json @@ -0,0 +1,428 @@ +[ + { + "members": [ + { + "name": "index", + "offset": 0, + "type": "felt" + }, + { + "name": "values", + "offset": 1, + "type": "(felt, felt)" + } + ], + "name": "IndexAndValues", + "size": 3, + "type": "struct" + }, + { + "members": [ + { + "name": "key", + "offset": 0, + "type": "felt" + }, + { + "name": "value", + "offset": 1, + "type": "felt" + } + ], + "name": "StorageCell", + "size": 2, + "type": "struct" + }, + { + "inputs": [ + { + "name": "index", + "type": "felt" + }, + { + "name": "diffs_len", + "type": "felt" + }, + { + "name": "diffs", + "type": "felt*" + } + ], + "name": "advance_counter", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "constructor", + "outputs": [], + "type": "constructor" + }, + { + "inputs": [ + { + "name": "index_and_x", + "type": "IndexAndValues" + } + ], + "name": "xor_counters", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + }, + { + "name": "index_and_x", + "type": "IndexAndValues" + } + ], + "name": "call_xor_counters", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "index", + "type": "felt" + } + ], + "name": "add_signature_to_counters", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "set_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + } + ], + "name": "get_value", + "outputs": [ + { + "name": "res", + "type": "felt" + } + ], + "type": "function" + }, + { + "inputs": [], + "name": "entry_point", + "outputs": [], + "type": "function" + }, + { + "inputs": [], + "name": "test_builtins", + "outputs": [ + { + "name": "result", + "type": "felt" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "to_address", + "type": "felt" + } + ], + "name": "send_message", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "keys_len", + "type": "felt" + }, + { + "name": "keys", + "type": "felt*" + }, + { + "name": "data_len", + "type": "felt" + }, + { + "name": "data", + "type": "felt*" + } + ], + "name": "test_emit_event", + "outputs": [], + "type": "function" + }, + { + "data": [ + { + "name": "storage_cells_len", + "type": "felt" + }, + { + "name": "storage_cells", + "type": "StorageCell*" + } + ], + "keys": [], + "name": "log_storage_cells", + "type": "event" + }, + { + "inputs": [ + { + "name": "storage_cells_len", + "type": "felt" + }, + { + "name": "storage_cells", + "type": "StorageCell*" + } + ], + "name": "test_high_level_event", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "contract_address", + "type": "felt" + }, + { + "name": "function_selector", + "type": "felt" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "test_call_contract", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "from_address", + "type": "felt" + }, + { + "name": "amount", + "type": "felt" + } + ], + "name": "deposit", + "outputs": [], + "type": "l1_handler" + }, + { + "inputs": [ + { + "name": "expected_address", + "type": "felt" + } + ], + "name": "test_get_caller_address", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_address", + "type": "felt" + } + ], + "name": "test_get_sequencer_address", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_timestamp", + "type": "felt" + } + ], + "name": "test_get_block_timestamp", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_address", + "type": "felt" + } + ], + "name": "test_get_contract_address", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_block_number", + "type": "felt" + } + ], + "name": "test_get_block_number", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "other_contract_address", + "type": "felt" + }, + { + "name": "address", + "type": "felt" + } + ], + "name": "test_call_storage_consistency", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "other_contract_address", + "type": "felt" + }, + { + "name": "depth", + "type": "felt" + } + ], + "name": "test_re_entrance", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "value", + "type": "felt" + } + ], + "name": "add_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "self_address", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "recursive_add_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + } + ], + "name": "increase_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "self_address", + "type": "felt" + }, + { + "name": "arr_len", + "type": "felt" + }, + { + "name": "arr", + "type": "felt*" + } + ], + "name": "test_call_with_array", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "self_address", + "type": "felt" + }, + { + "name": "arr_len", + "type": "felt" + }, + { + "name": "arr", + "type": "StorageCell*" + } + ], + "name": "test_call_with_struct_array", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "other_contract_address", + "type": "felt" + } + ], + "name": "test_delegate_call_syntactic_sugar", + "outputs": [], + "type": "function" + } +] \ No newline at end of file diff --git a/athena_abi/abis/v1/contract_abi.json b/athena_abi/abis/v1/contract_abi.json new file mode 100644 index 00000000..d5e95cfb --- /dev/null +++ b/athena_abi/abis/v1/contract_abi.json @@ -0,0 +1,329 @@ +[ + { + "members": [ + { + "name": "index", + "offset": 0, + "type": "felt" + }, + { + "name": "values", + "offset": 1, + "type": "(felt, felt)" + } + ], + "name": "IndexAndValues", + "size": 3, + "type": "struct" + }, + { + "inputs": [ + { + "name": "index", + "type": "felt" + }, + { + "name": "diffs_len", + "type": "felt" + }, + { + "name": "diffs", + "type": "felt*" + } + ], + "name": "advance_counter", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "constructor", + "outputs": [], + "type": "constructor" + }, + { + "inputs": [ + { + "name": "index_and_x", + "type": "IndexAndValues" + } + ], + "name": "xor_counters", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + }, + { + "name": "index_and_x", + "type": "IndexAndValues" + } + ], + "name": "call_xor_counters", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "index", + "type": "felt" + } + ], + "name": "add_signature_to_counters", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "set_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + } + ], + "name": "get_value", + "outputs": [ + { + "name": "res", + "type": "felt" + } + ], + "type": "function" + }, + { + "inputs": [], + "name": "entry_point", + "outputs": [], + "type": "function" + }, + { + "inputs": [], + "name": "test_builtins", + "outputs": [ + { + "name": "result", + "type": "felt" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "to_address", + "type": "felt" + } + ], + "name": "send_message", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "contract_address", + "type": "felt" + }, + { + "name": "function_selector", + "type": "felt" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "test_call_contract", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "contract_address", + "type": "felt" + }, + { + "name": "function_selector", + "type": "felt" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "test_delegate_call", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "from_address", + "type": "felt" + }, + { + "name": "amount", + "type": "felt" + } + ], + "name": "deposit", + "outputs": [], + "type": "l1_handler" + }, + { + "inputs": [ + { + "name": "expected_address", + "type": "felt" + } + ], + "name": "test_get_caller_address", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_address", + "type": "felt" + } + ], + "name": "test_get_sequencer_address", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_address", + "type": "felt" + } + ], + "name": "test_get_contract_address", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "other_contract_address", + "type": "felt" + }, + { + "name": "address", + "type": "felt" + } + ], + "name": "test_call_storage_consistency", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "other_contract_address", + "type": "felt" + }, + { + "name": "depth", + "type": "felt" + } + ], + "name": "test_re_entrance", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "value", + "type": "felt" + } + ], + "name": "add_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "self_address", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "recursive_add_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + } + ], + "name": "increase_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "self_address", + "type": "felt" + }, + { + "name": "arr_len", + "type": "felt" + }, + { + "name": "arr", + "type": "felt*" + } + ], + "name": "test_call_with_array", + "outputs": [], + "type": "function" + } +] \ No newline at end of file diff --git a/athena_abi/abis/v1/erc20_compiled.json b/athena_abi/abis/v1/erc20_compiled.json new file mode 100644 index 00000000..dd5d898b --- /dev/null +++ b/athena_abi/abis/v1/erc20_compiled.json @@ -0,0 +1,230 @@ +[ + { + "type": "function", + "name": "constructor", + "inputs": [ + { + "name": "name_", + "type": "core::felt252" + }, + { + "name": "symbol_", + "type": "core::felt252" + }, + { + "name": "decimals_", + "type": "core::integer::u8" + }, + { + "name": "initial_supply", + "type": "core::integer::u256" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_symbol", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_decimals", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_total_supply", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "balance_of", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "allowance", + "inputs": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "transfer", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "transfer_from", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "increase_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "added_value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "decrease_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtracted_value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "event", + "name": "Transfer", + "inputs": [ + { + "name": "from", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ] + } +] diff --git a/athena_abi/abis/v1/hello_compiled.json b/athena_abi/abis/v1/hello_compiled.json new file mode 100644 index 00000000..3ab23f6c --- /dev/null +++ b/athena_abi/abis/v1/hello_compiled.json @@ -0,0 +1,503 @@ +[ + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "function", + "name": "increase_balance", + "inputs": [ + { + "name": "amount", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_balance", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_status", + "inputs": [ + { + "name": "new_status", + "type": "core::bool" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_status", + "inputs": [], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_ca", + "inputs": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_ca", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "increase_balance_u8", + "inputs": [ + { + "name": "amount", + "type": "core::integer::u8" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_balance_u8", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u16", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u16" + } + ], + "outputs": [ + { + "type": "core::integer::u16" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u32", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u32" + } + ], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u64", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u128", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u128" + } + ], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u256", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "echo_array", + "inputs": [ + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "echo_array_u256", + "inputs": [ + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "echo_array_bool", + "inputs": [ + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "echo_un_tuple", + "inputs": [ + { + "name": "a", + "type": "(core::felt252, core::integer::u16)" + } + ], + "outputs": [ + { + "type": "(core::felt252, core::integer::u16)" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "hello::hello::Foo", + "members": [ + { + "name": "val", + "type": "core::felt252" + } + ] + }, + { + "type": "function", + "name": "echo_struct", + "inputs": [ + { + "name": "tt", + "type": "hello::hello::Foo" + } + ], + "outputs": [ + { + "type": "hello::hello::Foo" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_bet", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "struct", + "name": "hello::hello::Bet", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "description", + "type": "core::felt252" + }, + { + "name": "expire_date", + "type": "core::integer::u64" + }, + { + "name": "creation_time", + "type": "core::integer::u64" + }, + { + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "is_cancelled", + "type": "core::bool" + }, + { + "name": "is_voted", + "type": "core::bool" + }, + { + "name": "bettor", + "type": "hello::hello::UserData" + }, + { + "name": "counter_bettor", + "type": "hello::hello::UserData" + }, + { + "name": "winner", + "type": "core::bool" + }, + { + "name": "pool", + "type": "core::integer::u256" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ] + }, + { + "type": "function", + "name": "get_bet", + "inputs": [ + { + "name": "test", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "hello::hello::Bet" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "hello::hello::UserData", + "members": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "is_claimed", + "type": "core::bool" + } + ] + }, + { + "type": "function", + "name": "set_user1", + "inputs": [ + { + "name": "user", + "type": "hello::hello::UserData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_user1", + "inputs": [], + "outputs": [ + { + "type": "hello::hello::UserData" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_user", + "inputs": [], + "outputs": [ + { + "type": "hello::hello::UserData" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "array2d_ex", + "inputs": [ + { + "name": "test", + "type": "core::array::Array::>" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "array2d_array", + "inputs": [ + { + "name": "test", + "type": "core::array::Array::>" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "array2d_felt", + "inputs": [ + { + "name": "test", + "type": "core::array::Array::>" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "tuple_echo", + "inputs": [ + { + "name": "a", + "type": "(core::array::Array::, core::array::Array::)" + } + ], + "outputs": [ + { + "type": "(core::array::Array::, core::array::Array::)" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "array_bool_tuple", + "inputs": [ + { + "name": "a", + "type": "core::array::Array::" + }, + { + "name": "b", + "type": "core::bool" + } + ], + "outputs": [ + { + "type": "(core::array::Array::, core::bool)" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "array2ddd_felt", + "inputs": [ + { + "name": "testdd", + "type": "core::array::Array::>" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } +] diff --git a/athena_abi/abis/v1/hello_starknet_compiled.json b/athena_abi/abis/v1/hello_starknet_compiled.json new file mode 100644 index 00000000..03d00bbe --- /dev/null +++ b/athena_abi/abis/v1/hello_starknet_compiled.json @@ -0,0 +1,25 @@ +[ + { + "type": "function", + "name": "increase_balance", + "inputs": [ + { + "name": "amount", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_balance", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } +] diff --git a/athena_abi/abis/v1/legacy_named_tuple.json b/athena_abi/abis/v1/legacy_named_tuple.json new file mode 100644 index 00000000..7bddb219 --- /dev/null +++ b/athena_abi/abis/v1/legacy_named_tuple.json @@ -0,0 +1,650 @@ +[ + { + "members": [ + { + "name": "index", + "offset": 0, + "type": "felt" + }, + { + "name": "values", + "offset": 1, + "type": "(x: felt, y: felt)" + } + ], + "name": "IndexAndValues", + "size": 3, + "type": "struct" + }, + { + "members": [ + { + "name": "key", + "offset": 0, + "type": "felt" + }, + { + "name": "value", + "offset": 1, + "type": "felt" + } + ], + "name": "StorageCell", + "size": 2, + "type": "struct" + }, + { + "inputs": [ + { + "name": "index", + "type": "felt" + }, + { + "name": "diffs_len", + "type": "felt" + }, + { + "name": "diffs", + "type": "felt*" + } + ], + "name": "advance_counter", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "constructor", + "outputs": [], + "type": "constructor" + }, + { + "inputs": [ + { + "name": "index_and_x", + "type": "IndexAndValues" + } + ], + "name": "xor_counters", + "outputs": [], + "type": "function" + }, + { + "inputs": [], + "name": "foo", + "outputs": [ + { + "name": "res", + "type": "felt" + } + ], + "type": "function" + }, + { + "inputs": [], + "name": "test_ec_op", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + }, + { + "name": "index_and_x", + "type": "IndexAndValues" + } + ], + "name": "call_xor_counters", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "index", + "type": "felt" + } + ], + "name": "add_signature_to_counters", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "set_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + } + ], + "name": "get_value", + "outputs": [ + { + "name": "res", + "type": "felt" + } + ], + "type": "function" + }, + { + "inputs": [], + "name": "entry_point", + "outputs": [], + "type": "function" + }, + { + "inputs": [], + "name": "test_builtins", + "outputs": [ + { + "name": "result", + "type": "felt" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "to_address", + "type": "felt" + } + ], + "name": "send_message", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "keys_len", + "type": "felt" + }, + { + "name": "keys", + "type": "felt*" + }, + { + "name": "data_len", + "type": "felt" + }, + { + "name": "data", + "type": "felt*" + } + ], + "name": "test_emit_event", + "outputs": [], + "type": "function" + }, + { + "data": [ + { + "name": "storage_cells_len", + "type": "felt" + }, + { + "name": "storage_cells", + "type": "StorageCell*" + } + ], + "keys": [], + "name": "log_storage_cells", + "type": "event" + }, + { + "inputs": [ + { + "name": "storage_cells_len", + "type": "felt" + }, + { + "name": "storage_cells", + "type": "StorageCell*" + } + ], + "name": "test_high_level_event", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "contract_address", + "type": "felt" + }, + { + "name": "function_selector", + "type": "felt" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "test_call_contract", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "class_hash", + "type": "felt" + }, + { + "name": "contract_address_salt", + "type": "felt" + }, + { + "name": "constructor_calldata_len", + "type": "felt" + }, + { + "name": "constructor_calldata", + "type": "felt*" + } + ], + "name": "test_deploy", + "outputs": [ + { + "name": "contract_address", + "type": "felt" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "class_hash", + "type": "felt" + }, + { + "name": "contract_address_salt", + "type": "felt" + }, + { + "name": "deploy_from_zero", + "type": "felt" + }, + { + "name": "constructor_calldata_len", + "type": "felt" + }, + { + "name": "constructor_calldata", + "type": "felt*" + }, + { + "name": "key", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "test_deploy_and_call", + "outputs": [ + { + "name": "contract_address", + "type": "felt" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "from_address", + "type": "felt" + }, + { + "name": "amount", + "type": "felt" + } + ], + "name": "deposit", + "outputs": [], + "type": "l1_handler" + }, + { + "inputs": [ + { + "name": "expected_address", + "type": "felt" + } + ], + "name": "test_get_caller_address", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_address", + "type": "felt" + } + ], + "name": "test_get_sequencer_address", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_timestamp", + "type": "felt" + } + ], + "name": "test_get_block_timestamp", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_address", + "type": "felt" + } + ], + "name": "test_get_contract_address", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_block_number", + "type": "felt" + } + ], + "name": "test_get_block_number", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "other_contract_address", + "type": "felt" + }, + { + "name": "address", + "type": "felt" + } + ], + "name": "test_call_storage_consistency", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "other_contract_address", + "type": "felt" + }, + { + "name": "depth", + "type": "felt" + } + ], + "name": "test_re_entrance", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "value", + "type": "felt" + } + ], + "name": "add_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "self_address", + "type": "felt" + }, + { + "name": "value", + "type": "felt" + } + ], + "name": "recursive_add_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "address", + "type": "felt" + } + ], + "name": "increase_value", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "self_address", + "type": "felt" + }, + { + "name": "arr_len", + "type": "felt" + }, + { + "name": "arr", + "type": "felt*" + } + ], + "name": "test_call_with_array", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "self_address", + "type": "felt" + }, + { + "name": "arr_len", + "type": "felt" + }, + { + "name": "arr", + "type": "StorageCell*" + } + ], + "name": "test_call_with_struct_array", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "class_hash", + "type": "felt" + } + ], + "name": "test_library_call_syntactic_sugar", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_account_contract_address", + "type": "felt" + } + ], + "name": "test_get_tx_info", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "expected_version", + "type": "felt" + } + ], + "name": "test_tx_version", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "code_address", + "type": "felt" + }, + { + "name": "selector", + "type": "felt" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "test_delegate_call", + "outputs": [ + { + "name": "retdata_size", + "type": "felt" + }, + { + "name": "retdata", + "type": "felt*" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "class_hash", + "type": "felt" + }, + { + "name": "selector", + "type": "felt" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "test_library_call", + "outputs": [ + { + "name": "retdata_size", + "type": "felt" + }, + { + "name": "retdata", + "type": "felt*" + } + ], + "type": "function" + }, + { + "inputs": [ + { + "name": "class_hash", + "type": "felt" + }, + { + "name": "selector", + "type": "felt" + }, + { + "name": "calldata_len", + "type": "felt" + }, + { + "name": "calldata", + "type": "felt*" + } + ], + "name": "test_library_call_l1_handler", + "outputs": [], + "type": "function" + }, + { + "inputs": [], + "name": "test_count_actual_storage_changes", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "class_hash", + "type": "felt" + } + ], + "name": "test_replace_class", + "outputs": [], + "type": "function" + }, + { + "inputs": [ + { + "name": "class_hash", + "type": "felt" + } + ], + "name": "execute_replace_class", + "outputs": [], + "type": "function" + } +] \ No newline at end of file diff --git a/athena_abi/abis/v1/test_contract_compiled.json b/athena_abi/abis/v1/test_contract_compiled.json new file mode 100644 index 00000000..3f1b5de3 --- /dev/null +++ b/athena_abi/abis/v1/test_contract_compiled.json @@ -0,0 +1,89 @@ +[ + { + "type": "function", + "name": "test", + "inputs": [ + { + "name": "arg", + "type": "core::felt252" + }, + { + "name": "arg1", + "type": "core::felt252" + }, + { + "name": "arg2", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "call_foo", + "inputs": [ + { + "name": "another_contract_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "a", + "type": "core::integer::u128" + } + ], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "libcall_foo", + "inputs": [ + { + "name": "a", + "type": "core::integer::u128" + } + ], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "segment_arena_builtin", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "l1_handle", + "inputs": [ + { + "name": "from_address", + "type": "core::felt252" + }, + { + "name": "arg", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + } +] diff --git a/athena_abi/abis/v1/test_option_compiled.json b/athena_abi/abis/v1/test_option_compiled.json new file mode 100644 index 00000000..ff0a0c99 --- /dev/null +++ b/athena_abi/abis/v1/test_option_compiled.json @@ -0,0 +1,62 @@ +[ + { + "type": "struct", + "name": "test_option::test_option::OptionStruct", + "members": [ + { + "name": "first_field", + "type": "core::felt252" + }, + { + "name": "second_field", + "type": "core::option::Option::" + }, + { + "name": "third_field", + "type": "core::option::Option::" + }, + { + "name": "fourth_field", + "type": "core::felt252" + } + ] + }, + { + "type": "function", + "name": "receive_and_send_option_struct", + "inputs": [ + { + "name": "option_struct", + "type": "test_option::test_option::OptionStruct" + } + ], + "outputs": [ + { + "type": "test_option::test_option::OptionStruct" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_option_struct", + "inputs": [], + "outputs": [ + { + "type": "test_option::test_option::OptionStruct" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_empty_option", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::<()>" + } + ], + "state_mutability": "view" + } +] diff --git a/athena_abi/abis/v1/token_bridge_compiled.json b/athena_abi/abis/v1/token_bridge_compiled.json new file mode 100644 index 00000000..5267cce8 --- /dev/null +++ b/athena_abi/abis/v1/token_bridge_compiled.json @@ -0,0 +1,148 @@ +[ + { + "type": "function", + "name": "get_version", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_identity", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "constructor", + "inputs": [ + { + "name": "governor_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "set_l1_bridge", + "inputs": [ + { + "name": "l1_bridge_address", + "type": "core::starknet::eth_address::EthAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "set_l2_token", + "inputs": [ + { + "name": "l2_token_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "initiate_withdraw", + "inputs": [ + { + "name": "l1_recipient", + "type": "core::starknet::eth_address::EthAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "handle_deposit", + "inputs": [ + { + "name": "from_address", + "type": "core::felt252" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "event", + "name": "l1_bridge_set", + "inputs": [ + { + "name": "l1_bridge_address", + "type": "core::starknet::eth_address::EthAddress" + } + ] + }, + { + "type": "event", + "name": "l2_token_set", + "inputs": [ + { + "name": "l2_token_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "event", + "name": "withdraw_initiated", + "inputs": [ + { + "name": "l1_recipient", + "type": "core::starknet::eth_address::EthAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + }, + { + "name": "caller_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "event", + "name": "deposit_handled", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ] + } +] diff --git a/athena_abi/abis/v2/abi_types_compiled.json b/athena_abi/abis/v2/abi_types_compiled.json new file mode 100644 index 00000000..3faa7728 --- /dev/null +++ b/athena_abi/abis/v2/abi_types_compiled.json @@ -0,0 +1,105 @@ +[ + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "enum", + "name": "abi_types::abi_types::AbiTypes::ExampleEnum", + "variants": [ + { + "name": "variant_a", + "type": "core::felt252" + }, + { + "name": "variant_b", + "type": "core::integer::u256" + } + ] + }, + { + "type": "function", + "name": "example_view_function", + "inputs": [], + "outputs": [ + { + "type": "abi_types::abi_types::AbiTypes::ExampleEnum" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "abi_types::abi_types::AbiTypes::ExampleStruct", + "members": [ + { + "name": "field_a", + "type": "core::felt252" + }, + { + "name": "field_b", + "type": "core::felt252" + }, + { + "name": "field_c", + "type": "abi_types::abi_types::AbiTypes::ExampleEnum" + }, + { + "name": "field_d", + "type": "()" + } + ] + }, + { + "type": "function", + "name": "example_external_function", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "abi_types::abi_types::AbiTypes::ExampleStruct" + } + ], + "state_mutability": "external" + }, + { + "type": "l1_handler", + "name": "example_l1_handler", + "inputs": [ + { + "name": "from_address", + "type": "core::felt252" + }, + { + "name": "arg1", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "event", + "name": "abi_types::abi_types::AbiTypes::Event", + "kind": "enum", + "variants": [] + } +] diff --git a/athena_abi/abis/v2/account_compiled.json b/athena_abi/abis/v2/account_compiled.json new file mode 100644 index 00000000..e2101df2 --- /dev/null +++ b/athena_abi/abis/v2/account_compiled.json @@ -0,0 +1,118 @@ +[ + { + "type": "function", + "name": "__validate_declare__", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::starknet::account::Call", + "members": [ + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "selector", + "type": "core::felt252" + }, + { + "name": "calldata", + "type": "core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "__validate__", + "inputs": [ + { + "name": "calls", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "__execute__", + "inputs": [ + { + "name": "calls", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "public_key_", + "type": "core::felt252" + } + ] + }, + { + "type": "function", + "name": "__validate_deploy__", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + }, + { + "name": "contract_address_salt", + "type": "core::felt252" + }, + { + "name": "public_key_", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "account::account::account::Event", + "kind": "enum", + "variants": [] + } +] diff --git a/athena_abi/abis/v2/argent_account.json b/athena_abi/abis/v2/argent_account.json new file mode 100644 index 00000000..0200f896 --- /dev/null +++ b/athena_abi/abis/v2/argent_account.json @@ -0,0 +1,895 @@ +[ + { + "type": "struct", + "name": "core::starknet::account::Call", + "members": [ + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "selector", + "type": "core::felt252" + }, + { + "name": "calldata", + "type": "core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "__validate__", + "inputs": [ + { + "name": "calls", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "function", + "name": "__execute__", + "inputs": [ + { + "name": "calls", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "is_valid_signature", + "inputs": [ + { + "name": "hash", + "type": "core::felt252" + }, + { + "name": "signature", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "impl", + "name": "ExecuteFromOutsideImpl", + "interface_name": "lib::outside_execution::IOutsideExecution" + }, + { + "type": "struct", + "name": "lib::outside_execution::OutsideExecution", + "members": [ + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "nonce", + "type": "core::felt252" + }, + { + "name": "execute_after", + "type": "core::integer::u64" + }, + { + "name": "execute_before", + "type": "core::integer::u64" + }, + { + "name": "calls", + "type": "core::array::Span::" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "interface", + "name": "lib::outside_execution::IOutsideExecution", + "items": [ + { + "type": "function", + "name": "execute_from_outside", + "inputs": [ + { + "name": "outside_execution", + "type": "lib::outside_execution::OutsideExecution" + }, + { + "name": "signature", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "is_valid_outside_execution_nonce", + "inputs": [ + { + "name": "nonce", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_outside_execution_message_hash", + "inputs": [ + { + "name": "outside_execution", + "type": "lib::outside_execution::OutsideExecution" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "UpgradeableImpl", + "interface_name": "lib::upgrade::IUpgradeable" + }, + { + "type": "interface", + "name": "lib::upgrade::IUpgradeable", + "items": [ + { + "type": "function", + "name": "upgrade", + "inputs": [ + { + "name": "new_implementation", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "calldata", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "execute_after_upgrade", + "inputs": [ + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "ArgentAccountImpl", + "interface_name": "account::interface::IArgentAccount" + }, + { + "type": "struct", + "name": "account::escape::Escape", + "members": [ + { + "name": "ready_at", + "type": "core::integer::u64" + }, + { + "name": "escape_type", + "type": "core::felt252" + }, + { + "name": "new_signer", + "type": "core::felt252" + } + ] + }, + { + "type": "struct", + "name": "lib::version::Version", + "members": [ + { + "name": "major", + "type": "core::integer::u8" + }, + { + "name": "minor", + "type": "core::integer::u8" + }, + { + "name": "patch", + "type": "core::integer::u8" + } + ] + }, + { + "type": "enum", + "name": "account::escape::EscapeStatus", + "variants": [ + { + "name": "None", + "type": "()" + }, + { + "name": "NotReady", + "type": "()" + }, + { + "name": "Ready", + "type": "()" + }, + { + "name": "Expired", + "type": "()" + } + ] + }, + { + "type": "interface", + "name": "account::interface::IArgentAccount", + "items": [ + { + "type": "function", + "name": "__validate_declare__", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "__validate_deploy__", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + }, + { + "name": "contract_address_salt", + "type": "core::felt252" + }, + { + "name": "owner", + "type": "core::felt252" + }, + { + "name": "guardian", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "change_owner", + "inputs": [ + { + "name": "new_owner", + "type": "core::felt252" + }, + { + "name": "signature_r", + "type": "core::felt252" + }, + { + "name": "signature_s", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "change_guardian", + "inputs": [ + { + "name": "new_guardian", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "change_guardian_backup", + "inputs": [ + { + "name": "new_guardian_backup", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "trigger_escape_owner", + "inputs": [ + { + "name": "new_owner", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "trigger_escape_guardian", + "inputs": [ + { + "name": "new_guardian", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "escape_owner", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "escape_guardian", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "cancel_escape", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_owner", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_guardian", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_guardian_backup", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_escape", + "inputs": [], + "outputs": [ + { + "type": "account::escape::Escape" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_version", + "inputs": [], + "outputs": [ + { + "type": "lib::version::Version" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_guardian_escape_attempts", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_owner_escape_attempts", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_escape_and_status", + "inputs": [], + "outputs": [ + { + "type": "(account::escape::Escape, account::escape::EscapeStatus)" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "Erc165Impl", + "interface_name": "lib::erc165::IErc165" + }, + { + "type": "interface", + "name": "lib::erc165::IErc165", + "items": [ + { + "type": "function", + "name": "supports_interface", + "inputs": [ + { + "name": "interface_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "OldArgentAccountImpl", + "interface_name": "account::interface::IDeprecatedArgentAccount" + }, + { + "type": "interface", + "name": "account::interface::IDeprecatedArgentAccount", + "items": [ + { + "type": "function", + "name": "getVersion", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "getName", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interface_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "isValidSignature", + "inputs": [ + { + "name": "hash", + "type": "core::felt252" + }, + { + "name": "signatures", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "owner", + "type": "core::felt252" + }, + { + "name": "guardian", + "type": "core::felt252" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::AccountCreated", + "kind": "struct", + "members": [ + { + "name": "owner", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "guardian", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::>" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::TransactionExecuted", + "kind": "struct", + "members": [ + { + "name": "hash", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "response", + "type": "core::array::Span::>", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::EscapeOwnerTriggered", + "kind": "struct", + "members": [ + { + "name": "ready_at", + "type": "core::integer::u64", + "kind": "data" + }, + { + "name": "new_owner", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::EscapeGuardianTriggered", + "kind": "struct", + "members": [ + { + "name": "ready_at", + "type": "core::integer::u64", + "kind": "data" + }, + { + "name": "new_guardian", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::OwnerEscaped", + "kind": "struct", + "members": [ + { + "name": "new_owner", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::GuardianEscaped", + "kind": "struct", + "members": [ + { + "name": "new_guardian", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::EscapeCanceled", + "kind": "struct", + "members": [] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::OwnerChanged", + "kind": "struct", + "members": [ + { + "name": "new_owner", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::GuardianChanged", + "kind": "struct", + "members": [ + { + "name": "new_guardian", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::GuardianBackupChanged", + "kind": "struct", + "members": [ + { + "name": "new_guardian_backup", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::AccountUpgraded", + "kind": "struct", + "members": [ + { + "name": "new_implementation", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::OwnerAdded", + "kind": "struct", + "members": [ + { + "name": "new_owner_guid", + "type": "core::felt252", + "kind": "key" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::OwnerRemoved", + "kind": "struct", + "members": [ + { + "name": "removed_owner_guid", + "type": "core::felt252", + "kind": "key" + } + ] + }, + { + "type": "event", + "name": "account::argent_account::ArgentAccount::Event", + "kind": "enum", + "variants": [ + { + "name": "AccountCreated", + "type": "account::argent_account::ArgentAccount::AccountCreated", + "kind": "nested" + }, + { + "name": "TransactionExecuted", + "type": "account::argent_account::ArgentAccount::TransactionExecuted", + "kind": "nested" + }, + { + "name": "EscapeOwnerTriggered", + "type": "account::argent_account::ArgentAccount::EscapeOwnerTriggered", + "kind": "nested" + }, + { + "name": "EscapeGuardianTriggered", + "type": "account::argent_account::ArgentAccount::EscapeGuardianTriggered", + "kind": "nested" + }, + { + "name": "OwnerEscaped", + "type": "account::argent_account::ArgentAccount::OwnerEscaped", + "kind": "nested" + }, + { + "name": "GuardianEscaped", + "type": "account::argent_account::ArgentAccount::GuardianEscaped", + "kind": "nested" + }, + { + "name": "EscapeCanceled", + "type": "account::argent_account::ArgentAccount::EscapeCanceled", + "kind": "nested" + }, + { + "name": "OwnerChanged", + "type": "account::argent_account::ArgentAccount::OwnerChanged", + "kind": "nested" + }, + { + "name": "GuardianChanged", + "type": "account::argent_account::ArgentAccount::GuardianChanged", + "kind": "nested" + }, + { + "name": "GuardianBackupChanged", + "type": "account::argent_account::ArgentAccount::GuardianBackupChanged", + "kind": "nested" + }, + { + "name": "AccountUpgraded", + "type": "account::argent_account::ArgentAccount::AccountUpgraded", + "kind": "nested" + }, + { + "name": "OwnerAdded", + "type": "account::argent_account::ArgentAccount::OwnerAdded", + "kind": "nested" + }, + { + "name": "OwnerRemoved", + "type": "account::argent_account::ArgentAccount::OwnerRemoved", + "kind": "nested" + } + ] + } +] diff --git a/athena_abi/abis/v2/argent_account_v3.json b/athena_abi/abis/v2/argent_account_v3.json new file mode 100644 index 00000000..bc2242e9 --- /dev/null +++ b/athena_abi/abis/v2/argent_account_v3.json @@ -0,0 +1,1657 @@ +[ + { + "type": "impl", + "name": "AccountImpl", + "interface_name": "argent::account::interface::IAccount" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::starknet::account::Call", + "members": [ + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "selector", + "type": "core::felt252" + }, + { + "name": "calldata", + "type": "core::array::Span::" + } + ] + }, + { + "type": "interface", + "name": "argent::account::interface::IAccount", + "items": [ + { + "type": "function", + "name": "__validate__", + "inputs": [ + { + "name": "calls", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "__execute__", + "inputs": [ + { + "name": "calls", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "is_valid_signature", + "inputs": [ + { + "name": "hash", + "type": "core::felt252" + }, + { + "name": "signature", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "UpgradeableCallbackOldImpl", + "interface_name": "argent::upgrade::interface::IUpgradableCallbackOld" + }, + { + "type": "interface", + "name": "argent::upgrade::interface::IUpgradableCallbackOld", + "items": [ + { + "type": "function", + "name": "execute_after_upgrade", + "inputs": [ + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "UpgradeableCallbackImpl", + "interface_name": "argent::upgrade::interface::IUpgradableCallback" + }, + { + "type": "interface", + "name": "argent::upgrade::interface::IUpgradableCallback", + "items": [ + { + "type": "function", + "name": "perform_upgrade", + "inputs": [ + { + "name": "new_implementation", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "data", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "ArgentUserAccountImpl", + "interface_name": "argent::account::interface::IArgentUserAccount" + }, + { + "type": "struct", + "name": "argent::signer::signer_signature::StarknetSigner", + "members": [ + { + "name": "pubkey", + "type": "core::zeroable::NonZero::" + } + ] + }, + { + "type": "struct", + "name": "core::starknet::eth_address::EthAddress", + "members": [ + { + "name": "address", + "type": "core::felt252" + } + ] + }, + { + "type": "struct", + "name": "argent::signer::signer_signature::Secp256k1Signer", + "members": [ + { + "name": "pubkey_hash", + "type": "core::starknet::eth_address::EthAddress" + } + ] + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "struct", + "name": "argent::signer::signer_signature::Secp256r1Signer", + "members": [ + { + "name": "pubkey", + "type": "core::zeroable::NonZero::" + } + ] + }, + { + "type": "struct", + "name": "argent::signer::signer_signature::Eip191Signer", + "members": [ + { + "name": "eth_address", + "type": "core::starknet::eth_address::EthAddress" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "argent::signer::signer_signature::WebauthnSigner", + "members": [ + { + "name": "origin", + "type": "core::array::Span::" + }, + { + "name": "rp_id_hash", + "type": "core::zeroable::NonZero::" + }, + { + "name": "pubkey", + "type": "core::zeroable::NonZero::" + } + ] + }, + { + "type": "enum", + "name": "argent::signer::signer_signature::Signer", + "variants": [ + { + "name": "Starknet", + "type": "argent::signer::signer_signature::StarknetSigner" + }, + { + "name": "Secp256k1", + "type": "argent::signer::signer_signature::Secp256k1Signer" + }, + { + "name": "Secp256r1", + "type": "argent::signer::signer_signature::Secp256r1Signer" + }, + { + "name": "Eip191", + "type": "argent::signer::signer_signature::Eip191Signer" + }, + { + "name": "Webauthn", + "type": "argent::signer::signer_signature::WebauthnSigner" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "argent::signer::signer_signature::Signer" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "argent::signer::signer_signature::StarknetSignature", + "members": [ + { + "name": "r", + "type": "core::felt252" + }, + { + "name": "s", + "type": "core::felt252" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "core::starknet::secp256_trait::Signature", + "members": [ + { + "name": "r", + "type": "core::integer::u256" + }, + { + "name": "s", + "type": "core::integer::u256" + }, + { + "name": "y_parity", + "type": "core::bool" + } + ] + }, + { + "type": "enum", + "name": "argent::signer::webauthn::Sha256Implementation", + "variants": [ + { + "name": "Cairo0", + "type": "()" + }, + { + "name": "Cairo1", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "argent::signer::webauthn::WebauthnSignature", + "members": [ + { + "name": "cross_origin", + "type": "core::bool" + }, + { + "name": "client_data_json_outro", + "type": "core::array::Span::" + }, + { + "name": "flags", + "type": "core::integer::u8" + }, + { + "name": "sign_count", + "type": "core::integer::u32" + }, + { + "name": "ec_signature", + "type": "core::starknet::secp256_trait::Signature" + }, + { + "name": "sha256_implementation", + "type": "argent::signer::webauthn::Sha256Implementation" + } + ] + }, + { + "type": "enum", + "name": "argent::signer::signer_signature::SignerSignature", + "variants": [ + { + "name": "Starknet", + "type": "(argent::signer::signer_signature::StarknetSigner, argent::signer::signer_signature::StarknetSignature)" + }, + { + "name": "Secp256k1", + "type": "(argent::signer::signer_signature::Secp256k1Signer, core::starknet::secp256_trait::Signature)" + }, + { + "name": "Secp256r1", + "type": "(argent::signer::signer_signature::Secp256r1Signer, core::starknet::secp256_trait::Signature)" + }, + { + "name": "Eip191", + "type": "(argent::signer::signer_signature::Eip191Signer, core::starknet::secp256_trait::Signature)" + }, + { + "name": "Webauthn", + "type": "(argent::signer::signer_signature::WebauthnSigner, argent::signer::webauthn::WebauthnSignature)" + } + ] + }, + { + "type": "enum", + "name": "argent::signer::signer_signature::SignerType", + "variants": [ + { + "name": "Starknet", + "type": "()" + }, + { + "name": "Secp256k1", + "type": "()" + }, + { + "name": "Secp256r1", + "type": "()" + }, + { + "name": "Eip191", + "type": "()" + }, + { + "name": "Webauthn", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "core::felt252" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "argent::signer::signer_signature::SignerType" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "argent::recovery::interface::LegacyEscapeType", + "variants": [ + { + "name": "None", + "type": "()" + }, + { + "name": "Guardian", + "type": "()" + }, + { + "name": "Owner", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "argent::signer::signer_signature::SignerStorageValue", + "members": [ + { + "name": "stored_value", + "type": "core::felt252" + }, + { + "name": "signer_type", + "type": "argent::signer::signer_signature::SignerType" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "argent::signer::signer_signature::SignerStorageValue" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "argent::recovery::interface::LegacyEscape", + "members": [ + { + "name": "ready_at", + "type": "core::integer::u64" + }, + { + "name": "escape_type", + "type": "argent::recovery::interface::LegacyEscapeType" + }, + { + "name": "new_signer", + "type": "core::option::Option::" + } + ] + }, + { + "type": "struct", + "name": "argent::account::interface::Version", + "members": [ + { + "name": "major", + "type": "core::integer::u8" + }, + { + "name": "minor", + "type": "core::integer::u8" + }, + { + "name": "patch", + "type": "core::integer::u8" + } + ] + }, + { + "type": "enum", + "name": "argent::recovery::interface::EscapeStatus", + "variants": [ + { + "name": "None", + "type": "()" + }, + { + "name": "NotReady", + "type": "()" + }, + { + "name": "Ready", + "type": "()" + }, + { + "name": "Expired", + "type": "()" + } + ] + }, + { + "type": "interface", + "name": "argent::account::interface::IArgentUserAccount", + "items": [ + { + "type": "function", + "name": "__validate_declare__", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "__validate_deploy__", + "inputs": [ + { + "name": "class_hash", + "type": "core::felt252" + }, + { + "name": "contract_address_salt", + "type": "core::felt252" + }, + { + "name": "owner", + "type": "argent::signer::signer_signature::Signer" + }, + { + "name": "guardian", + "type": "core::option::Option::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_escape_security_period", + "inputs": [ + { + "name": "new_security_period", + "type": "core::integer::u64" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "change_owner", + "inputs": [ + { + "name": "signer_signature", + "type": "argent::signer::signer_signature::SignerSignature" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "change_guardian", + "inputs": [ + { + "name": "new_guardian", + "type": "core::option::Option::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "change_guardian_backup", + "inputs": [ + { + "name": "new_guardian_backup", + "type": "core::option::Option::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "trigger_escape_owner", + "inputs": [ + { + "name": "new_owner", + "type": "argent::signer::signer_signature::Signer" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "trigger_escape_guardian", + "inputs": [ + { + "name": "new_guardian", + "type": "core::option::Option::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "escape_owner", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "escape_guardian", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "cancel_escape", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_owner", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_owner_guid", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_owner_type", + "inputs": [], + "outputs": [ + { + "type": "argent::signer::signer_signature::SignerType" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_guardian", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "is_guardian", + "inputs": [ + { + "name": "guardian", + "type": "argent::signer::signer_signature::Signer" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_guardian_guid", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_guardian_type", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_guardian_backup", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_guardian_backup_guid", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_guardian_backup_type", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_escape", + "inputs": [], + "outputs": [ + { + "type": "argent::recovery::interface::LegacyEscape" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_version", + "inputs": [], + "outputs": [ + { + "type": "argent::account::interface::Version" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_last_owner_trigger_escape_attempt", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_last_guardian_trigger_escape_attempt", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_last_owner_escape_attempt", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_last_guardian_escape_attempt", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_escape_and_status", + "inputs": [], + "outputs": [ + { + "type": "(argent::recovery::interface::LegacyEscape, argent::recovery::interface::EscapeStatus)" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_escape_security_period", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "DeprecatedArgentAccountImpl", + "interface_name": "argent::account::interface::IDeprecatedArgentAccount" + }, + { + "type": "interface", + "name": "argent::account::interface::IDeprecatedArgentAccount", + "items": [ + { + "type": "function", + "name": "getVersion", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "getName", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "isValidSignature", + "inputs": [ + { + "name": "hash", + "type": "core::felt252" + }, + { + "name": "signatures", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "Sessionable", + "interface_name": "argent::session::interface::ISessionable" + }, + { + "type": "interface", + "name": "argent::session::interface::ISessionable", + "items": [ + { + "type": "function", + "name": "revoke_session", + "inputs": [ + { + "name": "session_hash", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "is_session_revoked", + "inputs": [ + { + "name": "session_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "is_session_authorization_cached", + "inputs": [ + { + "name": "session_hash", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "ExecuteFromOutside", + "interface_name": "argent::outside_execution::interface::IOutsideExecution" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "argent::outside_execution::interface::OutsideExecution", + "members": [ + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "nonce", + "type": "core::felt252" + }, + { + "name": "execute_after", + "type": "core::integer::u64" + }, + { + "name": "execute_before", + "type": "core::integer::u64" + }, + { + "name": "calls", + "type": "core::array::Span::" + } + ] + }, + { + "type": "interface", + "name": "argent::outside_execution::interface::IOutsideExecution", + "items": [ + { + "type": "function", + "name": "execute_from_outside", + "inputs": [ + { + "name": "outside_execution", + "type": "argent::outside_execution::interface::OutsideExecution" + }, + { + "name": "signature", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "execute_from_outside_v2", + "inputs": [ + { + "name": "outside_execution", + "type": "argent::outside_execution::interface::OutsideExecution" + }, + { + "name": "signature", + "type": "core::array::Span::" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "is_valid_outside_execution_nonce", + "inputs": [ + { + "name": "nonce", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_outside_execution_message_hash_rev_0", + "inputs": [ + { + "name": "outside_execution", + "type": "argent::outside_execution::interface::OutsideExecution" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_outside_execution_message_hash_rev_1", + "inputs": [ + { + "name": "outside_execution", + "type": "argent::outside_execution::interface::OutsideExecution" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "SRC5", + "interface_name": "argent::introspection::interface::ISRC5" + }, + { + "type": "interface", + "name": "argent::introspection::interface::ISRC5", + "items": [ + { + "type": "function", + "name": "supports_interface", + "inputs": [ + { + "name": "interface_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "SRC5Legacy", + "interface_name": "argent::introspection::interface::ISRC5Legacy" + }, + { + "type": "interface", + "name": "argent::introspection::interface::ISRC5Legacy", + "items": [ + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "Upgradable", + "interface_name": "argent::upgrade::interface::IUpgradeable" + }, + { + "type": "interface", + "name": "argent::upgrade::interface::IUpgradeable", + "items": [ + { + "type": "function", + "name": "upgrade", + "inputs": [ + { + "name": "new_implementation", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "owner", + "type": "argent::signer::signer_signature::Signer" + }, + { + "name": "guardian", + "type": "core::option::Option::" + } + ] + }, + { + "type": "event", + "name": "argent::outside_execution::outside_execution::outside_execution_component::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "event", + "name": "argent::introspection::src5::src5_component::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "event", + "name": "argent::upgrade::upgrade::upgrade_component::AccountUpgraded", + "kind": "struct", + "members": [ + { + "name": "new_implementation", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::upgrade::upgrade::upgrade_component::Event", + "kind": "enum", + "variants": [ + { + "name": "AccountUpgraded", + "type": "argent::upgrade::upgrade::upgrade_component::AccountUpgraded", + "kind": "nested" + } + ] + }, + { + "type": "event", + "name": "argent::session::session::session_component::SessionRevoked", + "kind": "struct", + "members": [ + { + "name": "session_hash", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::session::session::session_component::Event", + "kind": "enum", + "variants": [ + { + "name": "SessionRevoked", + "type": "argent::session::session::session_component::SessionRevoked", + "kind": "nested" + } + ] + }, + { + "type": "event", + "name": "openzeppelin::security::reentrancyguard::ReentrancyGuardComponent::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "struct", + "name": "core::array::Span::>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::>" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::TransactionExecuted", + "kind": "struct", + "members": [ + { + "name": "hash", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "response", + "type": "core::array::Span::>", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::AccountCreated", + "kind": "struct", + "members": [ + { + "name": "owner", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "guardian", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::AccountCreatedGuid", + "kind": "struct", + "members": [ + { + "name": "owner_guid", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "guardian_guid", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::EscapeOwnerTriggeredGuid", + "kind": "struct", + "members": [ + { + "name": "ready_at", + "type": "core::integer::u64", + "kind": "data" + }, + { + "name": "new_owner_guid", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::EscapeGuardianTriggeredGuid", + "kind": "struct", + "members": [ + { + "name": "ready_at", + "type": "core::integer::u64", + "kind": "data" + }, + { + "name": "new_guardian_guid", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::OwnerEscapedGuid", + "kind": "struct", + "members": [ + { + "name": "new_owner_guid", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::GuardianEscapedGuid", + "kind": "struct", + "members": [ + { + "name": "new_guardian_guid", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::EscapeCanceled", + "kind": "struct", + "members": [] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::OwnerChanged", + "kind": "struct", + "members": [ + { + "name": "new_owner", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::OwnerChangedGuid", + "kind": "struct", + "members": [ + { + "name": "new_owner_guid", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::GuardianChanged", + "kind": "struct", + "members": [ + { + "name": "new_guardian", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::GuardianChangedGuid", + "kind": "struct", + "members": [ + { + "name": "new_guardian_guid", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::GuardianBackupChanged", + "kind": "struct", + "members": [ + { + "name": "new_guardian_backup", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::GuardianBackupChangedGuid", + "kind": "struct", + "members": [ + { + "name": "new_guardian_backup_guid", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::SignerLinked", + "kind": "struct", + "members": [ + { + "name": "signer_guid", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "signer", + "type": "argent::signer::signer_signature::Signer", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::EscapeSecurityPeriodChanged", + "kind": "struct", + "members": [ + { + "name": "escape_security_period", + "type": "core::integer::u64", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "argent::presets::argent_account::ArgentAccount::Event", + "kind": "enum", + "variants": [ + { + "name": "ExecuteFromOutsideEvents", + "type": "argent::outside_execution::outside_execution::outside_execution_component::Event", + "kind": "flat" + }, + { + "name": "SRC5Events", + "type": "argent::introspection::src5::src5_component::Event", + "kind": "flat" + }, + { + "name": "UpgradeEvents", + "type": "argent::upgrade::upgrade::upgrade_component::Event", + "kind": "flat" + }, + { + "name": "SessionableEvents", + "type": "argent::session::session::session_component::Event", + "kind": "flat" + }, + { + "name": "ReentrancyGuardEvent", + "type": "openzeppelin::security::reentrancyguard::ReentrancyGuardComponent::Event", + "kind": "flat" + }, + { + "name": "TransactionExecuted", + "type": "argent::presets::argent_account::ArgentAccount::TransactionExecuted", + "kind": "nested" + }, + { + "name": "AccountCreated", + "type": "argent::presets::argent_account::ArgentAccount::AccountCreated", + "kind": "nested" + }, + { + "name": "AccountCreatedGuid", + "type": "argent::presets::argent_account::ArgentAccount::AccountCreatedGuid", + "kind": "nested" + }, + { + "name": "EscapeOwnerTriggeredGuid", + "type": "argent::presets::argent_account::ArgentAccount::EscapeOwnerTriggeredGuid", + "kind": "nested" + }, + { + "name": "EscapeGuardianTriggeredGuid", + "type": "argent::presets::argent_account::ArgentAccount::EscapeGuardianTriggeredGuid", + "kind": "nested" + }, + { + "name": "OwnerEscapedGuid", + "type": "argent::presets::argent_account::ArgentAccount::OwnerEscapedGuid", + "kind": "nested" + }, + { + "name": "GuardianEscapedGuid", + "type": "argent::presets::argent_account::ArgentAccount::GuardianEscapedGuid", + "kind": "nested" + }, + { + "name": "EscapeCanceled", + "type": "argent::presets::argent_account::ArgentAccount::EscapeCanceled", + "kind": "nested" + }, + { + "name": "OwnerChanged", + "type": "argent::presets::argent_account::ArgentAccount::OwnerChanged", + "kind": "nested" + }, + { + "name": "OwnerChangedGuid", + "type": "argent::presets::argent_account::ArgentAccount::OwnerChangedGuid", + "kind": "nested" + }, + { + "name": "GuardianChanged", + "type": "argent::presets::argent_account::ArgentAccount::GuardianChanged", + "kind": "nested" + }, + { + "name": "GuardianChangedGuid", + "type": "argent::presets::argent_account::ArgentAccount::GuardianChangedGuid", + "kind": "nested" + }, + { + "name": "GuardianBackupChanged", + "type": "argent::presets::argent_account::ArgentAccount::GuardianBackupChanged", + "kind": "nested" + }, + { + "name": "GuardianBackupChangedGuid", + "type": "argent::presets::argent_account::ArgentAccount::GuardianBackupChangedGuid", + "kind": "nested" + }, + { + "name": "SignerLinked", + "type": "argent::presets::argent_account::ArgentAccount::SignerLinked", + "kind": "nested" + }, + { + "name": "EscapeSecurityPeriodChanged", + "type": "argent::presets::argent_account::ArgentAccount::EscapeSecurityPeriodChanged", + "kind": "nested" + } + ] + } +] \ No newline at end of file diff --git a/athena_abi/abis/v2/erc20_compiled.json b/athena_abi/abis/v2/erc20_compiled.json new file mode 100644 index 00000000..87f16205 --- /dev/null +++ b/athena_abi/abis/v2/erc20_compiled.json @@ -0,0 +1,278 @@ +[ + { + "type": "impl", + "name": "IERC20Impl", + "interface_name": "erc20::erc20::IERC20" + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "interface", + "name": "erc20::erc20::IERC20", + "items": [ + { + "type": "function", + "name": "get_name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_symbol", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_decimals", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_total_supply", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "balance_of", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "allowance", + "inputs": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "transfer", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "transfer_from", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "increase_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "added_value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "decrease_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtracted_value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "name_", + "type": "core::felt252" + }, + { + "name": "symbol_", + "type": "core::felt252" + }, + { + "name": "decimals_", + "type": "core::integer::u8" + }, + { + "name": "initial_supply", + "type": "core::integer::u256" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "event", + "name": "erc20::erc20::erc_20::Transfer", + "kind": "struct", + "members": [ + { + "name": "from", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "value", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "erc20::erc20::erc_20::Approval", + "kind": "struct", + "members": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "value", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "erc20::erc20::erc_20::Event", + "kind": "enum", + "variants": [ + { + "name": "Transfer", + "type": "erc20::erc20::erc_20::Transfer", + "kind": "nested" + }, + { + "name": "Approval", + "type": "erc20::erc20::erc_20::Approval", + "kind": "nested" + } + ] + } +] diff --git a/athena_abi/abis/v2/erc20_key_events.json b/athena_abi/abis/v2/erc20_key_events.json new file mode 100644 index 00000000..57ee7d1e --- /dev/null +++ b/athena_abi/abis/v2/erc20_key_events.json @@ -0,0 +1,712 @@ +[ + { + "type": "impl", + "name": "IERC20Impl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20" + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "interface", + "name": "openzeppelin::token::erc20::interface::IERC20", + "items": [ + { + "type": "function", + "name": "total_supply", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "balance_of", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "allowance", + "inputs": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "transfer", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "transfer_from", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "IERC20CamelOnlyImpl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20CamelOnly" + }, + { + "type": "interface", + "name": "openzeppelin::token::erc20::interface::IERC20CamelOnly", + "items": [ + { + "type": "function", + "name": "totalSupply", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "transferFrom", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "ERC20MetadataImpl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20Metadata" + }, + { + "type": "interface", + "name": "openzeppelin::token::erc20::interface::IERC20Metadata", + "items": [ + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "SafeAllowanceImpl", + "interface_name": "openzeppelin::token::erc20::interface::ISafeAllowance" + }, + { + "type": "interface", + "name": "openzeppelin::token::erc20::interface::ISafeAllowance", + "items": [ + { + "type": "function", + "name": "increase_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "added_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "decrease_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtracted_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "SafeAllowanceCamelImpl", + "interface_name": "openzeppelin::token::erc20::interface::ISafeAllowanceCamel" + }, + { + "type": "interface", + "name": "openzeppelin::token::erc20::interface::ISafeAllowanceCamel", + "items": [ + { + "type": "function", + "name": "increaseAllowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "addedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "decreaseAllowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtractedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "OwnableImpl", + "interface_name": "openzeppelin::access::ownable::interface::IOwnable" + }, + { + "type": "interface", + "name": "openzeppelin::access::ownable::interface::IOwnable", + "items": [ + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "transfer_ownership", + "inputs": [ + { + "name": "new_owner", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "renounce_ownership", + "inputs": [], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "OwnableCamelOnlyImpl", + "interface_name": "openzeppelin::access::ownable::interface::IOwnableCamelOnly" + }, + { + "type": "interface", + "name": "openzeppelin::access::ownable::interface::IOwnableCamelOnly", + "items": [ + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "HodlLimitImpl", + "interface_name": "wagmi::wagmi::interface::IHodlLimit" + }, + { + "type": "interface", + "name": "wagmi::wagmi::interface::IHodlLimit", + "items": [ + { + "type": "function", + "name": "is_pool", + "inputs": [ + { + "name": "pool_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "is_hodl_limit_enabled", + "inputs": [], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "SnapshotLoaderImpl", + "interface_name": "wagmi::wagmi::interface::ISnapshotLoader" + }, + { + "type": "interface", + "name": "wagmi::wagmi::interface::ISnapshotLoader", + "items": [ + { + "type": "function", + "name": "launched", + "inputs": [], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "vested_balance_of", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "symbol", + "type": "core::felt252" + }, + { + "name": "fixed_supply", + "type": "core::integer::u256" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "function", + "name": "add_pool", + "inputs": [ + { + "name": "pool_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "enable_hodl_limit", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "disable_hodl_limit", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "launch", + "inputs": [ + { + "name": "vesting_period", + "type": "core::integer::u64" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "mint", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "event", + "name": "openzeppelin::token::erc20::erc20::ERC20Component::Transfer", + "kind": "struct", + "members": [ + { + "name": "from", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "value", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "openzeppelin::token::erc20::erc20::ERC20Component::Approval", + "kind": "struct", + "members": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "value", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "openzeppelin::token::erc20::erc20::ERC20Component::Event", + "kind": "enum", + "variants": [ + { + "name": "Transfer", + "type": "openzeppelin::token::erc20::erc20::ERC20Component::Transfer", + "kind": "nested" + }, + { + "name": "Approval", + "type": "openzeppelin::token::erc20::erc20::ERC20Component::Approval", + "kind": "nested" + } + ] + }, + { + "type": "event", + "name": "openzeppelin::access::ownable::ownable::OwnableComponent::OwnershipTransferred", + "kind": "struct", + "members": [ + { + "name": "previous_owner", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "new_owner", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "openzeppelin::access::ownable::ownable::OwnableComponent::Event", + "kind": "enum", + "variants": [ + { + "name": "OwnershipTransferred", + "type": "openzeppelin::access::ownable::ownable::OwnableComponent::OwnershipTransferred", + "kind": "nested" + } + ] + }, + { + "type": "event", + "name": "wagmi::wagmi::hodl_limit::HodlLimitComponent::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "event", + "name": "wagmi::wagmi::snapshot_loader::SnapshotLoaderComponent::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "event", + "name": "wagmi::presets::full_features::FullFeaturesContract::Event", + "kind": "enum", + "variants": [ + { + "name": "ERC20Event", + "type": "openzeppelin::token::erc20::erc20::ERC20Component::Event", + "kind": "flat" + }, + { + "name": "OwnableEvent", + "type": "openzeppelin::access::ownable::ownable::OwnableComponent::Event", + "kind": "flat" + }, + { + "name": "HodlLimitEvent", + "type": "wagmi::wagmi::hodl_limit::HodlLimitComponent::Event", + "kind": "flat" + }, + { + "name": "SnapshotLoaderEvent", + "type": "wagmi::wagmi::snapshot_loader::SnapshotLoaderComponent::Event", + "kind": "flat" + } + ] + } +] \ No newline at end of file diff --git a/athena_abi/abis/v2/hello2_compiled.json b/athena_abi/abis/v2/hello2_compiled.json new file mode 100644 index 00000000..ebe66a84 --- /dev/null +++ b/athena_abi/abis/v2/hello2_compiled.json @@ -0,0 +1,679 @@ +[ + { + "type": "impl", + "name": "IHelloStarknetImpl", + "interface_name": "hello2::hello2::IHelloStarknet" + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "struct", + "name": "hello2::hello2::Foo", + "members": [ + { + "name": "val", + "type": "core::felt252" + } + ] + }, + { + "type": "struct", + "name": "hello2::hello2::UserData", + "members": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "is_claimed", + "type": "core::bool" + } + ] + }, + { + "type": "struct", + "name": "hello2::hello2::Bet", + "members": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "description", + "type": "core::felt252" + }, + { + "name": "expire_date", + "type": "core::integer::u64" + }, + { + "name": "creation_time", + "type": "core::integer::u64" + }, + { + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "is_cancelled", + "type": "core::bool" + }, + { + "name": "is_voted", + "type": "core::bool" + }, + { + "name": "bettor", + "type": "hello2::hello2::UserData" + }, + { + "name": "counter_bettor", + "type": "hello2::hello2::UserData" + }, + { + "name": "winner", + "type": "core::bool" + }, + { + "name": "pool", + "type": "core::integer::u256" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ] + }, + { + "type": "struct", + "name": "hello2::hello2::Order", + "members": [ + { + "name": "p1", + "type": "core::felt252" + }, + { + "name": "p2", + "type": "core::integer::u16" + } + ] + }, + { + "type": "enum", + "name": "hello2::hello2::MyEnum", + "variants": [ + { + "name": "Response", + "type": "hello2::hello2::Order" + }, + { + "name": "Warning", + "type": "core::felt252" + }, + { + "name": "Error", + "type": "core::integer::u16" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "core::integer::u8" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "hello2::hello2::Order" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "interface", + "name": "hello2::hello2::IHelloStarknet", + "items": [ + { + "type": "function", + "name": "increase_balance", + "inputs": [ + { + "name": "amount", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_balance", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_status", + "inputs": [ + { + "name": "new_status", + "type": "core::bool" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_status", + "inputs": [], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_ca", + "inputs": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_ca", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "increase_balance_u8", + "inputs": [ + { + "name": "amount", + "type": "core::integer::u8" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_balance_u8", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u16", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u16" + } + ], + "outputs": [ + { + "type": "core::integer::u16" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u32", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u32" + } + ], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u64", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u128", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u128" + } + ], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "test_u256", + "inputs": [ + { + "name": "p1", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "echo_array", + "inputs": [ + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "echo_array_u256", + "inputs": [ + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "echo_array_bool", + "inputs": [ + { + "name": "data", + "type": "core::array::Array::" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "echo_un_tuple", + "inputs": [ + { + "name": "a", + "type": "(core::felt252, core::integer::u16)" + } + ], + "outputs": [ + { + "type": "(core::felt252, core::integer::u16)" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "echo_struct", + "inputs": [ + { + "name": "tt", + "type": "hello2::hello2::Foo" + } + ], + "outputs": [ + { + "type": "hello2::hello2::Foo" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_bet", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_bet", + "inputs": [ + { + "name": "test", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "hello2::hello2::Bet" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_user1", + "inputs": [ + { + "name": "user", + "type": "hello2::hello2::UserData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_user1", + "inputs": [], + "outputs": [ + { + "type": "hello2::hello2::UserData" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_user", + "inputs": [], + "outputs": [ + { + "type": "hello2::hello2::UserData" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "array2d_ex", + "inputs": [ + { + "name": "test", + "type": "core::array::Array::>" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "array2d_array", + "inputs": [ + { + "name": "test", + "type": "core::array::Array::>" + } + ], + "outputs": [ + { + "type": "core::array::Array::>" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "array2d_felt", + "inputs": [ + { + "name": "test", + "type": "core::array::Array::>" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "tuple_echo", + "inputs": [ + { + "name": "a", + "type": "(core::array::Array::, core::array::Array::)" + } + ], + "outputs": [ + { + "type": "(core::array::Array::, core::array::Array::)" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "array_bool_tuple", + "inputs": [ + { + "name": "a", + "type": "core::array::Array::" + }, + { + "name": "b", + "type": "core::bool" + } + ], + "outputs": [ + { + "type": "(core::array::Array::, core::bool)" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "array2ddd_felt", + "inputs": [ + { + "name": "testdd", + "type": "core::array::Array::>" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "my_enum_output", + "inputs": [ + { + "name": "val1", + "type": "core::integer::u16" + } + ], + "outputs": [ + { + "type": "hello2::hello2::MyEnum" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "option_u8_output", + "inputs": [ + { + "name": "val1", + "type": "core::integer::u8" + } + ], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "option_order_output", + "inputs": [ + { + "name": "val1", + "type": "core::integer::u16" + } + ], + "outputs": [ + { + "type": "core::option::Option::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "option_order_input", + "inputs": [ + { + "name": "inp", + "type": "core::option::Option::" + } + ], + "outputs": [ + { + "type": "core::integer::u16" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "l1_handler", + "name": "increase_bal", + "inputs": [ + { + "name": "from_address", + "type": "core::felt252" + }, + { + "name": "amount", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [] + }, + { + "type": "event", + "name": "hello2::hello2::HelloStarknet::Event", + "kind": "enum", + "variants": [] + } +] diff --git a/athena_abi/abis/v2/hello_starknet_compiled.json b/athena_abi/abis/v2/hello_starknet_compiled.json new file mode 100644 index 00000000..10eba14b --- /dev/null +++ b/athena_abi/abis/v2/hello_starknet_compiled.json @@ -0,0 +1,31 @@ +[ + { + "type": "function", + "name": "increase_balance", + "inputs": [ + { + "name": "amount", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_balance", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "hello_starknet::hello_starknet::hello_starknet::Event", + "kind": "enum", + "variants": [] + } +] diff --git a/athena_abi/abis/v2/starknet_eth.json b/athena_abi/abis/v2/starknet_eth.json new file mode 100644 index 00000000..e38f259a --- /dev/null +++ b/athena_abi/abis/v2/starknet_eth.json @@ -0,0 +1,1029 @@ +[ + { + "type": "impl", + "name": "MintableToken", + "interface_name": "src::mintable_token_interface::IMintableToken" + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "interface", + "name": "src::mintable_token_interface::IMintableToken", + "items": [ + { + "type": "function", + "name": "permissioned_mint", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "permissioned_burn", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "MintableTokenCamelImpl", + "interface_name": "src::mintable_token_interface::IMintableTokenCamel" + }, + { + "type": "interface", + "name": "src::mintable_token_interface::IMintableTokenCamel", + "items": [ + { + "type": "function", + "name": "permissionedMint", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "permissionedBurn", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "Replaceable", + "interface_name": "src::replaceability_interface::IReplaceable" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "src::replaceability_interface::EICData", + "members": [ + { + "name": "eic_hash", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "eic_init_data", + "type": "core::array::Span::" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "src::replaceability_interface::EICData" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "src::replaceability_interface::ImplementationData", + "members": [ + { + "name": "impl_hash", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "eic_data", + "type": "core::option::Option::" + }, + { + "name": "final", + "type": "core::bool" + } + ] + }, + { + "type": "interface", + "name": "src::replaceability_interface::IReplaceable", + "items": [ + { + "type": "function", + "name": "get_upgrade_delay", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_impl_activation_time", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "add_new_implementation", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "remove_implementation", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "replace_to", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "AccessControlImplExternal", + "interface_name": "src::access_control_interface::IAccessControl" + }, + { + "type": "interface", + "name": "src::access_control_interface::IAccessControl", + "items": [ + { + "type": "function", + "name": "has_role", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_role_admin", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "RolesImpl", + "interface_name": "src::roles_interface::IMinimalRoles" + }, + { + "type": "interface", + "name": "src::roles_interface::IMinimalRoles", + "items": [ + { + "type": "function", + "name": "is_governance_admin", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "is_upgrade_governor", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "register_governance_admin", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "remove_governance_admin", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "register_upgrade_governor", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "remove_upgrade_governor", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "renounce", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "ERC20Impl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20" + }, + { + "type": "interface", + "name": "openzeppelin::token::erc20::interface::IERC20", + "items": [ + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "total_supply", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "balance_of", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "allowance", + "inputs": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "transfer", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "transfer_from", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "ERC20CamelOnlyImpl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20CamelOnly" + }, + { + "type": "interface", + "name": "openzeppelin::token::erc20::interface::IERC20CamelOnly", + "items": [ + { + "type": "function", + "name": "totalSupply", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "transferFrom", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "symbol", + "type": "core::felt252" + }, + { + "name": "decimals", + "type": "core::integer::u8" + }, + { + "name": "initial_supply", + "type": "core::integer::u256" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "permitted_minter", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "provisional_governance_admin", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "upgrade_delay", + "type": "core::integer::u64" + } + ] + }, + { + "type": "function", + "name": "increase_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "added_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "decrease_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtracted_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "increaseAllowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "addedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "decreaseAllowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtractedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "event", + "name": "openzeppelin::token::erc20_v070::erc20::ERC20::Transfer", + "kind": "struct", + "members": [ + { + "name": "from", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "value", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "openzeppelin::token::erc20_v070::erc20::ERC20::Approval", + "kind": "struct", + "members": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "value", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::replaceability_interface::ImplementationAdded", + "kind": "struct", + "members": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::replaceability_interface::ImplementationRemoved", + "kind": "struct", + "members": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::replaceability_interface::ImplementationReplaced", + "kind": "struct", + "members": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::replaceability_interface::ImplementationFinalized", + "kind": "struct", + "members": [ + { + "name": "impl_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::access_control_interface::RoleGranted", + "kind": "struct", + "members": [ + { + "name": "role", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::access_control_interface::RoleRevoked", + "kind": "struct", + "members": [ + { + "name": "role", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::access_control_interface::RoleAdminChanged", + "kind": "struct", + "members": [ + { + "name": "role", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "previous_admin_role", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "new_admin_role", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::roles_interface::GovernanceAdminAdded", + "kind": "struct", + "members": [ + { + "name": "added_account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "added_by", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::roles_interface::GovernanceAdminRemoved", + "kind": "struct", + "members": [ + { + "name": "removed_account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "removed_by", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::roles_interface::UpgradeGovernorAdded", + "kind": "struct", + "members": [ + { + "name": "added_account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "added_by", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::roles_interface::UpgradeGovernorRemoved", + "kind": "struct", + "members": [ + { + "name": "removed_account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "removed_by", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "openzeppelin::token::erc20_v070::erc20::ERC20::Event", + "kind": "enum", + "variants": [ + { + "name": "Transfer", + "type": "openzeppelin::token::erc20_v070::erc20::ERC20::Transfer", + "kind": "nested" + }, + { + "name": "Approval", + "type": "openzeppelin::token::erc20_v070::erc20::ERC20::Approval", + "kind": "nested" + }, + { + "name": "ImplementationAdded", + "type": "src::replaceability_interface::ImplementationAdded", + "kind": "nested" + }, + { + "name": "ImplementationRemoved", + "type": "src::replaceability_interface::ImplementationRemoved", + "kind": "nested" + }, + { + "name": "ImplementationReplaced", + "type": "src::replaceability_interface::ImplementationReplaced", + "kind": "nested" + }, + { + "name": "ImplementationFinalized", + "type": "src::replaceability_interface::ImplementationFinalized", + "kind": "nested" + }, + { + "name": "RoleGranted", + "type": "src::access_control_interface::RoleGranted", + "kind": "nested" + }, + { + "name": "RoleRevoked", + "type": "src::access_control_interface::RoleRevoked", + "kind": "nested" + }, + { + "name": "RoleAdminChanged", + "type": "src::access_control_interface::RoleAdminChanged", + "kind": "nested" + }, + { + "name": "GovernanceAdminAdded", + "type": "src::roles_interface::GovernanceAdminAdded", + "kind": "nested" + }, + { + "name": "GovernanceAdminRemoved", + "type": "src::roles_interface::GovernanceAdminRemoved", + "kind": "nested" + }, + { + "name": "UpgradeGovernorAdded", + "type": "src::roles_interface::UpgradeGovernorAdded", + "kind": "nested" + }, + { + "name": "UpgradeGovernorRemoved", + "type": "src::roles_interface::UpgradeGovernorRemoved", + "kind": "nested" + } + ] + } +] \ No newline at end of file diff --git a/athena_abi/abis/v2/starknet_usdc.json b/athena_abi/abis/v2/starknet_usdc.json new file mode 100644 index 00000000..e38f259a --- /dev/null +++ b/athena_abi/abis/v2/starknet_usdc.json @@ -0,0 +1,1029 @@ +[ + { + "type": "impl", + "name": "MintableToken", + "interface_name": "src::mintable_token_interface::IMintableToken" + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "interface", + "name": "src::mintable_token_interface::IMintableToken", + "items": [ + { + "type": "function", + "name": "permissioned_mint", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "permissioned_burn", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "MintableTokenCamelImpl", + "interface_name": "src::mintable_token_interface::IMintableTokenCamel" + }, + { + "type": "interface", + "name": "src::mintable_token_interface::IMintableTokenCamel", + "items": [ + { + "type": "function", + "name": "permissionedMint", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "permissionedBurn", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "Replaceable", + "interface_name": "src::replaceability_interface::IReplaceable" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "src::replaceability_interface::EICData", + "members": [ + { + "name": "eic_hash", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "eic_init_data", + "type": "core::array::Span::" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "src::replaceability_interface::EICData" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "src::replaceability_interface::ImplementationData", + "members": [ + { + "name": "impl_hash", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "eic_data", + "type": "core::option::Option::" + }, + { + "name": "final", + "type": "core::bool" + } + ] + }, + { + "type": "interface", + "name": "src::replaceability_interface::IReplaceable", + "items": [ + { + "type": "function", + "name": "get_upgrade_delay", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_impl_activation_time", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "add_new_implementation", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "remove_implementation", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "replace_to", + "inputs": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "AccessControlImplExternal", + "interface_name": "src::access_control_interface::IAccessControl" + }, + { + "type": "interface", + "name": "src::access_control_interface::IAccessControl", + "items": [ + { + "type": "function", + "name": "has_role", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_role_admin", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "RolesImpl", + "interface_name": "src::roles_interface::IMinimalRoles" + }, + { + "type": "interface", + "name": "src::roles_interface::IMinimalRoles", + "items": [ + { + "type": "function", + "name": "is_governance_admin", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "is_upgrade_governor", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "register_governance_admin", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "remove_governance_admin", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "register_upgrade_governor", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "remove_upgrade_governor", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "renounce", + "inputs": [ + { + "name": "role", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "ERC20Impl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20" + }, + { + "type": "interface", + "name": "openzeppelin::token::erc20::interface::IERC20", + "items": [ + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "total_supply", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "balance_of", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "allowance", + "inputs": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "transfer", + "inputs": [ + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "transfer_from", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "ERC20CamelOnlyImpl", + "interface_name": "openzeppelin::token::erc20::interface::IERC20CamelOnly" + }, + { + "type": "interface", + "name": "openzeppelin::token::erc20::interface::IERC20CamelOnly", + "items": [ + { + "type": "function", + "name": "totalSupply", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "transferFrom", + "inputs": [ + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "symbol", + "type": "core::felt252" + }, + { + "name": "decimals", + "type": "core::integer::u8" + }, + { + "name": "initial_supply", + "type": "core::integer::u256" + }, + { + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "permitted_minter", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "provisional_governance_admin", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "upgrade_delay", + "type": "core::integer::u64" + } + ] + }, + { + "type": "function", + "name": "increase_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "added_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "decrease_allowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtracted_value", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "increaseAllowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "addedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "decreaseAllowance", + "inputs": [ + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "subtractedValue", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "type": "event", + "name": "openzeppelin::token::erc20_v070::erc20::ERC20::Transfer", + "kind": "struct", + "members": [ + { + "name": "from", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "to", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "value", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "openzeppelin::token::erc20_v070::erc20::ERC20::Approval", + "kind": "struct", + "members": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "spender", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "value", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::replaceability_interface::ImplementationAdded", + "kind": "struct", + "members": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::replaceability_interface::ImplementationRemoved", + "kind": "struct", + "members": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::replaceability_interface::ImplementationReplaced", + "kind": "struct", + "members": [ + { + "name": "implementation_data", + "type": "src::replaceability_interface::ImplementationData", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::replaceability_interface::ImplementationFinalized", + "kind": "struct", + "members": [ + { + "name": "impl_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::access_control_interface::RoleGranted", + "kind": "struct", + "members": [ + { + "name": "role", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::access_control_interface::RoleRevoked", + "kind": "struct", + "members": [ + { + "name": "role", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::access_control_interface::RoleAdminChanged", + "kind": "struct", + "members": [ + { + "name": "role", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "previous_admin_role", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "new_admin_role", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::roles_interface::GovernanceAdminAdded", + "kind": "struct", + "members": [ + { + "name": "added_account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "added_by", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::roles_interface::GovernanceAdminRemoved", + "kind": "struct", + "members": [ + { + "name": "removed_account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "removed_by", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::roles_interface::UpgradeGovernorAdded", + "kind": "struct", + "members": [ + { + "name": "added_account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "added_by", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "src::roles_interface::UpgradeGovernorRemoved", + "kind": "struct", + "members": [ + { + "name": "removed_account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "removed_by", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "openzeppelin::token::erc20_v070::erc20::ERC20::Event", + "kind": "enum", + "variants": [ + { + "name": "Transfer", + "type": "openzeppelin::token::erc20_v070::erc20::ERC20::Transfer", + "kind": "nested" + }, + { + "name": "Approval", + "type": "openzeppelin::token::erc20_v070::erc20::ERC20::Approval", + "kind": "nested" + }, + { + "name": "ImplementationAdded", + "type": "src::replaceability_interface::ImplementationAdded", + "kind": "nested" + }, + { + "name": "ImplementationRemoved", + "type": "src::replaceability_interface::ImplementationRemoved", + "kind": "nested" + }, + { + "name": "ImplementationReplaced", + "type": "src::replaceability_interface::ImplementationReplaced", + "kind": "nested" + }, + { + "name": "ImplementationFinalized", + "type": "src::replaceability_interface::ImplementationFinalized", + "kind": "nested" + }, + { + "name": "RoleGranted", + "type": "src::access_control_interface::RoleGranted", + "kind": "nested" + }, + { + "name": "RoleRevoked", + "type": "src::access_control_interface::RoleRevoked", + "kind": "nested" + }, + { + "name": "RoleAdminChanged", + "type": "src::access_control_interface::RoleAdminChanged", + "kind": "nested" + }, + { + "name": "GovernanceAdminAdded", + "type": "src::roles_interface::GovernanceAdminAdded", + "kind": "nested" + }, + { + "name": "GovernanceAdminRemoved", + "type": "src::roles_interface::GovernanceAdminRemoved", + "kind": "nested" + }, + { + "name": "UpgradeGovernorAdded", + "type": "src::roles_interface::UpgradeGovernorAdded", + "kind": "nested" + }, + { + "name": "UpgradeGovernorRemoved", + "type": "src::roles_interface::UpgradeGovernorRemoved", + "kind": "nested" + } + ] + } +] \ No newline at end of file diff --git a/athena_abi/abis/v2/storage_address.json b/athena_abi/abis/v2/storage_address.json new file mode 100644 index 00000000..e57abd29 --- /dev/null +++ b/athena_abi/abis/v2/storage_address.json @@ -0,0 +1,218 @@ +[ + { + "type": "impl", + "name": "Refundable", + "interface_name": "refunfable_erc721::interface::IRefundable" + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "interface", + "name": "refunfable_erc721::interface::IRefundable", + "items": [ + { + "type": "function", + "name": "register_payment", + "inputs": [ + { + "name": "nft_id", + "type": "core::integer::u256" + }, + { + "name": "buyer", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "price", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "claim_refund", + "inputs": [ + { + "name": "nft_id", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "admin_claim_funds", + "inputs": [ + { + "name": "erc20", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_claimable", + "inputs": [ + { + "name": "nft_id", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_nft_contract", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "StorageReadImpl", + "interface_name": "storage_read::interface::IStorageRead" + }, + { + "type": "interface", + "name": "storage_read::interface::IStorageRead", + "items": [ + { + "type": "function", + "name": "storage_read", + "inputs": [ + { + "name": "address_domain", + "type": "core::integer::u32" + }, + { + "name": "address", + "type": "core::starknet::storage_access::StorageAddress" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "nft_contract", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "payment_erc20", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "refund_end_time", + "type": "core::integer::u64" + }, + { + "name": "admin", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "event", + "name": "refunfable_erc721::contract::RefundableERC721::ClaimedRefund", + "kind": "struct", + "members": [ + { + "name": "nft_id", + "type": "core::integer::u256", + "kind": "key" + }, + { + "name": "buyer", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "refunded_amount", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "refunfable_erc721::contract::RefundableERC721::AdminClaimedFunds", + "kind": "struct", + "members": [ + { + "name": "erc20", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "amount", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "storage_read::main::storage_read_component::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "event", + "name": "refunfable_erc721::contract::RefundableERC721::Event", + "kind": "enum", + "variants": [ + { + "name": "ClaimedRefund", + "type": "refunfable_erc721::contract::RefundableERC721::ClaimedRefund", + "kind": "nested" + }, + { + "name": "AdminClaimedFunds", + "type": "refunfable_erc721::contract::RefundableERC721::AdminClaimedFunds", + "kind": "nested" + }, + { + "name": "StorageReadEvent", + "type": "storage_read::main::storage_read_component::Event", + "kind": "flat" + } + ] + } +] \ No newline at end of file diff --git a/athena_abi/abis/v2/test_contract_compiled.json b/athena_abi/abis/v2/test_contract_compiled.json new file mode 100644 index 00000000..05a3d468 --- /dev/null +++ b/athena_abi/abis/v2/test_contract_compiled.json @@ -0,0 +1,135 @@ +[ + { + "type": "function", + "name": "test", + "inputs": [ + { + "name": "arg", + "type": "core::felt252" + }, + { + "name": "arg1", + "type": "core::felt252" + }, + { + "name": "arg2", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "test_contract::test_contract::MyType", + "members": [ + { + "name": "a", + "type": "core::felt252" + }, + { + "name": "b", + "type": "core::bool" + } + ] + }, + { + "type": "function", + "name": "another_function", + "inputs": [ + { + "name": "x", + "type": "test_contract::test_contract::MyType" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "call_foo", + "inputs": [ + { + "name": "another_contract_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "a", + "type": "core::integer::u128" + } + ], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "libcall_foo", + "inputs": [ + { + "name": "a", + "type": "core::integer::u128" + } + ], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "segment_arena_builtin", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "l1_handler", + "name": "l1_handle", + "inputs": [ + { + "name": "from_address", + "type": "core::felt252" + }, + { + "name": "arg", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "type": "event", + "name": "test_contract::test_contract::test_contract::Event", + "kind": "enum", + "variants": [] + } +] diff --git a/athena_abi/abis/v2/test_enum_compiled.json b/athena_abi/abis/v2/test_enum_compiled.json new file mode 100644 index 00000000..339ac8e6 --- /dev/null +++ b/athena_abi/abis/v2/test_enum_compiled.json @@ -0,0 +1,78 @@ +[ + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "enum", + "name": "test_enum::test_enum::MyEnum", + "variants": [ + { + "name": "a", + "type": "core::integer::u256" + }, + { + "name": "b", + "type": "core::integer::u128" + }, + { + "name": "c", + "type": "()" + } + ] + }, + { + "type": "function", + "name": "receive_and_send_enum", + "inputs": [ + { + "name": "my_enum", + "type": "test_enum::test_enum::MyEnum" + } + ], + "outputs": [ + { + "type": "test_enum::test_enum::MyEnum" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_enum", + "inputs": [], + "outputs": [ + { + "type": "test_enum::test_enum::MyEnum" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_enum_without_value", + "inputs": [], + "outputs": [ + { + "type": "test_enum::test_enum::MyEnum" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "test_enum::test_enum::TestEnum::Event", + "kind": "enum", + "variants": [] + } +] diff --git a/athena_abi/abis/v2/test_option_compiled.json b/athena_abi/abis/v2/test_option_compiled.json new file mode 100644 index 00000000..8b4db718 --- /dev/null +++ b/athena_abi/abis/v2/test_option_compiled.json @@ -0,0 +1,124 @@ +[ + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "core::integer::u256" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "core::integer::u8" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "test_option::test_option::OptionStruct", + "members": [ + { + "name": "first_field", + "type": "core::felt252" + }, + { + "name": "second_field", + "type": "core::option::Option::" + }, + { + "name": "third_field", + "type": "core::option::Option::" + }, + { + "name": "fourth_field", + "type": "core::felt252" + } + ] + }, + { + "type": "function", + "name": "receive_and_send_option_struct", + "inputs": [ + { + "name": "option_struct", + "type": "test_option::test_option::OptionStruct" + } + ], + "outputs": [ + { + "type": "test_option::test_option::OptionStruct" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_option_struct", + "inputs": [], + "outputs": [ + { + "type": "test_option::test_option::OptionStruct" + } + ], + "state_mutability": "view" + }, + { + "type": "enum", + "name": "core::option::Option::<()>", + "variants": [ + { + "name": "Some", + "type": "()" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "function", + "name": "get_empty_option", + "inputs": [], + "outputs": [ + { + "type": "core::option::Option::<()>" + } + ], + "state_mutability": "view" + }, + { + "type": "event", + "name": "test_option::test_option::HelloStarknet::Event", + "kind": "enum", + "variants": [] + } +] diff --git a/athena_abi/abis/v2/token_bridge_compiled.json b/athena_abi/abis/v2/token_bridge_compiled.json new file mode 100644 index 00000000..44d472ef --- /dev/null +++ b/athena_abi/abis/v2/token_bridge_compiled.json @@ -0,0 +1,208 @@ +[ + { + "type": "function", + "name": "get_version", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "get_identity", + "inputs": [], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "type": "struct", + "name": "core::starknet::eth_address::EthAddress", + "members": [ + { + "name": "address", + "type": "core::felt252" + } + ] + }, + { + "type": "function", + "name": "set_l1_bridge", + "inputs": [ + { + "name": "l1_bridge_address", + "type": "core::starknet::eth_address::EthAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "set_l2_token", + "inputs": [ + { + "name": "l2_token_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "function", + "name": "initiate_withdraw", + "inputs": [ + { + "name": "l1_recipient", + "type": "core::starknet::eth_address::EthAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "governor_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "l1_handler", + "name": "handle_deposit", + "inputs": [ + { + "name": "from_address", + "type": "core::felt252" + }, + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "event", + "name": "token_bridge::token_bridge::token_bridge::L1BridgeSet", + "kind": "struct", + "members": [ + { + "name": "l1_bridge_address", + "type": "core::starknet::eth_address::EthAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "token_bridge::token_bridge::token_bridge::L2TokenSet", + "kind": "struct", + "members": [ + { + "name": "l2_token_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "token_bridge::token_bridge::token_bridge::WithdrawInitiated", + "kind": "struct", + "members": [ + { + "name": "l1_recipient", + "type": "core::starknet::eth_address::EthAddress", + "kind": "data" + }, + { + "name": "amount", + "type": "core::integer::u256", + "kind": "data" + }, + { + "name": "caller_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "token_bridge::token_bridge::token_bridge::DepositHandled", + "kind": "struct", + "members": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "amount", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "token_bridge::token_bridge::token_bridge::Event", + "kind": "enum", + "variants": [ + { + "name": "L1BridgeSet", + "type": "token_bridge::token_bridge::token_bridge::L1BridgeSet", + "kind": "nested" + }, + { + "name": "L2TokenSet", + "type": "token_bridge::token_bridge::token_bridge::L2TokenSet", + "kind": "nested" + }, + { + "name": "WithdrawInitiated", + "type": "token_bridge::token_bridge::token_bridge::WithdrawInitiated", + "kind": "nested" + }, + { + "name": "DepositHandled", + "type": "token_bridge::token_bridge::token_bridge::DepositHandled", + "kind": "nested" + } + ] + } +] diff --git a/athena_abi/parse.go b/athena_abi/parse.go index 2ff6cc35..625c7e9b 100644 --- a/athena_abi/parse.go +++ b/athena_abi/parse.go @@ -10,11 +10,21 @@ func GroupAbiByType(abiJson []map[string]interface{}) map[AbiMemberType][]map[st grouped := make(map[AbiMemberType][]map[string]interface{}) for _, entry := range abiJson { - if entry["type"] == "struct" || entry["type"] == "enum" { + /*if entry["type"] == "struct" || entry["type"] == "enum" { grouped["type_def"] = append(grouped["type_def"], entry) } else { - grouped[entry["type"].(AbiMemberType)] = append(grouped[entry["type"].(AbiMemberType)], entry) + grouped[AbiMemberType(typeStr)] = append(grouped[AbiMemberType(entry["type"])], entry) + + }*/ + typeStr, _ := entry["type"].(string) + + // Convert the string to AbiMemberType + if typeStr == "struct" || typeStr == "enum" { + grouped["type_def"] = append(grouped["type_def"], entry) + } else { + grouped[AbiMemberType(typeStr)] = append(grouped[AbiMemberType(typeStr)], entry) } + } return grouped } @@ -150,21 +160,36 @@ func ParseEnumsAndStructs(abiStructs []map[string]interface{}) (map[string]inter return outputTypes, nil } - func parseStruct(abiStruct map[string]interface{}, typeContext map[string]interface{}) (StarknetStruct, error) { members := []AbiParameter{} - for _, member := range abiStruct["members"].([]map[string]interface{}) { + // Assert that "members" is a slice of interfaces + memberInterfaces, ok := abiStruct["members"].([]interface{}) + if !ok { + return StarknetStruct{}, fmt.Errorf("invalid type for members: expected []interface{}") + } + + // Iterate over the members and convert each to map[string]interface{} + for _, memberInterface := range memberInterfaces { + member, ok := memberInterface.(map[string]interface{}) + if !ok { + return StarknetStruct{}, fmt.Errorf("invalid type for member: expected map[string]interface{}") + } + + // Parse the member type res, err := parseType(member["type"].(string), typeContext) if err != nil { return StarknetStruct{}, err } + + // Append the member to the list members = append(members, AbiParameter{ Name: member["name"].(string), Type: res, }) } + // Return the parsed StarknetStruct return StarknetStruct{ Name: abiStruct["name"].(string), Members: members, @@ -177,7 +202,20 @@ func parseEnum(abiEnum map[string]interface{}, typeContext map[string]interface{ Type StarknetType }{} - for _, variant := range abiEnum["variants"].([]map[string]interface{}) { + // Handle the case where `abiEnum["variants"]` is a `[]interface{}` + rawVariants, ok := abiEnum["variants"].([]interface{}) + if !ok { + return StarknetEnum{}, fmt.Errorf("expected variants to be a slice of interface{}") + } + + // Loop over the `rawVariants` and safely cast each to `map[string]interface{}` + for _, rawVariant := range rawVariants { + variant, ok := rawVariant.(map[string]interface{}) + if !ok { + return StarknetEnum{}, fmt.Errorf("expected variant to be a map[string]interface{}") + } + + // Parse the type of each variant res, err := parseType(variant["type"].(string), typeContext) if err != nil { return StarknetEnum{}, err @@ -202,12 +240,15 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType return NoneType, nil } - if strings.HasPrefix(abiType, "(") { + /*if strings.HasPrefix(abiType, "(") { res, err := ParseTuple(abiType, customTypes) if err != nil { return nil, err } return res, nil + }*/ + if strings.HasPrefix(abiType, "(") && strings.HasSuffix(abiType, ")") { + return ParseTuple(abiType, customTypes) } parts := strings.Split(abiType, "::")[1:] @@ -244,6 +285,13 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType return nil, err } return StarknetNonZero{res}, nil + //implemented integer parsing + case len(parts) >= 2 && parts[0] == "integer": + intType, err := intFromString(parts[1]) + if err != nil { + return nil, err + } + return intType, nil default: if val, exists := customTypes[abiType]; exists { return val.(StarknetType), nil diff --git a/athena_abi/parse_struct_test.go b/athena_abi/parse_struct_test.go new file mode 100644 index 00000000..6c466d35 --- /dev/null +++ b/athena_abi/parse_struct_test.go @@ -0,0 +1,143 @@ +package athena_abi + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "runtime" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var ethAbiJson []map[string]interface{} +var argentAccountAbi []map[string]interface{} + +// loadAbi loads the ABI JSON file and returns its content +func loadAbi(abiName string, abiVersion int) ([]map[string]interface{}, error) { + _, filename, _, ok := runtime.Caller(0) + if !ok { + return nil, fmt.Errorf("failed to get current file path") + } + + parentDir := filepath.Dir(filename) + abiPath := filepath.Join(parentDir, "abis", fmt.Sprintf("v%d", abiVersion), fmt.Sprintf("%s.json", abiName)) + + file, err := os.Open(abiPath) + if err != nil { + return nil, fmt.Errorf("failed to open ABI file: %w", err) + } + defer file.Close() + + var abiJson []map[string]interface{} + err = json.NewDecoder(file).Decode(&abiJson) + if err != nil { + return nil, fmt.Errorf("failed to decode ABI JSON: %w", err) + } + + return abiJson, nil +} +func init() { + var err error + + // Load starknet_eth ABI + ethAbiJson, err = loadAbi("starknet_eth", 2) + if err != nil { + fmt.Println("Failed to load starknet_eth ABI:", err) + } + + // Load argent_account ABI + argentAccountAbi, err = loadAbi("argent_account", 2) + if err != nil { + fmt.Println("Failed to load argent_account ABI:", err) + } +} + +func TestStructOrdering(t *testing.T) { + // Load ABI JSONs + require.NotNil(t, ethAbiJson, "starknet_eth ABI should be loaded") + require.NotNil(t, argentAccountAbi, "argent_account ABI should be loaded") + + // Group ABI by type + groupedAbi := GroupAbiByType(ethAbiJson) + + // Get structs from grouped ABI + structs, ok := groupedAbi["type_def"] + require.True(t, ok, "type_def should exist in grouped ABI") + + // Assert the order of structs + assert.Equal(t, "core::integer::u256", structs[0]["name"], "First struct should be core::integer::u256") + assert.Equal(t, "struct", structs[0]["type"], "First item should be a struct") + + assert.Equal(t, "core::array::Span::", structs[1]["name"], "Second struct should be core::array::Span::") + assert.Equal(t, "struct", structs[1]["type"], "Second item should be a struct") + + assert.Equal(t, "src::replaceability_interface::EICData", structs[2]["name"], "Third struct should be src::replaceability_interface::EICData") + assert.Equal(t, "struct", structs[2]["type"], "Third item should be a struct") + + assert.Equal(t, "core::option::Option::", structs[3]["name"], "Fourth item should be core::option::Option::") + assert.Equal(t, "enum", structs[3]["type"], "Fourth item should be an enum") + + assert.Equal(t, "core::bool", structs[4]["name"], "Fifth item should be core::bool") + assert.Equal(t, "enum", structs[4]["type"], "Fifth item should be an enum") + + assert.Equal(t, "src::replaceability_interface::ImplementationData", structs[5]["name"], "Sixth struct should be src::replaceability_interface::ImplementationData") + assert.Equal(t, "struct", structs[5]["type"], "Sixth item should be a struct") +} + +func TestExcludeCommonStructsAndEnums(t *testing.T) { + // Assuming ETH_ABI_JSON is defined somewhere in your test setup + require.NotNil(t, ethAbiJson, "starknet_eth ABI should be loaded") + require.NotNil(t, argentAccountAbi, "argent_account ABI should be loaded") + groupedAbi := GroupAbiByType(ethAbiJson) + structDict, err := ParseEnumsAndStructs(groupedAbi["type_def"]) + assert.NoError(t, err) + assert.Equal(t, 2, len(structDict)) + + expectedEicDataStruct := StarknetStruct{ + Name: "src::replaceability_interface::EICData", + Members: []AbiParameter{ + {Name: "eic_hash", Type: ClassHash}, + {Name: "eic_init_data", Type: StarknetArray{InnerType: Felt}}, + }, + } + + assert.Equal(t, expectedEicDataStruct, structDict["src::replaceability_interface::EICData"]) + + expectedImplementationDataStruct := StarknetStruct{ + Name: "src::replaceability_interface::ImplementationData", + Members: []AbiParameter{ + {Name: "impl_hash", Type: ClassHash}, + {Name: "eic_data", Type: StarknetOption{InnerType: expectedEicDataStruct}}, + {Name: "final", Type: Bool}, + }, + } + + assert.Equal(t, expectedImplementationDataStruct, structDict["src::replaceability_interface::ImplementationData"]) +} + +func TestEnumParsing(t *testing.T) { + groupedAbi := GroupAbiByType(argentAccountAbi) + typeDict, err := ParseEnumsAndStructs(groupedAbi["type_def"]) + require.NoError(t, err) + + assert.Len(t, typeDict, 5) + + escapeStatus, ok := typeDict["account::escape::EscapeStatus"].(StarknetEnum) + require.True(t, ok) + + expectedVariants := []struct { + Name string + Type StarknetType + }{ + {"None", NoneType}, + {"NotReady", NoneType}, + {"Ready", NoneType}, + {"Expired", NoneType}, + } + + assert.Equal(t, "account::escape::EscapeStatus", escapeStatus.Name) + assert.Equal(t, expectedVariants, escapeStatus.Variants) +} diff --git a/athena_abi/utils.go b/athena_abi/utils.go index c9815777..3c1e6e3e 100644 --- a/athena_abi/utils.go +++ b/athena_abi/utils.go @@ -4,6 +4,11 @@ import ( "math/big" "golang.org/x/crypto/sha3" + + "encoding/json" + "fmt" + "os" + "path/filepath" ) func bigIntToBytes(value big.Int, length int) []byte { @@ -78,3 +83,20 @@ func convertMap(input map[string]map[string]bool) map[string][]string { return result } + +func loadABI(abiName string, abiVersion int) (map[string]interface{}, error) { + abiFilePath := filepath.Join("abis", fmt.Sprintf("v%d", abiVersion), abiName+".json") + abiFile, err := os.Open(abiFilePath) + if err != nil { + return nil, fmt.Errorf("failed to open ABI file: %w", err) + } + defer abiFile.Close() + + var abiData map[string]interface{} + decoder := json.NewDecoder(abiFile) + if err := decoder.Decode(&abiData); err != nil { + return nil, fmt.Errorf("failed to decode ABI JSON: %w", err) + } + + return abiData, nil +} From 031d458c72e044269b901b74affe51f05aeafbd3 Mon Sep 17 00:00:00 2001 From: rishikpulhani Date: Sat, 21 Sep 2024 12:34:51 +0530 Subject: [PATCH 4/8] completed parse_struct_test.go --- athena_abi/parse.go | 31 +++++++-- athena_abi/parse_struct_test.go | 118 ++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 5 deletions(-) diff --git a/athena_abi/parse.go b/athena_abi/parse.go index 625c7e9b..83b0e8a3 100644 --- a/athena_abi/parse.go +++ b/athena_abi/parse.go @@ -119,6 +119,11 @@ func TopoSortTypeDefs(typeDefs []map[string]interface{}) ([]map[string]interface } sortedTypeDefJson = append(sortedTypeDefJson, abiDefinition[0]) } + for i, j := 0, len(sortedTypeDefJson)-1; i < j; i, j = i+1, j-1 { + sortedTypeDefJson[i], sortedTypeDefJson[j] = sortedTypeDefJson[j], sortedTypeDefJson[i] + } + + // Return the reversed slice return sortedTypeDefJson, nil } @@ -240,16 +245,16 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType return NoneType, nil } - /*if strings.HasPrefix(abiType, "(") { + if strings.HasPrefix(abiType, "(") { res, err := ParseTuple(abiType, customTypes) if err != nil { return nil, err } return res, nil - }*/ - if strings.HasPrefix(abiType, "(") && strings.HasSuffix(abiType, ")") { - return ParseTuple(abiType, customTypes) } + /*if strings.HasPrefix(abiType, "(") && strings.HasSuffix(abiType, ")") { + return ParseTuple(abiType, customTypes) + }*/ parts := strings.Split(abiType, "::")[1:] switch { @@ -332,43 +337,59 @@ func isNamedTuple(typeStr string) int { // customTypes is a map from string to StarknetStruct or StarknetEnum func ParseTuple(abiType string, customTypes map[string]interface{}) (StarknetTuple, error) { - strippedTuple := strings.TrimSpace(abiType[1 : len(abiType)-1]) + trimmed := strings.TrimSpace(abiType) + strippedTuple := strings.TrimSpace(trimmed[1 : len(trimmed)-1]) + outputTypes := []StarknetType{} parenthesisCache := []string{} typeCache := []string{} for _, typeString := range strings.Split(strippedTuple, ",") { + tupleOpen := strings.Count(typeString, "(") tupleClose := strings.Count(typeString, ")") if tupleOpen > 0 { + for i := 0; i < tupleOpen; i++ { parenthesisCache = append(parenthesisCache, "(") } + } if len(parenthesisCache) > 0 { typeCache = append(typeCache, typeString) + } else { if isNamedTuple(typeString) > 0 { res, err := parseType(typeString[isNamedTuple(typeString)+1:], customTypes) + if err != nil { + return StarknetTuple{}, err + } outputTypes = append(outputTypes, res) + } else { res, err := parseType(typeString, customTypes) + if err != nil { + return StarknetTuple{}, err } outputTypes = append(outputTypes, res) + } } if tupleClose > 0 { parenthesisCache = parenthesisCache[:len(parenthesisCache)-tupleClose] + if len(parenthesisCache) == 0 { res, err := ParseTuple(strings.Join(typeCache, ","), customTypes) + if err != nil { + return StarknetTuple{}, err } outputTypes = append(outputTypes, res) diff --git a/athena_abi/parse_struct_test.go b/athena_abi/parse_struct_test.go index 6c466d35..4a6e2a5d 100644 --- a/athena_abi/parse_struct_test.go +++ b/athena_abi/parse_struct_test.go @@ -141,3 +141,121 @@ func TestEnumParsing(t *testing.T) { assert.Equal(t, "account::escape::EscapeStatus", escapeStatus.Name) assert.Equal(t, expectedVariants, escapeStatus.Variants) } + +func TestTupleParsing(t *testing.T) { + customTypes := make(map[string]interface{}) + + t.Run("Single Tuple", func(t *testing.T) { + singleTuple, err := ParseTuple("(core::felt252, core::bool)", customTypes) + assert.NoError(t, err) + assert.Equal(t, StarknetTuple{Members: []StarknetType{Felt, Bool}}, singleTuple) + }) + + t.Run("Nested Tuple 1", func(t *testing.T) { + nestedTuple1, err := ParseTuple("(core::felt252, (core::bool, core::integer::u256))", customTypes) + assert.NoError(t, err) + expected := StarknetTuple{Members: []StarknetType{ + Felt, + StarknetTuple{Members: []StarknetType{Bool, U256}}, + }} + assert.Equal(t, expected, nestedTuple1) + }) + + t.Run("Nested Tuple 2", func(t *testing.T) { + nestedTuple2, err := ParseTuple("(core::felt252, ((core::integer::u16, core::integer::u32), core::bool), core::integer::u256)", customTypes) + assert.NoError(t, err) + expected := StarknetTuple{Members: []StarknetType{ + Felt, + StarknetTuple{Members: []StarknetType{ + StarknetTuple{Members: []StarknetType{U16, U32}}, + Bool, + }}, + U256, + }} + assert.Equal(t, expected, nestedTuple2) + }) +} + +var UnorderedStructs = []map[string]interface{}{ + { + "type": "struct", + "name": "betting::betting::Bet", + "members": []map[string]interface{}{ + {"name": "expire_timestamp", "type": "core::integer::u64"}, + {"name": "bettor", "type": "betting::betting::UserData"}, + {"name": "counter_bettor", "type": "betting::betting::UserData"}, + {"name": "amount", "type": "core::integer::u256"}, + }, + }, + { + "type": "struct", + "name": "betting::betting::UserData", + "members": []map[string]interface{}{ + {"name": "address", "type": "core::starknet::contract_address::ContractAddress"}, + {"name": "total_assets", "type": "core::integer::u256"}, + }, + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": []map[string]interface{}{ + {"name": "low", "type": "core::integer::u128"}, + {"name": "high", "type": "core::integer::u128"}, + }, + }, +} + +func TestBuildTypeGraph(t *testing.T) { + typeGraph := BuildTypeGraph(UnorderedStructs) + + expectedTypeGraph := map[string]map[string]bool{ + "betting::betting::Bet": { + "betting::betting::UserData": true, + "core::integer::u256": true, + }, + "betting::betting::UserData": { + "core::integer::u256": true, + }, + "core::integer::u256": {}, + } + + assert.Equal(t, expectedTypeGraph, typeGraph, "The type graph should match the expected result") + + sortedDefs, err := TopoSortTypeDefs(UnorderedStructs) + assert.NoError(t, err, "TopoSortTypeDefs should not return an error") + + expectedOrder := []string{ + "core::integer::u256", + "betting::betting::UserData", + "betting::betting::Bet", + } + + actualOrder := make([]string, len(sortedDefs)) + for i, def := range sortedDefs { + actualOrder[i] = def["name"].(string) + } + + assert.Equal(t, expectedOrder, actualOrder, "The sorted order should match the expected result") +} + +func TestStructTopoSorting(t *testing.T) { + topoSortedTypeDefs, err := TopoSortTypeDefs(UnorderedStructs) + assert.NoError(t, err) + + expectedOrder := []string{ + "core::integer::u256", + "betting::betting::UserData", + "betting::betting::Bet", + } + + assert.Equal(t, len(expectedOrder), len(topoSortedTypeDefs), "Number of sorted structs doesn't match expected") + + for i, expectedName := range expectedOrder { + assert.Equal(t, expectedName, topoSortedTypeDefs[i]["name"], "Struct at index %d should be %s", i, expectedName) + } + + // Verify the contents of each struct + assert.Equal(t, UnorderedStructs[2], topoSortedTypeDefs[0], "First struct should be core::integer::u256") + assert.Equal(t, UnorderedStructs[1], topoSortedTypeDefs[1], "Second struct should be betting::betting::UserData") + assert.Equal(t, UnorderedStructs[0], topoSortedTypeDefs[2], "Third struct should be betting::betting::Bet") +} From ec0c25ca6550b46f368c84d3b969298a73c84eb2 Mon Sep 17 00:00:00 2001 From: rishikpulhani Date: Mon, 23 Sep 2024 12:06:08 +0530 Subject: [PATCH 5/8] made exceptions_test.go --- athena_abi/core.go | 320 +++++++++++++++++----------------- athena_abi/exceptions_test.go | 47 +++++ 2 files changed, 207 insertions(+), 160 deletions(-) create mode 100644 athena_abi/exceptions_test.go diff --git a/athena_abi/core.go b/athena_abi/core.go index 3151afca..a0cda58e 100644 --- a/athena_abi/core.go +++ b/athena_abi/core.go @@ -1,160 +1,160 @@ -package athena_abi - -import ( - "errors" - "log" -) - -type StarknetABI struct { - ABIName *string - ClassHash []byte - Functions map[string]AbiFunction - Events map[string]AbiEvent - Constructor []AbiParameter - L1Handler *AbiFunction - ImplementedInterfaces map[string]AbiInterface -} - -// Declare errors -var ( - errParseDefinedTypes = errors.New("unable to parse defined types") - errParseInterfaces = errors.New("unable to parse interfaces") - errParseFunctions = errors.New("unable to parse functions") - errParseEvents = errors.New("unable to parse events") - errParseConstructor = errors.New("unable to parse constructor") - errParseL1Handler = errors.New("unable to parse L1 handler") - errParseImplementedInterfaces = errors.New("unable to parse implemented interfaces") -) - -// Parse Starknet ABI from JSON -// @param abiJSON -// @param abiname -// @param classHash -func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, classHash []byte) (*StarknetABI, error) { - groupedAbi := GroupAbiByType(abiJson) - - // Parse defined types (structs and enums) - definedTypes, err := ParseEnumsAndStructs(groupedAbi["type_def"]) - if err != nil { - sortedDefs, errDef := TopoSortTypeDefs(groupedAbi["type_def"]) - if errDef == nil { - defineTypes, errDtypes := ParseEnumsAndStructs(sortedDefs) - definedTypes = defineTypes - errDef = errDtypes - } - if errDef != nil { - return nil, errParseDefinedTypes - } - log.Println("ABI Struct and Enum definitions out of order & required topological sorting") - } - - // Parse interfaces - var definedInterfaces []AbiInterface - for _, iface := range groupedAbi["interface"] { - functions := []AbiFunction{} - for _, funcData := range iface["items"].([]interface{}) { - parsedAbi, errWhileParsing := ParseAbiFunction(funcData.(map[string]interface{}), definedTypes) - if errWhileParsing != nil { - return nil, errParseInterfaces - } - functions = append(functions, *parsedAbi) - } - definedInterfaces = append(definedInterfaces, AbiInterface{ - name: iface["name"].(string), - functions: functions, - }) - } - - // Parse functions - functions := make(map[string]AbiFunction) - for _, functionData := range groupedAbi["function"] { - funcName := functionData["name"].(string) - abiFunc, errParsingFunctions := ParseAbiFunction(functionData, definedTypes) - if errParsingFunctions != nil { - return nil, errParseFunctions - } - functions[funcName] = *abiFunc - } - - // Add functions from interfaces - for _, iface := range definedInterfaces { - for _, function := range iface.functions { - functions[function.name] = function - } - } - - // Parse events - parsedAbiEvents := []AbiEvent{} - for _, eventData := range groupedAbi["event"] { - parsedEvent, errParsingEvent := ParseAbiEvent(eventData, definedTypes) - if errParsingEvent != nil { - return nil, errParseEvents - } - parsedAbiEvents = append(parsedAbiEvents, *parsedEvent) - } - - events := make(map[string]AbiEvent) - for _, event := range parsedAbiEvents { - if event.name != "" { - events[event.name] = event - } - } - - // Parse constructor - var constructor []AbiParameter - if len(groupedAbi["constructor"]) == 1 { - for _, paramData := range groupedAbi["constructor"][0]["inputs"].([]interface{}) { - param := paramData.(map[string]interface{}) - typed, errorParsingType := parseType(param["type"].(string), definedTypes) - if errorParsingType != nil { - return nil, errParseConstructor - } - constructor = append(constructor, AbiParameter{ - Name: param["name"].(string), - Type: typed, - }) - } - } else { - constructor = nil - } - - // Parse L1 handler - var l1Handler *AbiFunction - if len(groupedAbi["l1_handler"]) == 1 { - handler, errorParsingFunction := ParseAbiFunction(groupedAbi["l1_handler"][0], definedTypes) - if errorParsingFunction != nil { - return nil, errParseL1Handler - } - l1Handler = handler - } else { - l1Handler = nil - } - - // Parse implemented interfaces - implementedInterfaces := make(map[string]AbiInterface) - implArray, ok := groupedAbi["impl"] - if !ok { - return nil, errParseImplementedInterfaces - } - for _, implData := range implArray { - implMap := implData - if ifaceName, ok := implMap["interface_name"].(string); ok { - for _, iface := range definedInterfaces { - if iface.name == ifaceName { - implementedInterfaces[iface.name] = iface - } - } - } - } - - // Return the populated StarknetAbi struct - return &StarknetABI{ - ABIName: &abiName, - ClassHash: classHash, - Functions: functions, - Events: events, - Constructor: constructor, - L1Handler: l1Handler, - ImplementedInterfaces: implementedInterfaces, - }, nil -} +package athena_abi + +import ( + "errors" + "log" +) + +type StarknetABI struct { + ABIName *string + ClassHash []byte + Functions map[string]AbiFunction + Events map[string]AbiEvent + Constructor []AbiParameter + L1Handler *AbiFunction + ImplementedInterfaces map[string]AbiInterface +} + +// Declare errors +var ( + errParseDefinedTypes = errors.New("unable to parse defined types") + errParseInterfaces = errors.New("unable to parse interfaces") + errParseFunctions = errors.New("unable to parse functions") + errParseEvents = errors.New("unable to parse events") + errParseConstructor = errors.New("unable to parse constructor") + errParseL1Handler = errors.New("unable to parse L1 handler") + errParseImplementedInterfaces = errors.New("unable to parse implemented interfaces") +) + +// Parse Starknet ABI from JSON +// @param abiJSON +// @param abiname +// @param classHash +func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, classHash []byte) (*StarknetABI, error) { + groupedAbi := GroupAbiByType(abiJson) + + // Parse defined types (structs and enums) + definedTypes, err := ParseEnumsAndStructs(groupedAbi["type_def"]) + if err != nil { + sortedDefs, errDef := TopoSortTypeDefs(groupedAbi["type_def"]) + if errDef == nil { + defineTypes, errDtypes := ParseEnumsAndStructs(sortedDefs) + definedTypes = defineTypes + errDef = errDtypes + } + if errDef != nil { + return nil, errParseDefinedTypes + } + log.Println("ABI Struct and Enum definitions out of order & required topological sorting") + } + + // Parse interfaces + var definedInterfaces []AbiInterface + for _, iface := range groupedAbi["interface"] { + functions := []AbiFunction{} + for _, funcData := range iface["items"].([]interface{}) { + parsedAbi, errWhileParsing := ParseAbiFunction(funcData.(map[string]interface{}), definedTypes) + if errWhileParsing != nil { + return nil, errParseInterfaces + } + functions = append(functions, *parsedAbi) + } + definedInterfaces = append(definedInterfaces, AbiInterface{ + name: iface["name"].(string), + functions: functions, + }) + } + + // Parse functions + functions := make(map[string]AbiFunction) + for _, functionData := range groupedAbi["function"] { + funcName := functionData["name"].(string) + abiFunc, errParsingFunctions := ParseAbiFunction(functionData, definedTypes) + if errParsingFunctions != nil { + return nil, errParseFunctions + } + functions[funcName] = *abiFunc + } + + // Add functions from interfaces + for _, iface := range definedInterfaces { + for _, function := range iface.functions { + functions[function.name] = function + } + } + + // Parse events + parsedAbiEvents := []AbiEvent{} + for _, eventData := range groupedAbi["event"] { + parsedEvent, errParsingEvent := ParseAbiEvent(eventData, definedTypes) + if errParsingEvent != nil { + return nil, errParseEvents + } + parsedAbiEvents = append(parsedAbiEvents, *parsedEvent) + } + + events := make(map[string]AbiEvent) + for _, event := range parsedAbiEvents { + if event.name != "" { + events[event.name] = event + } + } + + // Parse constructor + var constructor []AbiParameter + if len(groupedAbi["constructor"]) == 1 { + for _, paramData := range groupedAbi["constructor"][0]["inputs"].([]interface{}) { + param := paramData.(map[string]interface{}) + typed, errorParsingType := parseType(param["type"].(string), definedTypes) + if errorParsingType != nil { + return nil, errParseConstructor + } + constructor = append(constructor, AbiParameter{ + Name: param["name"].(string), + Type: typed, + }) + } + } else { + constructor = nil + } + + // Parse L1 handler + var l1Handler *AbiFunction + if len(groupedAbi["l1_handler"]) == 1 { + handler, errorParsingFunction := ParseAbiFunction(groupedAbi["l1_handler"][0], definedTypes) + if errorParsingFunction != nil { + return nil, errParseL1Handler + } + l1Handler = handler + } else { + l1Handler = nil + } + + // Parse implemented interfaces + implementedInterfaces := make(map[string]AbiInterface) + implArray, ok := groupedAbi["impl"] + if !ok { + return nil, errParseImplementedInterfaces + } + for _, implData := range implArray { + implMap := implData + if ifaceName, ok := implMap["interface_name"].(string); ok { + for _, iface := range definedInterfaces { + if iface.name == ifaceName { + implementedInterfaces[iface.name] = iface + } + } + } + } + + // Return the populated StarknetAbi struct + return &StarknetABI{ + ABIName: &abiName, + ClassHash: classHash, + Functions: functions, + Events: events, + Constructor: constructor, + L1Handler: l1Handler, + ImplementedInterfaces: implementedInterfaces, + }, nil +} diff --git a/athena_abi/exceptions_test.go b/athena_abi/exceptions_test.go new file mode 100644 index 00000000..320d4d1a --- /dev/null +++ b/athena_abi/exceptions_test.go @@ -0,0 +1,47 @@ +package athena_abi + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestInvalidAbiError(t *testing.T) { + err := InvalidAbiError{Msg: "Invalid ABI format"} + expectedMsg := "Invalid ABI Error: Invalid ABI format" + + // Assert that the error message is as expected + assert.Equal(t, expectedMsg, err.Error(), "The error message for InvalidAbiError should match the expected message") +} + +func TestInvalidCalldataError(t *testing.T) { + err := InvalidCalldataError{Msg: "Not enough calldata to decode"} + expectedMsg := "Invalid Calldata Error: Not enough calldata to decode" + + // Assert that the error message is as expected + assert.Equal(t, expectedMsg, err.Error(), "The error message for InvalidCalldataError should match the expected message") +} + +func TestTypeDecodeError(t *testing.T) { + err := TypeDecodeError{Msg: "Failed to decode type"} + expectedMsg := "Type Decode Error: Failed to decode type" + + // Assert that the error message is as expected + assert.Equal(t, expectedMsg, err.Error(), "The error message for TypeDecodeError should match the expected message") +} + +func TestTypeEncodeError(t *testing.T) { + err := TypeEncodeError{Msg: "Failed to encode type"} + expectedMsg := "Type Encode Error: Failed to encode type" + + // Assert that the error message is as expected + assert.Equal(t, expectedMsg, err.Error(), "The error message for TypeEncodeError should match the expected message") +} + +func TestDispatcherDecodeError(t *testing.T) { + err := DispatcherDecodeError{Msg: "Failed to decode dispatcher"} + expectedMsg := "Dispatcher Decode Error: Failed to decode dispatcher" + + // Assert that the error message is as expected + assert.Equal(t, expectedMsg, err.Error(), "The error message for DispatcherDecodeError should match the expected message") +} From 1b3d6c32614f09e95c261f8fd55b0c1bb530c9d7 Mon Sep 17 00:00:00 2001 From: rishikpulhani Date: Tue, 24 Sep 2024 11:36:22 +0530 Subject: [PATCH 6/8] partially finished parse_full_abi_test.go --- athena_abi/abi.go | 16 +++ athena_abi/core.go | 42 ++++++- athena_abi/parse.go | 143 +++++++++++++++++------ athena_abi/parse_full_abi_test.go | 187 ++++++++++++++++++++++++++++++ athena_abi/parse_struct_test.go | 2 +- backup.txt | 90 ++++++++++++++ 6 files changed, 438 insertions(+), 42 deletions(-) create mode 100644 athena_abi/abi.go create mode 100644 athena_abi/parse_full_abi_test.go create mode 100644 backup.txt diff --git a/athena_abi/abi.go b/athena_abi/abi.go new file mode 100644 index 00000000..4d60821f --- /dev/null +++ b/athena_abi/abi.go @@ -0,0 +1,16 @@ +package athena_abi + +const FIRST_CLASS_HASH = "0x010455c752b86932ce552f2b0fe81a880746649b9aee7e0d842bf3f52378f9f8" +const FIRST_CLASS_ABI = `[{"members":[{"name":"index","offset":0,"type":"felt"},{"name":"values","offset":1,"type":"(felt,felt)"}],"name":"IndexAndValues","size":3,"type":"struct"},{"inputs":[{"name":"index","type":"felt"},{"name":"diffs_len","type":"felt"},{"name":"diffs","type":"felt*"}],"name":"advance_counter","outputs":[],"type":"function"},{"inputs":[{"name":"address","type":"felt"},{"name":"value","type":"felt"}],"name":"constructor","outputs":[],"type":"constructor"},{"inputs":[{"name":"index_and_x","type":"IndexAndValues"}],"name":"xor_counters","outputs":[],"type":"function"},{"inputs":[{"name":"address","type":"felt"},{"name":"index_and_x","type":"IndexAndValues"}],"name":"call_xor_counters","outputs":[],"type":"function"},{"inputs":[{"name":"index","type":"felt"}],"name":"add_signature_to_counters","outputs":[],"type":"function"},{"inputs":[{"name":"address","type":"felt"},{"name":"value","type":"felt"}],"name":"set_value","outputs":[],"type":"function"},{"inputs":[{"name":"address","type":"felt"}],"name":"get_value","outputs":[{"name":"res","type":"felt"}],"type":"function"},{"inputs":[],"name":"entry_point","outputs":[],"type":"function"},{"inputs":[],"name":"test_builtins","outputs":[{"name":"result","type":"felt"}],"type":"function"},{"inputs":[{"name":"to_address","type":"felt"}],"name":"send_message","outputs":[],"type":"function"},{"inputs":[{"name":"contract_address","type":"felt"},{"name":"function_selector","type":"felt"},{"name":"calldata_len","type":"felt"},{"name":"calldata","type":"felt*"}],"name":"test_call_contract","outputs":[],"type":"function"},{"inputs":[{"name":"contract_address","type":"felt"},{"name":"function_selector","type":"felt"},{"name":"calldata_len","type":"felt"},{"name":"calldata","type":"felt*"}],"name":"test_delegate_call","outputs":[],"type":"function"},{"inputs":[{"name":"from_address","type":"felt"},{"name":"amount","type":"felt"}],"name":"deposit","outputs":[],"type":"l1_handler"},{"inputs":[{"name":"expected_address","type":"felt"}],"name":"test_get_caller_address","outputs":[],"type":"function"},{"inputs":[{"name":"expected_address","type":"felt"}],"name":"test_get_sequencer_address","outputs":[],"type":"function"},{"inputs":[{"name":"expected_address","type":"felt"}],"name":"test_get_contract_address","outputs":[],"type":"function"},{"inputs":[{"name":"other_contract_address","type":"felt"},{"name":"address","type":"felt"}],"name":"test_call_storage_consistency","outputs":[],"type":"function"},{"inputs":[{"name":"other_contract_address","type":"felt"},{"name":"depth","type":"felt"}],"name":"test_re_entrance","outputs":[],"type":"function"},{"inputs":[{"name":"value","type":"felt"}],"name":"add_value","outputs":[],"type":"function"},{"inputs":[{"name":"self_address","type":"felt"},{"name":"value","type":"felt"}],"name":"recursive_add_value","outputs":[],"type":"function"},{"inputs":[{"name":"address","type":"felt"}],"name":"increase_value","outputs":[],"type":"function"},{"inputs":[{"name":"self_address","type":"felt"},{"name":"arr_len","type":"felt"},{"name":"arr","type":"felt*"}],"name":"test_call_with_array","outputs":[],"type":"function"}]` + +const STARKNET_USDC_CLASS_HASH = "0x05ffbcfeb50d200a0677c48a129a11245a3fc519d1d98d76882d1c9a1b19c6ed" +const STARKNET_USDC_ABI = `[{"type":"impl","name":"MintableToken","interface_name":"src::mintable_token_interface::IMintableToken"},{"type":"struct","name":"core::integer::u256","members":[{"name":"low","type":"core::integer::u128"},{"name":"high","type":"core::integer::u128"}]},{"type":"interface","name":"src::mintable_token_interface::IMintableToken","items":[{"type":"function","name":"permissioned_mint","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"permissioned_burn","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[],"state_mutability":"external"}]},{"type":"impl","name":"MintableTokenCamelImpl","interface_name":"src::mintable_token_interface::IMintableTokenCamel"},{"type":"interface","name":"src::mintable_token_interface::IMintableTokenCamel","items":[{"type":"function","name":"permissionedMint","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"permissionedBurn","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[],"state_mutability":"external"}]},{"type":"impl","name":"Replaceable","interface_name":"src::replaceability_interface::IReplaceable"},{"type":"struct","name":"core::array::Span::","members":[{"name":"snapshot","type":"@core::array::Array::"}]},{"type":"struct","name":"src::replaceability_interface::EICData","members":[{"name":"eic_hash","type":"core::starknet::class_hash::ClassHash"},{"name":"eic_init_data","type":"core::array::Span::"}]},{"type":"enum","name":"core::option::Option::","variants":[{"name":"Some","type":"src::replaceability_interface::EICData"},{"name":"None","type":"()"}]},{"type":"enum","name":"core::bool","variants":[{"name":"False","type":"()"},{"name":"True","type":"()"}]},{"type":"struct","name":"src::replaceability_interface::ImplementationData","members":[{"name":"impl_hash","type":"core::starknet::class_hash::ClassHash"},{"name":"eic_data","type":"core::option::Option::"},{"name":"final","type":"core::bool"}]},{"type":"interface","name":"src::replaceability_interface::IReplaceable","items":[{"type":"function","name":"get_upgrade_delay","inputs":[],"outputs":[{"type":"core::integer::u64"}],"state_mutability":"view"},{"type":"function","name":"get_impl_activation_time","inputs":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData"}],"outputs":[{"type":"core::integer::u64"}],"state_mutability":"view"},{"type":"function","name":"add_new_implementation","inputs":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"remove_implementation","inputs":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"replace_to","inputs":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData"}],"outputs":[],"state_mutability":"external"}]},{"type":"impl","name":"AccessControlImplExternal","interface_name":"src::access_control_interface::IAccessControl"},{"type":"interface","name":"src::access_control_interface::IAccessControl","items":[{"type":"function","name":"has_role","inputs":[{"name":"role","type":"core::felt252"},{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::bool"}],"state_mutability":"view"},{"type":"function","name":"get_role_admin","inputs":[{"name":"role","type":"core::felt252"}],"outputs":[{"type":"core::felt252"}],"state_mutability":"view"}]},{"type":"impl","name":"RolesImpl","interface_name":"src::roles_interface::IMinimalRoles"},{"type":"interface","name":"src::roles_interface::IMinimalRoles","items":[{"type":"function","name":"is_governance_admin","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::bool"}],"state_mutability":"view"},{"type":"function","name":"is_upgrade_governor","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::bool"}],"state_mutability":"view"},{"type":"function","name":"register_governance_admin","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"remove_governance_admin","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"register_upgrade_governor","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"remove_upgrade_governor","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"renounce","inputs":[{"name":"role","type":"core::felt252"}],"outputs":[],"state_mutability":"external"}]},{"type":"impl","name":"ERC20Impl","interface_name":"openzeppelin::token::erc20::interface::IERC20"},{"type":"interface","name":"openzeppelin::token::erc20::interface::IERC20","items":[{"type":"function","name":"name","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"view"},{"type":"function","name":"symbol","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"view"},{"type":"function","name":"decimals","inputs":[],"outputs":[{"type":"core::integer::u8"}],"state_mutability":"view"},{"type":"function","name":"total_supply","inputs":[],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"balance_of","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"allowance","inputs":[{"name":"owner","type":"core::starknet::contract_address::ContractAddress"},{"name":"spender","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"transfer","inputs":[{"name":"recipient","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"transfer_from","inputs":[{"name":"sender","type":"core::starknet::contract_address::ContractAddress"},{"name":"recipient","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"approve","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"}]},{"type":"impl","name":"ERC20CamelOnlyImpl","interface_name":"openzeppelin::token::erc20::interface::IERC20CamelOnly"},{"type":"interface","name":"openzeppelin::token::erc20::interface::IERC20CamelOnly","items":[{"type":"function","name":"totalSupply","inputs":[],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"balanceOf","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"transferFrom","inputs":[{"name":"sender","type":"core::starknet::contract_address::ContractAddress"},{"name":"recipient","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"}]},{"type":"constructor","name":"constructor","inputs":[{"name":"name","type":"core::felt252"},{"name":"symbol","type":"core::felt252"},{"name":"decimals","type":"core::integer::u8"},{"name":"initial_supply","type":"core::integer::u256"},{"name":"recipient","type":"core::starknet::contract_address::ContractAddress"},{"name":"permitted_minter","type":"core::starknet::contract_address::ContractAddress"},{"name":"provisional_governance_admin","type":"core::starknet::contract_address::ContractAddress"},{"name":"upgrade_delay","type":"core::integer::u64"}]},{"type":"function","name":"increase_allowance","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"added_value","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"decrease_allowance","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"subtracted_value","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"increaseAllowance","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"addedValue","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"decreaseAllowance","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"subtractedValue","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"event","name":"openzeppelin::token::erc20_v070::erc20::ERC20::Transfer","kind":"struct","members":[{"name":"from","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"to","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"value","type":"core::integer::u256","kind":"data"}]},{"type":"event","name":"openzeppelin::token::erc20_v070::erc20::ERC20::Approval","kind":"struct","members":[{"name":"owner","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"spender","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"value","type":"core::integer::u256","kind":"data"}]},{"type":"event","name":"src::replaceability_interface::ImplementationAdded","kind":"struct","members":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData","kind":"data"}]},{"type":"event","name":"src::replaceability_interface::ImplementationRemoved","kind":"struct","members":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData","kind":"data"}]},{"type":"event","name":"src::replaceability_interface::ImplementationReplaced","kind":"struct","members":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData","kind":"data"}]},{"type":"event","name":"src::replaceability_interface::ImplementationFinalized","kind":"struct","members":[{"name":"impl_hash","type":"core::starknet::class_hash::ClassHash","kind":"data"}]},{"type":"event","name":"src::access_control_interface::RoleGranted","kind":"struct","members":[{"name":"role","type":"core::felt252","kind":"data"},{"name":"account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"sender","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::access_control_interface::RoleRevoked","kind":"struct","members":[{"name":"role","type":"core::felt252","kind":"data"},{"name":"account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"sender","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::access_control_interface::RoleAdminChanged","kind":"struct","members":[{"name":"role","type":"core::felt252","kind":"data"},{"name":"previous_admin_role","type":"core::felt252","kind":"data"},{"name":"new_admin_role","type":"core::felt252","kind":"data"}]},{"type":"event","name":"src::roles_interface::GovernanceAdminAdded","kind":"struct","members":[{"name":"added_account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"added_by","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::roles_interface::GovernanceAdminRemoved","kind":"struct","members":[{"name":"removed_account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"removed_by","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::roles_interface::UpgradeGovernorAdded","kind":"struct","members":[{"name":"added_account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"added_by","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::roles_interface::UpgradeGovernorRemoved","kind":"struct","members":[{"name":"removed_account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"removed_by","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"openzeppelin::token::erc20_v070::erc20::ERC20::Event","kind":"enum","variants":[{"name":"Transfer","type":"openzeppelin::token::erc20_v070::erc20::ERC20::Transfer","kind":"nested"},{"name":"Approval","type":"openzeppelin::token::erc20_v070::erc20::ERC20::Approval","kind":"nested"},{"name":"ImplementationAdded","type":"src::replaceability_interface::ImplementationAdded","kind":"nested"},{"name":"ImplementationRemoved","type":"src::replaceability_interface::ImplementationRemoved","kind":"nested"},{"name":"ImplementationReplaced","type":"src::replaceability_interface::ImplementationReplaced","kind":"nested"},{"name":"ImplementationFinalized","type":"src::replaceability_interface::ImplementationFinalized","kind":"nested"},{"name":"RoleGranted","type":"src::access_control_interface::RoleGranted","kind":"nested"},{"name":"RoleRevoked","type":"src::access_control_interface::RoleRevoked","kind":"nested"},{"name":"RoleAdminChanged","type":"src::access_control_interface::RoleAdminChanged","kind":"nested"},{"name":"GovernanceAdminAdded","type":"src::roles_interface::GovernanceAdminAdded","kind":"nested"},{"name":"GovernanceAdminRemoved","type":"src::roles_interface::GovernanceAdminRemoved","kind":"nested"},{"name":"UpgradeGovernorAdded","type":"src::roles_interface::UpgradeGovernorAdded","kind":"nested"},{"name":"UpgradeGovernorRemoved","type":"src::roles_interface::UpgradeGovernorRemoved","kind":"nested"}]}]` + +const STARKNET_ETH_CLASS_HASH = "0x05ffbcfeb50d200a0677c48a129a11245a3fc519d1d98d76882d1c9a1b19c6ed" +const STARKNET_ETH_ABI = `[{"type":"impl","name":"MintableToken","interface_name":"src::mintable_token_interface::IMintableToken"},{"type":"struct","name":"core::integer::u256","members":[{"name":"low","type":"core::integer::u128"},{"name":"high","type":"core::integer::u128"}]},{"type":"interface","name":"src::mintable_token_interface::IMintableToken","items":[{"type":"function","name":"permissioned_mint","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"permissioned_burn","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[],"state_mutability":"external"}]},{"type":"impl","name":"MintableTokenCamelImpl","interface_name":"src::mintable_token_interface::IMintableTokenCamel"},{"type":"interface","name":"src::mintable_token_interface::IMintableTokenCamel","items":[{"type":"function","name":"permissionedMint","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"permissionedBurn","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[],"state_mutability":"external"}]},{"type":"impl","name":"Replaceable","interface_name":"src::replaceability_interface::IReplaceable"},{"type":"struct","name":"core::array::Span::","members":[{"name":"snapshot","type":"@core::array::Array::"}]},{"type":"struct","name":"src::replaceability_interface::EICData","members":[{"name":"eic_hash","type":"core::starknet::class_hash::ClassHash"},{"name":"eic_init_data","type":"core::array::Span::"}]},{"type":"enum","name":"core::option::Option::","variants":[{"name":"Some","type":"src::replaceability_interface::EICData"},{"name":"None","type":"()"}]},{"type":"enum","name":"core::bool","variants":[{"name":"False","type":"()"},{"name":"True","type":"()"}]},{"type":"struct","name":"src::replaceability_interface::ImplementationData","members":[{"name":"impl_hash","type":"core::starknet::class_hash::ClassHash"},{"name":"eic_data","type":"core::option::Option::"},{"name":"final","type":"core::bool"}]},{"type":"interface","name":"src::replaceability_interface::IReplaceable","items":[{"type":"function","name":"get_upgrade_delay","inputs":[],"outputs":[{"type":"core::integer::u64"}],"state_mutability":"view"},{"type":"function","name":"get_impl_activation_time","inputs":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData"}],"outputs":[{"type":"core::integer::u64"}],"state_mutability":"view"},{"type":"function","name":"add_new_implementation","inputs":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"remove_implementation","inputs":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"replace_to","inputs":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData"}],"outputs":[],"state_mutability":"external"}]},{"type":"impl","name":"AccessControlImplExternal","interface_name":"src::access_control_interface::IAccessControl"},{"type":"interface","name":"src::access_control_interface::IAccessControl","items":[{"type":"function","name":"has_role","inputs":[{"name":"role","type":"core::felt252"},{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::bool"}],"state_mutability":"view"},{"type":"function","name":"get_role_admin","inputs":[{"name":"role","type":"core::felt252"}],"outputs":[{"type":"core::felt252"}],"state_mutability":"view"}]},{"type":"impl","name":"RolesImpl","interface_name":"src::roles_interface::IMinimalRoles"},{"type":"interface","name":"src::roles_interface::IMinimalRoles","items":[{"type":"function","name":"is_governance_admin","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::bool"}],"state_mutability":"view"},{"type":"function","name":"is_upgrade_governor","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::bool"}],"state_mutability":"view"},{"type":"function","name":"register_governance_admin","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"remove_governance_admin","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"register_upgrade_governor","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"remove_upgrade_governor","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"renounce","inputs":[{"name":"role","type":"core::felt252"}],"outputs":[],"state_mutability":"external"}]},{"type":"impl","name":"ERC20Impl","interface_name":"openzeppelin::token::erc20::interface::IERC20"},{"type":"interface","name":"openzeppelin::token::erc20::interface::IERC20","items":[{"type":"function","name":"name","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"view"},{"type":"function","name":"symbol","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"view"},{"type":"function","name":"decimals","inputs":[],"outputs":[{"type":"core::integer::u8"}],"state_mutability":"view"},{"type":"function","name":"total_supply","inputs":[],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"balance_of","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"allowance","inputs":[{"name":"owner","type":"core::starknet::contract_address::ContractAddress"},{"name":"spender","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"transfer","inputs":[{"name":"recipient","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"transfer_from","inputs":[{"name":"sender","type":"core::starknet::contract_address::ContractAddress"},{"name":"recipient","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"approve","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"}]},{"type":"impl","name":"ERC20CamelOnlyImpl","interface_name":"openzeppelin::token::erc20::interface::IERC20CamelOnly"},{"type":"interface","name":"openzeppelin::token::erc20::interface::IERC20CamelOnly","items":[{"type":"function","name":"totalSupply","inputs":[],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"balanceOf","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"}],"outputs":[{"type":"core::integer::u256"}],"state_mutability":"view"},{"type":"function","name":"transferFrom","inputs":[{"name":"sender","type":"core::starknet::contract_address::ContractAddress"},{"name":"recipient","type":"core::starknet::contract_address::ContractAddress"},{"name":"amount","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"}]},{"type":"constructor","name":"constructor","inputs":[{"name":"name","type":"core::felt252"},{"name":"symbol","type":"core::felt252"},{"name":"decimals","type":"core::integer::u8"},{"name":"initial_supply","type":"core::integer::u256"},{"name":"recipient","type":"core::starknet::contract_address::ContractAddress"},{"name":"permitted_minter","type":"core::starknet::contract_address::ContractAddress"},{"name":"provisional_governance_admin","type":"core::starknet::contract_address::ContractAddress"},{"name":"upgrade_delay","type":"core::integer::u64"}]},{"type":"function","name":"increase_allowance","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"added_value","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"decrease_allowance","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"subtracted_value","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"increaseAllowance","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"addedValue","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"function","name":"decreaseAllowance","inputs":[{"name":"spender","type":"core::starknet::contract_address::ContractAddress"},{"name":"subtractedValue","type":"core::integer::u256"}],"outputs":[{"type":"core::bool"}],"state_mutability":"external"},{"type":"event","name":"openzeppelin::token::erc20_v070::erc20::ERC20::Transfer","kind":"struct","members":[{"name":"from","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"to","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"value","type":"core::integer::u256","kind":"data"}]},{"type":"event","name":"openzeppelin::token::erc20_v070::erc20::ERC20::Approval","kind":"struct","members":[{"name":"owner","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"spender","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"value","type":"core::integer::u256","kind":"data"}]},{"type":"event","name":"src::replaceability_interface::ImplementationAdded","kind":"struct","members":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData","kind":"data"}]},{"type":"event","name":"src::replaceability_interface::ImplementationRemoved","kind":"struct","members":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData","kind":"data"}]},{"type":"event","name":"src::replaceability_interface::ImplementationReplaced","kind":"struct","members":[{"name":"implementation_data","type":"src::replaceability_interface::ImplementationData","kind":"data"}]},{"type":"event","name":"src::replaceability_interface::ImplementationFinalized","kind":"struct","members":[{"name":"impl_hash","type":"core::starknet::class_hash::ClassHash","kind":"data"}]},{"type":"event","name":"src::access_control_interface::RoleGranted","kind":"struct","members":[{"name":"role","type":"core::felt252","kind":"data"},{"name":"account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"sender","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::access_control_interface::RoleRevoked","kind":"struct","members":[{"name":"role","type":"core::felt252","kind":"data"},{"name":"account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"sender","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::access_control_interface::RoleAdminChanged","kind":"struct","members":[{"name":"role","type":"core::felt252","kind":"data"},{"name":"previous_admin_role","type":"core::felt252","kind":"data"},{"name":"new_admin_role","type":"core::felt252","kind":"data"}]},{"type":"event","name":"src::roles_interface::GovernanceAdminAdded","kind":"struct","members":[{"name":"added_account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"added_by","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::roles_interface::GovernanceAdminRemoved","kind":"struct","members":[{"name":"removed_account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"removed_by","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::roles_interface::UpgradeGovernorAdded","kind":"struct","members":[{"name":"added_account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"added_by","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"src::roles_interface::UpgradeGovernorRemoved","kind":"struct","members":[{"name":"removed_account","type":"core::starknet::contract_address::ContractAddress","kind":"data"},{"name":"removed_by","type":"core::starknet::contract_address::ContractAddress","kind":"data"}]},{"type":"event","name":"openzeppelin::token::erc20_v070::erc20::ERC20::Event","kind":"enum","variants":[{"name":"Transfer","type":"openzeppelin::token::erc20_v070::erc20::ERC20::Transfer","kind":"nested"},{"name":"Approval","type":"openzeppelin::token::erc20_v070::erc20::ERC20::Approval","kind":"nested"},{"name":"ImplementationAdded","type":"src::replaceability_interface::ImplementationAdded","kind":"nested"},{"name":"ImplementationRemoved","type":"src::replaceability_interface::ImplementationRemoved","kind":"nested"},{"name":"ImplementationReplaced","type":"src::replaceability_interface::ImplementationReplaced","kind":"nested"},{"name":"ImplementationFinalized","type":"src::replaceability_interface::ImplementationFinalized","kind":"nested"},{"name":"RoleGranted","type":"src::access_control_interface::RoleGranted","kind":"nested"},{"name":"RoleRevoked","type":"src::access_control_interface::RoleRevoked","kind":"nested"},{"name":"RoleAdminChanged","type":"src::access_control_interface::RoleAdminChanged","kind":"nested"},{"name":"GovernanceAdminAdded","type":"src::roles_interface::GovernanceAdminAdded","kind":"nested"},{"name":"GovernanceAdminRemoved","type":"src::roles_interface::GovernanceAdminRemoved","kind":"nested"},{"name":"UpgradeGovernorAdded","type":"src::roles_interface::UpgradeGovernorAdded","kind":"nested"},{"name":"UpgradeGovernorRemoved","type":"src::roles_interface::UpgradeGovernorRemoved","kind":"nested"}]}]` + +const NO_STRUCT_CLASS_HASH = "0x03c5ace9d7b61e976247182246cf11ff0df039ecee1e0e37296b73bcb207b77d" +const NO_STRUCT_ABI_DEFINITION = `[{"type":"function","name":"get_account_token_balance","inputs":[{"name":"account","type":"core::starknet::contract_address::ContractAddress"},{"name":"token_type","type":"core::felt252"}],"outputs":[{"type":"core::integer::u128"}],"state_mutability":"view"},{"type":"function","name":"get_pool_token_balance","inputs":[{"name":"token_type","type":"core::felt252"}],"outputs":[{"type":"core::integer::u128"}],"state_mutability":"view"},{"type":"function","name":"set_pool_token_balance","inputs":[{"name":"token_type","type":"core::felt252"},{"name":"balance","type":"core::integer::u128"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"add_demo_token","inputs":[{"name":"token_a_amount","type":"core::integer::u128"},{"name":"token_b_amount","type":"core::integer::u128"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"init_pool","inputs":[{"name":"token_a","type":"core::integer::u128"},{"name":"token_b","type":"core::integer::u128"}],"outputs":[],"state_mutability":"external"},{"type":"function","name":"swap","inputs":[{"name":"token_from","type":"core::felt252"},{"name":"amount_from","type":"core::integer::u128"}],"outputs":[],"state_mutability":"external"}]` + +const VERSION_0_CLASS_HASH = "0x0305ee7a74fc480b0ec54bb306ab32d23da2b6c9b307423d23370eb5351220c3" +const VERSION_0_ABI_DEFINITION = `[{"members":[{"name":"low","offset":0,"type":"felt"},{"name":"high","offset":1,"type":"felt"}],"name":"Uint256","size":2,"type":"struct"},{"data":[{"name":"role","type":"felt"},{"name":"account","type":"felt"}],"keys":[],"name":"RoleGranted","type":"event"},{"data":[{"name":"role","type":"felt"},{"name":"account","type":"felt"}],"keys":[],"name":"RoleRevoked","type":"event"},{"inputs":[{"name":"owner","type":"felt"}],"name":"initialize","outputs":[],"type":"function"},{"inputs":[{"name":"implementation","type":"felt"}],"name":"upgrade","outputs":[],"type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"name":"role","type":"felt"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"name":"owner","type":"felt"}],"stateMutability":"view","type":"function"},{"inputs":[{"name":"role","type":"felt"},{"name":"index","type":"felt"}],"name":"getRoleMember","outputs":[{"name":"account","type":"felt"}],"stateMutability":"view","type":"function"},{"inputs":[{"name":"role","type":"felt"}],"name":"getRoleMemberCount","outputs":[{"name":"count","type":"felt"}],"stateMutability":"view","type":"function"},{"inputs":[{"name":"role","type":"felt"},{"name":"account","type":"felt"}],"name":"hasRole","outputs":[{"name":"has_role","type":"felt"}],"stateMutability":"view","type":"function"},{"inputs":[{"name":"artist_name","type":"Uint256"}],"name":"artistExists","outputs":[{"name":"res","type":"felt"}],"stateMutability":"view","type":"function"},{"inputs":[{"name":"account","type":"felt"}],"name":"addMinter","outputs":[],"type":"function"},{"inputs":[{"name":"account","type":"felt"}],"name":"revokeMinter","outputs":[],"type":"function"},{"inputs":[{"name":"artist_name","type":"Uint256"}],"name":"createArtist","outputs":[],"type":"function"},{"inputs":[{"name":"new_owner","type":"felt"}],"name":"transferOwnership","outputs":[{"name":"new_owner","type":"felt"}],"type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"type":"function"}]` diff --git a/athena_abi/core.go b/athena_abi/core.go index a0cda58e..b6058a5b 100644 --- a/athena_abi/core.go +++ b/athena_abi/core.go @@ -2,6 +2,7 @@ package athena_abi import ( "errors" + "fmt" "log" ) @@ -34,7 +35,11 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class groupedAbi := GroupAbiByType(abiJson) // Parse defined types (structs and enums) + fmt.Println("hello") + fmt.Println("grouped abi", groupedAbi["type_def"]) definedTypes, err := ParseEnumsAndStructs(groupedAbi["type_def"]) + fmt.Println("defined types Map contents:", definedTypes) + fmt.Println("is there error", err) if err != nil { sortedDefs, errDef := TopoSortTypeDefs(groupedAbi["type_def"]) if errDef == nil { @@ -50,6 +55,7 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse interfaces var definedInterfaces []AbiInterface + fmt.Println("now parsing interfaces") for _, iface := range groupedAbi["interface"] { functions := []AbiFunction{} for _, funcData := range iface["items"].([]interface{}) { @@ -67,6 +73,7 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse functions functions := make(map[string]AbiFunction) + fmt.Println("now parsing functions") for _, functionData := range groupedAbi["function"] { funcName := functionData["name"].(string) abiFunc, errParsingFunctions := ParseAbiFunction(functionData, definedTypes) @@ -85,15 +92,28 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse events parsedAbiEvents := []AbiEvent{} + fmt.Println("now parsing events") for _, eventData := range groupedAbi["event"] { + fmt.Println("eventdata is ", eventData) parsedEvent, errParsingEvent := ParseAbiEvent(eventData, definedTypes) + fmt.Println("parsed event is ", parsedEvent) + fmt.Println("the err is ", errParsingEvent) + if errParsingEvent != nil { return nil, errParseEvents } - parsedAbiEvents = append(parsedAbiEvents, *parsedEvent) + //parsedAbiEvents = append(parsedAbiEvents, *parsedEvent) + if parsedEvent != nil { + parsedAbiEvents = append(parsedAbiEvents, *parsedEvent) + } else { + // Handle the nil case if necessary + //return nil, errors.New("parsed event is nil") + continue + } } events := make(map[string]AbiEvent) + fmt.Println("parsedabievents are ", parsedAbiEvents) for _, event := range parsedAbiEvents { if event.name != "" { events[event.name] = event @@ -102,6 +122,7 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse constructor var constructor []AbiParameter + fmt.Println("now parsing constructor") if len(groupedAbi["constructor"]) == 1 { for _, paramData := range groupedAbi["constructor"][0]["inputs"].([]interface{}) { param := paramData.(map[string]interface{}) @@ -120,6 +141,7 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse L1 handler var l1Handler *AbiFunction + fmt.Println("now parsing l1handler") if len(groupedAbi["l1_handler"]) == 1 { handler, errorParsingFunction := ParseAbiFunction(groupedAbi["l1_handler"][0], definedTypes) if errorParsingFunction != nil { @@ -132,9 +154,11 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse implemented interfaces implementedInterfaces := make(map[string]AbiInterface) + fmt.Println("now parsing implemented interfaces") implArray, ok := groupedAbi["impl"] if !ok { - return nil, errParseImplementedInterfaces + //return nil, errParseImplementedInterfaces + //this if block is not required } for _, implData := range implArray { implMap := implData @@ -146,7 +170,19 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class } } } - + fmt.Println("abi name : ", abiName) + fmt.Println("classhash is : ", classHash) + fmt.Println() + fmt.Println("functions is : ", functions) + fmt.Println() + fmt.Println("events is : ", events) + fmt.Println() + fmt.Println("constructor is : ", constructor) + fmt.Println() + fmt.Println("l1handles is ", l1Handler) + fmt.Println() + fmt.Println("implemented interfaces is : ", implementedInterfaces) + fmt.Println() // Return the populated StarknetAbi struct return &StarknetABI{ ABIName: &abiName, diff --git a/athena_abi/parse.go b/athena_abi/parse.go index 83b0e8a3..46c12f67 100644 --- a/athena_abi/parse.go +++ b/athena_abi/parse.go @@ -2,6 +2,7 @@ package athena_abi import ( "fmt" + "reflect" "strings" ) @@ -20,8 +21,10 @@ func GroupAbiByType(abiJson []map[string]interface{}) map[AbiMemberType][]map[st // Convert the string to AbiMemberType if typeStr == "struct" || typeStr == "enum" { + fmt.Println("the types string value is ", typeStr) grouped["type_def"] = append(grouped["type_def"], entry) } else { + fmt.Println("the types string value is ", typeStr) grouped[AbiMemberType(typeStr)] = append(grouped[AbiMemberType(typeStr)], entry) } @@ -148,6 +151,8 @@ func ParseEnumsAndStructs(abiStructs []map[string]interface{}) (map[string]inter switch abiStruct["type"] { case "struct": + fmt.Println("a") + fmt.Println("abistruct is", abiStruct) res, err := parseStruct(abiStruct, outputTypes) if err != nil { return nil, err @@ -155,6 +160,7 @@ func ParseEnumsAndStructs(abiStructs []map[string]interface{}) (map[string]inter outputTypes[typeName] = res case "enum": + fmt.Println("d") res, err := parseEnum(abiStruct, outputTypes) if err != nil { return nil, err @@ -182,7 +188,10 @@ func parseStruct(abiStruct map[string]interface{}, typeContext map[string]interf } // Parse the member type + fmt.Println("b") + fmt.Println("thetypes are ", member["type"]) res, err := parseType(member["type"].(string), typeContext) + fmt.Println("res is ", res) if err != nil { return StarknetStruct{}, err } @@ -246,7 +255,9 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType } if strings.HasPrefix(abiType, "(") { + fmt.Println("the abitype for parsetuple input is", abiType) res, err := ParseTuple(abiType, customTypes) + fmt.Println("the result afternparsing the tuple is ", res) if err != nil { return nil, err } @@ -255,8 +266,11 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType /*if strings.HasPrefix(abiType, "(") && strings.HasSuffix(abiType, ")") { return ParseTuple(abiType, customTypes) }*/ - + fmt.Println("abitype is", abiType) parts := strings.Split(abiType, "::")[1:] + fmt.Println("c") + fmt.Println(parts) + switch { case len(parts) == 1 && parts[0] == "felt252": return Felt, nil @@ -272,7 +286,8 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType return Bytes31, nil case len(parts) == 3 && parts[0] == "starknet" && parts[1] == "storage_access" && parts[2] == "StorageAddress": return StorageAddress, nil - case len(parts) >= 2 && parts[0] == "array" && parts[1] == "Array" || parts[1] == "Span": + case len(parts) >= 2 && (parts[0] == "array" && parts[1] == "Array" || parts[1] == "Span"): + //case len(parts) >= 2 && parts[0] res, err := parseType(extractInnerType(abiType), customTypes) if err != nil { return nil, err @@ -298,25 +313,28 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType } return intType, nil default: + fmt.Println("the lenght of abitype in the default for v1 is ", len(abiType)) + abiType := strings.TrimSpace(abiType) if val, exists := customTypes[abiType]; exists { return val.(StarknetType), nil - } - if abiType == "felt" { + } else if abiType == "felt" { + fmt.Println("this was run correctly") return Felt, nil - } - if abiType == "Uint256" { + } else if abiType == "Uint256" { return U256, nil - } - if strings.HasSuffix(abiType, "*") { + } else if strings.HasSuffix(abiType, "*") { res, err := parseType(strings.TrimSuffix(abiType, "*"), customTypes) if err != nil { return nil, err } return StarknetArray{res}, nil + } else { + fmt.Println("hey hi this was executed and the value if abitype is ", abiType) + return nil, &InvalidAbiError{ + Msg: "Invalid ABI type: " + abiType, + } } - return nil, &InvalidAbiError{ - Msg: "Invalid ABI type: " + abiType, - } + } } @@ -338,64 +356,51 @@ func isNamedTuple(typeStr string) int { // customTypes is a map from string to StarknetStruct or StarknetEnum func ParseTuple(abiType string, customTypes map[string]interface{}) (StarknetTuple, error) { trimmed := strings.TrimSpace(abiType) + fmt.Println("trrimmed tuopls is", trimmed) strippedTuple := strings.TrimSpace(trimmed[1 : len(trimmed)-1]) - + fmt.Println("stripped tuples is", strippedTuple) outputTypes := []StarknetType{} parenthesisCache := []string{} typeCache := []string{} for _, typeString := range strings.Split(strippedTuple, ",") { - tupleOpen := strings.Count(typeString, "(") tupleClose := strings.Count(typeString, ")") - if tupleOpen > 0 { - for i := 0; i < tupleOpen; i++ { parenthesisCache = append(parenthesisCache, "(") } - } - if len(parenthesisCache) > 0 { typeCache = append(typeCache, typeString) - } else { if isNamedTuple(typeString) > 0 { res, err := parseType(typeString[isNamedTuple(typeString)+1:], customTypes) - if err != nil { - return StarknetTuple{}, err - } outputTypes = append(outputTypes, res) - } else { res, err := parseType(typeString, customTypes) - if err != nil { - return StarknetTuple{}, err } + fmt.Print("the res in tuple parsing is", res) outputTypes = append(outputTypes, res) - } } - if tupleClose > 0 { parenthesisCache = parenthesisCache[:len(parenthesisCache)-tupleClose] - if len(parenthesisCache) == 0 { res, err := ParseTuple(strings.Join(typeCache, ","), customTypes) - if err != nil { - + fmt.Println("error reported") return StarknetTuple{}, err } outputTypes = append(outputTypes, res) } } } + fmt.Println("the output in tuple parsing is ", outputTypes) return StarknetTuple{Members: outputTypes}, nil } @@ -449,11 +454,16 @@ func ParseAbiTypes(types []string, customTypes map[string]interface{}) ([]Starkn func ParseAbiFunction(abiFunction map[string]interface{}, customTypes map[string]interface{}) (*AbiFunction, error) { names := []string{} types := []string{} - for _, abiInput := range abiFunction["inputs"].([]map[string]interface{}) { + /*for _, abiInput := range abiFunction["inputs"].([]map[string]interface{}) { names = append(names, abiInput["name"].(string)) + }*/ + for _, abiInput := range abiFunction["inputs"].([]interface{}) { + inputMap := abiInput.(map[string]interface{}) // Assert each element as map[string]interface{} + names = append(names, inputMap["name"].(string)) } - for _, abiInput := range abiFunction["inputs"].([]map[string]interface{}) { - types = append(types, abiInput["type"].(string)) + for _, abiInput := range abiFunction["inputs"].([]interface{}) { + inputMap := abiInput.(map[string]interface{}) + types = append(types, inputMap["type"].(string)) } parsedInputs, err := parseAbiParameters( names, @@ -464,8 +474,12 @@ func ParseAbiFunction(abiFunction map[string]interface{}, customTypes map[string return nil, err } - for _, abiOutput := range abiFunction["outputs"].([]map[string]interface{}) { + /*for _, abiOutput := range abiFunction["outputs"].([]map[string]interface{}) { types = append(types, abiOutput["type"].(string)) + }*/ + for _, abiOutput := range abiFunction["outputs"].([]interface{}) { + outputMap := abiOutput.(map[string]interface{}) + types = append(types, outputMap["type"].(string)) } parsedOutputs, err := ParseAbiTypes( @@ -485,10 +499,18 @@ func ParseAbiFunction(abiFunction map[string]interface{}, customTypes map[string func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]interface{}) (*AbiEvent, error) { eventParameters := []map[string]interface{}{} + fmt.Print("the abievent is", abiEvent) if value, exists := abiEvent["kind"]; exists { if value == "struct" { - eventParameters = abiEvent["members"].([]map[string]interface{}) + //eventParameters = abiEvent["members"].([]map[string]interface{}) + eventMembers := abiEvent["members"].([]interface{}) // Assert as []interface{} + eventParameters := make([]map[string]interface{}, len(eventMembers)) + + for i, member := range eventMembers { + eventParameters[i] = member.(map[string]interface{}) // Assert each element as map[string]interface{} + } } else { + fmt.Print("in parsig abi event the else1 nil was there") return nil, nil } } else if inputs, ok := abiEvent["inputs"].([]map[string]interface{}); ok { @@ -499,28 +521,73 @@ func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]inter } eventParameters = append(eventParameters, eventParameter) } - } else if data, ok := abiEvent["data"].([]map[string]interface{}); ok { - for _, e := range data { + } else if data, ok := abiEvent["data"].([]interface{}); ok { + fmt.Println(ok) + var result []map[string]interface{} + for _, item := range data { + fmt.Println("item is of type ", reflect.TypeOf(item)) + fmt.Println("result is of type ", reflect.TypeOf(result)) + // Assert the type of item + if m, ok := item.(map[string]interface{}); ok { + result = append(result, m) + } else { + // Handle the case where the item is not of the expected type + fmt.Println("Item is not of type map[string]interface{}:", item) + } + } + for _, e := range result { + fmt.Println(e) eventParameter := map[string]interface{}{"kind": "data"} for k, v := range e { eventParameter[k] = v } eventParameters = append(eventParameters, eventParameter) } - for _, e := range abiEvent["keys"].([]map[string]interface{}) { + /*for _, e := range abiEvent["keys"].([]map[string]interface{}) { eventParameter := map[string]interface{}{"kind": "key"} for k, v := range e { eventParameter[k] = v } eventParameters = append(eventParameters, eventParameter) + }*/ + if keys, ok := abiEvent["keys"].([]interface{}); ok { + var keyres []map[string]interface{} + fmt.Println("keys is of type ", reflect.TypeOf(abiEvent["keys"])) + fmt.Println("result is of type ", reflect.TypeOf(result)) + for _, key := range keys { + fmt.Println("item is of type ", reflect.TypeOf(key)) + fmt.Println("result is of type ", reflect.TypeOf(keyres)) + // Assert the type of item + if m, ok := key.(map[string]interface{}); ok { + keyres = append(keyres, m) + } else { + // Handle the case where the item is not of the expected type + fmt.Println("Item is not of type map[string]interface{}:", key) + } + } + for _, e := range keyres { + fmt.Println(e) + eventParameter := map[string]interface{}{"kind": "key"} + for k, v := range e { + eventParameter[k] = v + } + eventParameters = append(eventParameters, eventParameter) + } } + } else { + fmt.Println("the type is ", reflect.TypeOf(abiEvent["data"])) + fmt.Println("the data is ", abiEvent["data"]) + data, ok := abiEvent["data"].([]map[string]interface{}) + fmt.Println("data is", data) + fmt.Println("ok is ", ok) + fmt.Print("in parsig abi event the else2 nil was there") return nil, nil } types := []string{} names := []string{} - + fmt.Println("hey hey hey the value of eventparameters is ", eventParameters) for _, eventParameter := range eventParameters { types = append(types, eventParameter["type"].(string)) names = append(names, eventParameter["name"].(string)) diff --git a/athena_abi/parse_full_abi_test.go b/athena_abi/parse_full_abi_test.go new file mode 100644 index 00000000..3b998e70 --- /dev/null +++ b/athena_abi/parse_full_abi_test.go @@ -0,0 +1,187 @@ +package athena_abi + +import ( + "encoding/hex" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestFunctionSignatures(t *testing.T) { + + transfer := NewAbiFunction("transfer", []AbiParameter{ + {Name: "recipient", Type: ContractAddress}, + {Name: "amount", Type: U256}, + }, []StarknetType{Bool}, "") + + assert.Equal(t, "Function(recipient:ContractAddress,amount:U256) -> (Bool)", transfer.idStr()) + + expectedSignature := "0083afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e" + assert.Equal(t, expectedSignature, hex.EncodeToString(transfer.signature)) +} + +func TestEventSignatures(t *testing.T) { + transfer := NewAbiEvent( + "Transfer", + []string{"from", "to", "amount"}, + map[string]StarknetType{ + "from": ContractAddress, + "to": ContractAddress, + "amount": U256, + }, + make(map[string]StarknetType), + "", + ) + idStr, err := transfer.idStr() + assert.NoError(t, err, "Error getting id string") + + assert.Equal(t, "Event(from:ContractAddress,to:ContractAddress,amount:U256)", idStr, "Unexpected id string") + + expectedSignature := "0099cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9" + assert.Equal(t, expectedSignature, hex.EncodeToString(transfer.signature), "Unexpected signature") +} + +func TestKeyEventSignature(t *testing.T) { + transfer := NewAbiEvent( + "Transfer", + []string{"from", "to", "amount"}, + map[string]StarknetType{ + "amount": U256, + }, + map[string]StarknetType{ + "from": ContractAddress, + "to": ContractAddress, + }, + "", + ) + + expectedIDStr := "Event(:ContractAddress,:ContractAddress,amount:U256)" + actualIDStr, _ := transfer.idStr() + + assert.Equal(t, expectedIDStr, actualIDStr, "ID strings should match") + + expectedSignatureHex := "0099cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9" + actualSignatureHex := hex.EncodeToString(transfer.signature) + + assert.Equal(t, expectedSignatureHex, actualSignatureHex, "Signatures should match") +} + +func TestLoadEthAbi(t *testing.T) { + // Load the ABI using the load_abi function + ethAbi, err := loadAbi("starknet_eth", 2) + assert.NoError(t, err, "Loading ABI should not return an error") + + // Convert the hexadecimal string to a byte slice + classHash, err := hex.DecodeString("05ffbcfeb50d200a0677c48a129a11245a3fc519d1d98d76882d1c9a1b19c6ed") + assert.NoError(t, err, "Decoding class hash from hex should not return an error") + + // Call the StarknetAbi from JSON method + ethDecoder, err := StarknetAbiFromJSON(ethAbi, "starknet_eth", classHash) + assert.NoError(t, err, "Decoding ABI from JSON should not return an error") + + // Additional assertions can be made here based on the expected structure of ethDecoder + // For example, check the number of functions or events parsed, etc. + assert.NotNil(t, ethDecoder, "EthDecoder should not be nil") + assert.Equal(t, "starknet_eth", *ethDecoder.ABIName, "ABI name should match") +} + +/*func TestLoadWildcardArraySyntax(t *testing.T) { + // Load the ABI + wildcardAbi, err := loadAbi("complex_array", 1) + assert.NoError(t, err, "Failed to load ABI") + + // Convert the hex string to bytes + classHash, err := hex.DecodeString("0031da92cf5f54bcb81b447e219e2b791b23f3052d12b6c9abd04ff2e5626576") + assert.NoError(t, err, "Failed to decode hex string") + + // Create the decoder using the from JSON function + decoder, err := StarknetAbiFromJSON(wildcardAbi, "complex_array", classHash) + assert.NoError(t, err, "Failed to create Starknet ABI from JSON") + + // Add assertions to verify the properties of `decoder` + // Example assertions (adjust according to expected values): + assert.NotNil(t, decoder, "Decoder should not be nil") + //assert.Equal(t, expectedValue, decoder.SomeProperty, "Unexpected value for SomeProperty") +} + + +func TestLoadWildcardArraySyntax(t *testing.T) { + wildcardAbi,err := loadAbi("complex_array", 1) + assert.NoError(t, err, "Loading ABI should not return an error") + // Decode the hex string directly + decodedClassHash, err := hex.DecodeString("0031da92cf5f54bcb81b447e219e2b791b23f3052d12b6c9abd04ff2e5626576") + assert.NoError(t, err, "Failed to decode hex string") + + decoder, err := StarknetAbiFromJSON( + wildcardAbi, + "complex_array", + decodedClassHash, + ) + assert.NoError(t, err, "Failed to decode ABI") + + parsedEvent := decoder.Events["log_storage_cells"] + + // Assert the length of parsed event data + assert.Len(t, parsedEvent.data, 1, "Expected parsed event data length to be 1") + + // Assert the storage_cells data matches the expected structure + assert.Equal(t, parsedEvent.data["storage_cells"], StarknetArray( + StarknetStruct{ + Name: "StorageCell", + Members: []AbiParameter{ + {Name: "key", Type: StarknetCoreType.Felt}, + {Name: "value", Type: StarknetCoreType.Felt}, + }, + }, + ), "Expected storage_cells data structure to match") + + // Assert the event name + assert.Equal(t, parsedEvent.Name, "log_storage_cells", "Expected event name to be 'log_storage_cells'") +} +*/ + +func TestLoadWildcardArraySyntax(t *testing.T) { + // Load the ABI (you'll need to implement this function) + wildcardAbi, err := loadAbi("complex_array", 1) + assert.NoError(t, err, "Loading ABI should not return an error") + + classHash, _ := hex.DecodeString("0031da92cf5f54bcb81b447e219e2b791b23f3052d12b6c9abd04ff2e5626576") + //fmt.Println("wildcard",wildcardAbi) + decoder, err := StarknetAbiFromJSON(wildcardAbi, "complex_array", classHash) + assert.NoError(t, err, "there should not be error") + fmt.Println("decoder is ", decoder) + fmt.Println("the err is ", err) + parsedEvent, ok := decoder.Events["log_storage_cells"] + fmt.Println("parsedevent is ", parsedEvent) + assert.True(t, ok, "Event 'log_storage_cells' should exist") + + assert.Equal(t, 1, len(parsedEvent.data), "Parsed event should have 1 data field") + + storageCellsType, ok := parsedEvent.data["storage_cells"] + assert.True(t, ok, "Event should have 'storage_cells' field") + + arrayType, ok := storageCellsType.(StarknetArray) + assert.True(t, ok, "storage_cells should be a StarknetArray") + + structType, ok := arrayType.InnerType.(StarknetStruct) + assert.True(t, ok, "Array element should be a StarknetStruct") + assert.Equal(t, "StorageCell", structType.Name) + + assert.Equal(t, 2, len(structType.Members), "StorageCell struct should have 2 members") + fmt.Println("hello hello the val is ", structType.Members) + assert.Equal(t, "key", structType.Members[0].Name) + assert.Equal(t, StarknetCoreType(Felt), structType.Members[0].Type) + + assert.Equal(t, "value", structType.Members[1].Name) + assert.Equal(t, StarknetCoreType(Felt), structType.Members[1].Type) + + assert.Equal(t, "log_storage_cells", parsedEvent.name) + + // Test the idStr() methods + expectedIdStr := "[{key:Felt,value:Felt}]" + assert.Equal(t, expectedIdStr, arrayType.idStr(), "Array idStr should match expected") + + expectedStructIdStr := "{key:Felt,value:Felt}" + assert.Equal(t, expectedStructIdStr, structType.idStr(), "Struct idStr should match expected") +} diff --git a/athena_abi/parse_struct_test.go b/athena_abi/parse_struct_test.go index 4a6e2a5d..f16b24b7 100644 --- a/athena_abi/parse_struct_test.go +++ b/athena_abi/parse_struct_test.go @@ -36,7 +36,7 @@ func loadAbi(abiName string, abiVersion int) ([]map[string]interface{}, error) { if err != nil { return nil, fmt.Errorf("failed to decode ABI JSON: %w", err) } - + //fmt.Println("Map contents:", abiJson) return abiJson, nil } func init() { diff --git a/backup.txt b/backup.txt new file mode 100644 index 00000000..addf39d7 --- /dev/null +++ b/backup.txt @@ -0,0 +1,90 @@ +package athena_abi +import ( + "fmt" + "reflect" +) +// The function takes in a list of type definitions (dict) and returns a dict of sets (map[string]bool) +func BuildTypeGraph(typeDefs []map[string]interface{}) map[string]map[string]bool { + fmt.Println() + fmt.Println("typdefs os ",typeDefs) + fmt.Println() + fmt.Println("the types of typdefs is ",reflect.TypeOf(typeDefs)) + fmt.Println() + outputGraph := make(map[string]map[string]bool) + for _, typeDef := range typeDefs { + referencedTypes := []string{} + fmt.Println("the typedef is ",typeDef) + fmt.Println() + fmt.Println("the types of typdef is ",reflect.TypeOf(typeDef)) + fmt.Println() + if typeDef["type"] == "struct" { + /*for _, member := range typeDef["members"].([]map[string]interface{}) { + referencedTypes = append(referencedTypes, member["type"].(string)) + }*/ + fmt.Println("the type of typedef.member",reflect.TypeOf(typeDef["members"])) + //fmt.Println("the typedef is ",typeDef["member"]) + members, ok := typeDef["members"].([]map[string]interface {}) + fmt.Println() + fmt.Println("ok is ",ok) + /*if !ok { + + panic("Expected members to be a slice of interface{}") + }*/ + + // Loop over each element in the slice + for _, memberInterface := range members { + // Assert that each element is a map[string]interface{} + member, ok := memberInterface.(map[string]interface{}) + if !ok { + panic("Expected each member to be a map[string]interface{}") + } + + // Now you can safely access member["type"].(string) + referencedTypes = append(referencedTypes, member["type"].(string)) + } + + } else { + /*for _, variant := range typeDef["variants"].([]map[string]interface{}) { + referencedTypes = append(referencedTypes, variant["type"].(string)) + }*/ + // Assert that typeDef["variants"] is a slice of interfaces ([]interface{}) + variants, ok := typeDef["variants"].([]interface{}) + if !ok { + panic("Expected variants to be a slice of interface{}") + } + + // Loop over each element in the slice + for _, variantInterface := range variants { + // Assert that each element is a map[string]interface{} + variant, ok := variantInterface.(map[string]interface{}) + if !ok { + panic("Expected each variant to be a map[string]interface{}") + } + + // Now you can safely access variant["type"].(string) + referencedTypes = append(referencedTypes, variant["type"].(string)) + } + + } + + refTypes := make(map[string]bool) + + for _, typeStr := range referencedTypes { + if _, ok := StarknetCoreTypes[typeStr]; ok { + continue + } + + if _, ok := StarknetCoreTypes[extractInnerType(typeStr)]; ok { + if strings.HasPrefix(typeStr, "core::array") || strings.HasPrefix(typeStr, "@core::array") { + continue + } + } + + refTypes[typeStr] = true + } + + outputGraph[typeDef["name"].(string)] = refTypes + } + + return outputGraph +} From f93f72a8007beb2a73cd8988b7e3fac432ad0ba1 Mon Sep 17 00:00:00 2001 From: rishikpulhani Date: Tue, 24 Sep 2024 15:52:25 +0530 Subject: [PATCH 7/8] commit with debug statements --- athena_abi/core.go | 1 + athena_abi/parse.go | 44 ++++++++++--- athena_abi/parse_full_abi_test.go | 106 ++++++++++++++++++++++++++++++ backup.txt | 90 ------------------------- 4 files changed, 142 insertions(+), 99 deletions(-) delete mode 100644 backup.txt diff --git a/athena_abi/core.go b/athena_abi/core.go index b6058a5b..d2a125d9 100644 --- a/athena_abi/core.go +++ b/athena_abi/core.go @@ -93,6 +93,7 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse events parsedAbiEvents := []AbiEvent{} fmt.Println("now parsing events") + fmt.Println("the grouped abi events is ", groupedAbi["event"]) for _, eventData := range groupedAbi["event"] { fmt.Println("eventdata is ", eventData) parsedEvent, errParsingEvent := ParseAbiEvent(eventData, definedTypes) diff --git a/athena_abi/parse.go b/athena_abi/parse.go index 46c12f67..238ee040 100644 --- a/athena_abi/parse.go +++ b/athena_abi/parse.go @@ -62,11 +62,21 @@ func extractInnerType(abiType string) string { // The function takes in a list of type definitions (dict) and returns a dict of sets (map[string]bool) func BuildTypeGraph(typeDefs []map[string]interface{}) map[string]map[string]bool { + fmt.Println() + fmt.Println("typdefs os ", typeDefs) + fmt.Println() + fmt.Println("the types of typdefs is ", reflect.TypeOf(typeDefs)) + fmt.Println() outputGraph := make(map[string]map[string]bool) for _, typeDef := range typeDefs { referencedTypes := []string{} + fmt.Println("the typedef is ", typeDef) + fmt.Println() + fmt.Println("the types of typdef is ", reflect.TypeOf(typeDef)) + fmt.Println() + fmt.Println("the type of typedef.member", reflect.TypeOf(typeDef["members"])) //here reflect.typeof() retunrs the inner type stored in the interface always if typeDef["type"] == "struct" { - for _, member := range typeDef["members"].([]map[string]interface{}) { + for _, member := range typeDef["members"].([]map[string]interface{}) { //here this works as typeDef["members"] is of interface{} type not a slice of interface so a single type assertion will work referencedTypes = append(referencedTypes, member["type"].(string)) } } else { @@ -269,7 +279,7 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType fmt.Println("abitype is", abiType) parts := strings.Split(abiType, "::")[1:] fmt.Println("c") - fmt.Println(parts) + fmt.Println("the parts is ", parts) switch { case len(parts) == 1 && parts[0] == "felt252": @@ -420,6 +430,7 @@ func parseAbiParameters(names []string, types []string, customTypes map[string]i if err != nil { return nil, err } + fmt.Println("the res id qwerty", res) outputParameters = append(outputParameters, AbiParameter{ Name: names[i], Type: res, @@ -503,17 +514,28 @@ func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]inter if value, exists := abiEvent["kind"]; exists { if value == "struct" { //eventParameters = abiEvent["members"].([]map[string]interface{}) + fmt.Println() + fmt.Println("abievent.members is ", abiEvent["members"]) + fmt.Println() eventMembers := abiEvent["members"].([]interface{}) // Assert as []interface{} - eventParameters := make([]map[string]interface{}, len(eventMembers)) - - for i, member := range eventMembers { - eventParameters[i] = member.(map[string]interface{}) // Assert each element as map[string]interface{} + fmt.Println("eventmembers is ", eventMembers) + fmt.Println() + //eventParameters := make([]map[string]interface{}, len(eventMembers)) + + for _, member := range eventMembers { + fmt.Println("the memberbeing added is ", member) + fmt.Println("asdf if is running") + mem, _ := member.(map[string]interface{}) // Assert each element as map[string]interface{} + eventParameters = append(eventParameters, mem) + fmt.Println("the eventparameter status is ", eventParameters) } } else { + fmt.Println("asdf else is running") fmt.Print("in parsig abi event the else1 nil was there") return nil, nil } } else if inputs, ok := abiEvent["inputs"].([]map[string]interface{}); ok { + fmt.Println("searching for inputs") for _, e := range inputs { eventParameter := map[string]interface{}{"kind": "data"} for k, v := range e { @@ -523,6 +545,7 @@ func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]inter } } else if data, ok := abiEvent["data"].([]interface{}); ok { fmt.Println(ok) + fmt.Println("searching for data") var result []map[string]interface{} for _, item := range data { fmt.Println("item is of type ", reflect.TypeOf(item)) @@ -576,8 +599,10 @@ func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]inter } } else { - fmt.Println("the type is ", reflect.TypeOf(abiEvent["data"])) - fmt.Println("the data is ", abiEvent["data"]) + fmt.Println("not found anything now in else") + //fmt.Println("the type is ", reflect.TypeOf(abiEvent["data"])) + //fmt.Println("the data is ", abiEvent["data"]) + fmt.Println("asdf else 3 is running") data, ok := abiEvent["data"].([]map[string]interface{}) fmt.Println("data is", data) fmt.Println("ok is ", ok) @@ -592,7 +617,8 @@ func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]inter types = append(types, eventParameter["type"].(string)) names = append(names, eventParameter["name"].(string)) } - + fmt.Println("types is ", types) + fmt.Println("names is ", names) decodedParams, err := parseAbiParameters( names, types, diff --git a/athena_abi/parse_full_abi_test.go b/athena_abi/parse_full_abi_test.go index 3b998e70..4efb92d5 100644 --- a/athena_abi/parse_full_abi_test.go +++ b/athena_abi/parse_full_abi_test.go @@ -2,6 +2,7 @@ package athena_abi import ( "encoding/hex" + "encoding/json" "fmt" "testing" @@ -185,3 +186,108 @@ func TestLoadWildcardArraySyntax(t *testing.T) { expectedStructIdStr := "{key:Felt,value:Felt}" assert.Equal(t, expectedStructIdStr, structType.idStr(), "Struct idStr should match expected") } + +func TestWildcardSizeSyntax(t *testing.T) { + // felt* syntax length parameter can be calldata_len or calldata_size + abiFunction := map[string]interface{}{ + "inputs": []interface{}{ + map[string]interface{}{"name": "selector", "type": "felt"}, + map[string]interface{}{"name": "calldata_size", "type": "felt"}, + map[string]interface{}{"name": "calldata", "type": "felt*"}, + }, + "name": "__default__", + "outputs": []interface{}{ + map[string]interface{}{"name": "retdata_size", "type": "felt"}, + map[string]interface{}{"name": "retdata", "type": "felt*"}, + }, + "type": "function", + } + + customTypes := make(map[string]interface{}) + parsedAbiFunc, err := ParseAbiFunction(abiFunction, customTypes) + + assert.NoError(t, err, "ParseAbiFunction should not return an error") + assert.NotNil(t, parsedAbiFunc, "ParseAbiFunction should return a non-nil result") + + assert.Len(t, parsedAbiFunc.inputs, 2, "There should be 2 inputs") + + assert.Equal(t, "selector", parsedAbiFunc.inputs[0].Name, "First input name should be 'selector'") + assert.Equal(t, Felt, parsedAbiFunc.inputs[0].Type, "First input type should be Felt") + + assert.Equal(t, "calldata", parsedAbiFunc.inputs[1].Name, "Second input name should be 'calldata'") + assert.IsType(t, StarknetArray{}, parsedAbiFunc.inputs[1].Type, "Second input type should be StarknetArray") + + calldataType, ok := parsedAbiFunc.inputs[1].Type.(StarknetArray) + assert.True(t, ok, "Second input type should be castable to StarknetArray") + assert.Equal(t, Felt, calldataType.InnerType, "Inner type of calldata should be Felt") +} +func TestNoStructDefinition(t *testing.T) { + // Assuming NO_STRUCT_ABI_DEFINITION is a JSON string + var abiJson []map[string]interface{} + err := json.Unmarshal([]byte(NO_STRUCT_ABI_DEFINITION), &abiJson) // Unmarshal JSON string into abiJson + assert.NoError(t, err, "Error unmarshalling ABI for no_struct") + + classHash, err := hex.DecodeString(NO_STRUCT_CLASS_HASH[2:]) + assert.NoError(t, err, "Error decoding class hash for no_struct") + + // Decode ABI using StarknetAbiFromJSON + decoder, err := StarknetAbiFromJSON(abiJson, "no_struct", classHash) + assert.NoError(t, err, "Error decoding ABI for no_struct") + assert.NotNil(t, decoder, "Expected decoder to be non-nil for no_struct") +} +func TestFeltTypes(t *testing.T) { + // Assuming VERSION_0_ABI_DEFINITION is a JSON string + var abiJson []map[string]interface{} + err := json.Unmarshal([]byte(VERSION_0_ABI_DEFINITION), &abiJson) // Unmarshal JSON string into abiJson + assert.NoError(t, err, "Error unmarshalling ABI for felt_types") + + classHash, err := hex.DecodeString(VERSION_0_CLASS_HASH[2:]) + assert.NoError(t, err, "Error decoding class hash for felt_types") + + // Decode ABI using StarknetAbiFromJSON + decoder, err := StarknetAbiFromJSON(abiJson, "felt_types", classHash) + assert.NoError(t, err, "Error decoding ABI for felt_types") + assert.NotNil(t, decoder, "Expected decoder to be non-nil for felt_types") +} + +// Test for parsing event keys from the ERC20 ABI definition +func TestParseEventKeys(t *testing.T) { + // Load the ABI for erc20_key_events with version 2 + abiJson, err := loadAbi("erc20_key_events", 2) + assert.NoError(t, err, "Error loading ABI for erc20_key_events") + + // Decode the class hash from a hex string + classHash, err := hex.DecodeString("0261ad90e1901833f794ee3d69816846f68ddb4fb7bb9ffec2d8f0c8608e298d") + assert.NoError(t, err, "Error decoding class hash for erc20_key_events") + + // Decode the ABI using StarknetAbiFromJSON + parsedAbi, err := StarknetAbiFromJSON(abiJson, "erc20_key_events", classHash) + fmt.Println("parsedabi is helc ", parsedAbi) + fmt.Println("the err is helc ", err) + assert.NoError(t, err, "Error parsing ABI for erc20_key_events") + assert.NotNil(t, parsedAbi, "Parsed ABI should not be nil for erc20_key_events") + + // Access the "Approval" event from the parsed ABI + approveEvent, ok := parsedAbi.Events["Approval"] + assert.True(t, ok, "Approval event should be found in the parsed ABI") + fmt.Println("approve event ", approveEvent) + // Validate the event's parameters + expectedParameters := []string{"owner", "spender", "value"} + assert.Equal(t, expectedParameters, approveEvent.parameters, "Expected parameters do not match") + + // Validate the event's keys + expectedKeys := map[string]StarknetType{ //confirm this change + "owner": ContractAddress, + "spender": ContractAddress, + } + assert.Equal(t, expectedKeys, approveEvent.keys, "Expected keys do not match") // + + // Validate the event's data + expectedData := map[string]StarknetType{ //confirm this change + "value": U256, + } + assert.Equal(t, expectedData, approveEvent.data, "Expected data do not match") // + + // Validate the event's name + assert.Equal(t, "Approval", approveEvent.name, "Expected event name does not match") +} diff --git a/backup.txt b/backup.txt deleted file mode 100644 index addf39d7..00000000 --- a/backup.txt +++ /dev/null @@ -1,90 +0,0 @@ -package athena_abi -import ( - "fmt" - "reflect" -) -// The function takes in a list of type definitions (dict) and returns a dict of sets (map[string]bool) -func BuildTypeGraph(typeDefs []map[string]interface{}) map[string]map[string]bool { - fmt.Println() - fmt.Println("typdefs os ",typeDefs) - fmt.Println() - fmt.Println("the types of typdefs is ",reflect.TypeOf(typeDefs)) - fmt.Println() - outputGraph := make(map[string]map[string]bool) - for _, typeDef := range typeDefs { - referencedTypes := []string{} - fmt.Println("the typedef is ",typeDef) - fmt.Println() - fmt.Println("the types of typdef is ",reflect.TypeOf(typeDef)) - fmt.Println() - if typeDef["type"] == "struct" { - /*for _, member := range typeDef["members"].([]map[string]interface{}) { - referencedTypes = append(referencedTypes, member["type"].(string)) - }*/ - fmt.Println("the type of typedef.member",reflect.TypeOf(typeDef["members"])) - //fmt.Println("the typedef is ",typeDef["member"]) - members, ok := typeDef["members"].([]map[string]interface {}) - fmt.Println() - fmt.Println("ok is ",ok) - /*if !ok { - - panic("Expected members to be a slice of interface{}") - }*/ - - // Loop over each element in the slice - for _, memberInterface := range members { - // Assert that each element is a map[string]interface{} - member, ok := memberInterface.(map[string]interface{}) - if !ok { - panic("Expected each member to be a map[string]interface{}") - } - - // Now you can safely access member["type"].(string) - referencedTypes = append(referencedTypes, member["type"].(string)) - } - - } else { - /*for _, variant := range typeDef["variants"].([]map[string]interface{}) { - referencedTypes = append(referencedTypes, variant["type"].(string)) - }*/ - // Assert that typeDef["variants"] is a slice of interfaces ([]interface{}) - variants, ok := typeDef["variants"].([]interface{}) - if !ok { - panic("Expected variants to be a slice of interface{}") - } - - // Loop over each element in the slice - for _, variantInterface := range variants { - // Assert that each element is a map[string]interface{} - variant, ok := variantInterface.(map[string]interface{}) - if !ok { - panic("Expected each variant to be a map[string]interface{}") - } - - // Now you can safely access variant["type"].(string) - referencedTypes = append(referencedTypes, variant["type"].(string)) - } - - } - - refTypes := make(map[string]bool) - - for _, typeStr := range referencedTypes { - if _, ok := StarknetCoreTypes[typeStr]; ok { - continue - } - - if _, ok := StarknetCoreTypes[extractInnerType(typeStr)]; ok { - if strings.HasPrefix(typeStr, "core::array") || strings.HasPrefix(typeStr, "@core::array") { - continue - } - } - - refTypes[typeStr] = true - } - - outputGraph[typeDef["name"].(string)] = refTypes - } - - return outputGraph -} From 4aaaa625e09235f1b47285e0fd0c5bc208b4bb4c Mon Sep 17 00:00:00 2001 From: rishikpulhani Date: Tue, 24 Sep 2024 16:11:42 +0530 Subject: [PATCH 8/8] finished with parse_full_abi_test.go and made changes to parse.go and core.go and cleaned the code --- athena_abi/core.go | 38 +--------- athena_abi/parse.go | 114 ++---------------------------- athena_abi/parse_full_abi_test.go | 64 ----------------- athena_abi/parse_struct_test.go | 1 - 4 files changed, 7 insertions(+), 210 deletions(-) diff --git a/athena_abi/core.go b/athena_abi/core.go index d2a125d9..93f98fcd 100644 --- a/athena_abi/core.go +++ b/athena_abi/core.go @@ -2,7 +2,6 @@ package athena_abi import ( "errors" - "fmt" "log" ) @@ -35,11 +34,7 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class groupedAbi := GroupAbiByType(abiJson) // Parse defined types (structs and enums) - fmt.Println("hello") - fmt.Println("grouped abi", groupedAbi["type_def"]) definedTypes, err := ParseEnumsAndStructs(groupedAbi["type_def"]) - fmt.Println("defined types Map contents:", definedTypes) - fmt.Println("is there error", err) if err != nil { sortedDefs, errDef := TopoSortTypeDefs(groupedAbi["type_def"]) if errDef == nil { @@ -55,7 +50,6 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse interfaces var definedInterfaces []AbiInterface - fmt.Println("now parsing interfaces") for _, iface := range groupedAbi["interface"] { functions := []AbiFunction{} for _, funcData := range iface["items"].([]interface{}) { @@ -73,7 +67,6 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse functions functions := make(map[string]AbiFunction) - fmt.Println("now parsing functions") for _, functionData := range groupedAbi["function"] { funcName := functionData["name"].(string) abiFunc, errParsingFunctions := ParseAbiFunction(functionData, definedTypes) @@ -92,29 +85,20 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse events parsedAbiEvents := []AbiEvent{} - fmt.Println("now parsing events") - fmt.Println("the grouped abi events is ", groupedAbi["event"]) for _, eventData := range groupedAbi["event"] { - fmt.Println("eventdata is ", eventData) parsedEvent, errParsingEvent := ParseAbiEvent(eventData, definedTypes) - fmt.Println("parsed event is ", parsedEvent) - fmt.Println("the err is ", errParsingEvent) if errParsingEvent != nil { return nil, errParseEvents } - //parsedAbiEvents = append(parsedAbiEvents, *parsedEvent) if parsedEvent != nil { parsedAbiEvents = append(parsedAbiEvents, *parsedEvent) } else { - // Handle the nil case if necessary - //return nil, errors.New("parsed event is nil") continue } } events := make(map[string]AbiEvent) - fmt.Println("parsedabievents are ", parsedAbiEvents) for _, event := range parsedAbiEvents { if event.name != "" { events[event.name] = event @@ -123,7 +107,6 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse constructor var constructor []AbiParameter - fmt.Println("now parsing constructor") if len(groupedAbi["constructor"]) == 1 { for _, paramData := range groupedAbi["constructor"][0]["inputs"].([]interface{}) { param := paramData.(map[string]interface{}) @@ -142,7 +125,6 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse L1 handler var l1Handler *AbiFunction - fmt.Println("now parsing l1handler") if len(groupedAbi["l1_handler"]) == 1 { handler, errorParsingFunction := ParseAbiFunction(groupedAbi["l1_handler"][0], definedTypes) if errorParsingFunction != nil { @@ -155,12 +137,7 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class // Parse implemented interfaces implementedInterfaces := make(map[string]AbiInterface) - fmt.Println("now parsing implemented interfaces") - implArray, ok := groupedAbi["impl"] - if !ok { - //return nil, errParseImplementedInterfaces - //this if block is not required - } + implArray, _ := groupedAbi["impl"] for _, implData := range implArray { implMap := implData if ifaceName, ok := implMap["interface_name"].(string); ok { @@ -171,19 +148,6 @@ func StarknetAbiFromJSON(abiJson []map[string]interface{}, abiName string, class } } } - fmt.Println("abi name : ", abiName) - fmt.Println("classhash is : ", classHash) - fmt.Println() - fmt.Println("functions is : ", functions) - fmt.Println() - fmt.Println("events is : ", events) - fmt.Println() - fmt.Println("constructor is : ", constructor) - fmt.Println() - fmt.Println("l1handles is ", l1Handler) - fmt.Println() - fmt.Println("implemented interfaces is : ", implementedInterfaces) - fmt.Println() // Return the populated StarknetAbi struct return &StarknetABI{ ABIName: &abiName, diff --git a/athena_abi/parse.go b/athena_abi/parse.go index 238ee040..dacc189e 100644 --- a/athena_abi/parse.go +++ b/athena_abi/parse.go @@ -2,7 +2,6 @@ package athena_abi import ( "fmt" - "reflect" "strings" ) @@ -11,20 +10,10 @@ func GroupAbiByType(abiJson []map[string]interface{}) map[AbiMemberType][]map[st grouped := make(map[AbiMemberType][]map[string]interface{}) for _, entry := range abiJson { - /*if entry["type"] == "struct" || entry["type"] == "enum" { - grouped["type_def"] = append(grouped["type_def"], entry) - } else { - grouped[AbiMemberType(typeStr)] = append(grouped[AbiMemberType(entry["type"])], entry) - - }*/ typeStr, _ := entry["type"].(string) - - // Convert the string to AbiMemberType if typeStr == "struct" || typeStr == "enum" { - fmt.Println("the types string value is ", typeStr) grouped["type_def"] = append(grouped["type_def"], entry) } else { - fmt.Println("the types string value is ", typeStr) grouped[AbiMemberType(typeStr)] = append(grouped[AbiMemberType(typeStr)], entry) } @@ -62,21 +51,11 @@ func extractInnerType(abiType string) string { // The function takes in a list of type definitions (dict) and returns a dict of sets (map[string]bool) func BuildTypeGraph(typeDefs []map[string]interface{}) map[string]map[string]bool { - fmt.Println() - fmt.Println("typdefs os ", typeDefs) - fmt.Println() - fmt.Println("the types of typdefs is ", reflect.TypeOf(typeDefs)) - fmt.Println() outputGraph := make(map[string]map[string]bool) for _, typeDef := range typeDefs { referencedTypes := []string{} - fmt.Println("the typedef is ", typeDef) - fmt.Println() - fmt.Println("the types of typdef is ", reflect.TypeOf(typeDef)) - fmt.Println() - fmt.Println("the type of typedef.member", reflect.TypeOf(typeDef["members"])) //here reflect.typeof() retunrs the inner type stored in the interface always if typeDef["type"] == "struct" { - for _, member := range typeDef["members"].([]map[string]interface{}) { //here this works as typeDef["members"] is of interface{} type not a slice of interface so a single type assertion will work + for _, member := range typeDef["members"].([]map[string]interface{}) { referencedTypes = append(referencedTypes, member["type"].(string)) } } else { @@ -136,7 +115,6 @@ func TopoSortTypeDefs(typeDefs []map[string]interface{}) ([]map[string]interface sortedTypeDefJson[i], sortedTypeDefJson[j] = sortedTypeDefJson[j], sortedTypeDefJson[i] } - // Return the reversed slice return sortedTypeDefJson, nil } @@ -161,8 +139,6 @@ func ParseEnumsAndStructs(abiStructs []map[string]interface{}) (map[string]inter switch abiStruct["type"] { case "struct": - fmt.Println("a") - fmt.Println("abistruct is", abiStruct) res, err := parseStruct(abiStruct, outputTypes) if err != nil { return nil, err @@ -170,7 +146,6 @@ func ParseEnumsAndStructs(abiStructs []map[string]interface{}) (map[string]inter outputTypes[typeName] = res case "enum": - fmt.Println("d") res, err := parseEnum(abiStruct, outputTypes) if err != nil { return nil, err @@ -184,13 +159,11 @@ func ParseEnumsAndStructs(abiStructs []map[string]interface{}) (map[string]inter func parseStruct(abiStruct map[string]interface{}, typeContext map[string]interface{}) (StarknetStruct, error) { members := []AbiParameter{} - // Assert that "members" is a slice of interfaces memberInterfaces, ok := abiStruct["members"].([]interface{}) if !ok { return StarknetStruct{}, fmt.Errorf("invalid type for members: expected []interface{}") } - // Iterate over the members and convert each to map[string]interface{} for _, memberInterface := range memberInterfaces { member, ok := memberInterface.(map[string]interface{}) if !ok { @@ -198,10 +171,8 @@ func parseStruct(abiStruct map[string]interface{}, typeContext map[string]interf } // Parse the member type - fmt.Println("b") - fmt.Println("thetypes are ", member["type"]) + res, err := parseType(member["type"].(string), typeContext) - fmt.Println("res is ", res) if err != nil { return StarknetStruct{}, err } @@ -265,21 +236,13 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType } if strings.HasPrefix(abiType, "(") { - fmt.Println("the abitype for parsetuple input is", abiType) res, err := ParseTuple(abiType, customTypes) - fmt.Println("the result afternparsing the tuple is ", res) if err != nil { return nil, err } return res, nil } - /*if strings.HasPrefix(abiType, "(") && strings.HasSuffix(abiType, ")") { - return ParseTuple(abiType, customTypes) - }*/ - fmt.Println("abitype is", abiType) parts := strings.Split(abiType, "::")[1:] - fmt.Println("c") - fmt.Println("the parts is ", parts) switch { case len(parts) == 1 && parts[0] == "felt252": @@ -297,7 +260,6 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType case len(parts) == 3 && parts[0] == "starknet" && parts[1] == "storage_access" && parts[2] == "StorageAddress": return StorageAddress, nil case len(parts) >= 2 && (parts[0] == "array" && parts[1] == "Array" || parts[1] == "Span"): - //case len(parts) >= 2 && parts[0] res, err := parseType(extractInnerType(abiType), customTypes) if err != nil { return nil, err @@ -323,12 +285,10 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType } return intType, nil default: - fmt.Println("the lenght of abitype in the default for v1 is ", len(abiType)) abiType := strings.TrimSpace(abiType) if val, exists := customTypes[abiType]; exists { return val.(StarknetType), nil } else if abiType == "felt" { - fmt.Println("this was run correctly") return Felt, nil } else if abiType == "Uint256" { return U256, nil @@ -339,7 +299,6 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType } return StarknetArray{res}, nil } else { - fmt.Println("hey hi this was executed and the value if abitype is ", abiType) return nil, &InvalidAbiError{ Msg: "Invalid ABI type: " + abiType, } @@ -366,9 +325,7 @@ func isNamedTuple(typeStr string) int { // customTypes is a map from string to StarknetStruct or StarknetEnum func ParseTuple(abiType string, customTypes map[string]interface{}) (StarknetTuple, error) { trimmed := strings.TrimSpace(abiType) - fmt.Println("trrimmed tuopls is", trimmed) strippedTuple := strings.TrimSpace(trimmed[1 : len(trimmed)-1]) - fmt.Println("stripped tuples is", strippedTuple) outputTypes := []StarknetType{} parenthesisCache := []string{} typeCache := []string{} @@ -394,7 +351,6 @@ func ParseTuple(abiType string, customTypes map[string]interface{}) (StarknetTup if err != nil { return StarknetTuple{}, err } - fmt.Print("the res in tuple parsing is", res) outputTypes = append(outputTypes, res) } } @@ -403,14 +359,12 @@ func ParseTuple(abiType string, customTypes map[string]interface{}) (StarknetTup if len(parenthesisCache) == 0 { res, err := ParseTuple(strings.Join(typeCache, ","), customTypes) if err != nil { - fmt.Println("error reported") return StarknetTuple{}, err } outputTypes = append(outputTypes, res) } } } - fmt.Println("the output in tuple parsing is ", outputTypes) return StarknetTuple{Members: outputTypes}, nil } @@ -430,7 +384,6 @@ func parseAbiParameters(names []string, types []string, customTypes map[string]i if err != nil { return nil, err } - fmt.Println("the res id qwerty", res) outputParameters = append(outputParameters, AbiParameter{ Name: names[i], Type: res, @@ -465,11 +418,8 @@ func ParseAbiTypes(types []string, customTypes map[string]interface{}) ([]Starkn func ParseAbiFunction(abiFunction map[string]interface{}, customTypes map[string]interface{}) (*AbiFunction, error) { names := []string{} types := []string{} - /*for _, abiInput := range abiFunction["inputs"].([]map[string]interface{}) { - names = append(names, abiInput["name"].(string)) - }*/ for _, abiInput := range abiFunction["inputs"].([]interface{}) { - inputMap := abiInput.(map[string]interface{}) // Assert each element as map[string]interface{} + inputMap := abiInput.(map[string]interface{}) names = append(names, inputMap["name"].(string)) } for _, abiInput := range abiFunction["inputs"].([]interface{}) { @@ -484,10 +434,6 @@ func ParseAbiFunction(abiFunction map[string]interface{}, customTypes map[string if err != nil { return nil, err } - - /*for _, abiOutput := range abiFunction["outputs"].([]map[string]interface{}) { - types = append(types, abiOutput["type"].(string)) - }*/ for _, abiOutput := range abiFunction["outputs"].([]interface{}) { outputMap := abiOutput.(map[string]interface{}) types = append(types, outputMap["type"].(string)) @@ -510,32 +456,18 @@ func ParseAbiFunction(abiFunction map[string]interface{}, customTypes map[string func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]interface{}) (*AbiEvent, error) { eventParameters := []map[string]interface{}{} - fmt.Print("the abievent is", abiEvent) if value, exists := abiEvent["kind"]; exists { if value == "struct" { - //eventParameters = abiEvent["members"].([]map[string]interface{}) - fmt.Println() - fmt.Println("abievent.members is ", abiEvent["members"]) - fmt.Println() - eventMembers := abiEvent["members"].([]interface{}) // Assert as []interface{} - fmt.Println("eventmembers is ", eventMembers) - fmt.Println() - //eventParameters := make([]map[string]interface{}, len(eventMembers)) + eventMembers := abiEvent["members"].([]interface{}) for _, member := range eventMembers { - fmt.Println("the memberbeing added is ", member) - fmt.Println("asdf if is running") - mem, _ := member.(map[string]interface{}) // Assert each element as map[string]interface{} + mem, _ := member.(map[string]interface{}) eventParameters = append(eventParameters, mem) - fmt.Println("the eventparameter status is ", eventParameters) } } else { - fmt.Println("asdf else is running") - fmt.Print("in parsig abi event the else1 nil was there") return nil, nil } } else if inputs, ok := abiEvent["inputs"].([]map[string]interface{}); ok { - fmt.Println("searching for inputs") for _, e := range inputs { eventParameter := map[string]interface{}{"kind": "data"} for k, v := range e { @@ -544,52 +476,29 @@ func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]inter eventParameters = append(eventParameters, eventParameter) } } else if data, ok := abiEvent["data"].([]interface{}); ok { - fmt.Println(ok) - fmt.Println("searching for data") var result []map[string]interface{} for _, item := range data { - fmt.Println("item is of type ", reflect.TypeOf(item)) - fmt.Println("result is of type ", reflect.TypeOf(result)) // Assert the type of item if m, ok := item.(map[string]interface{}); ok { result = append(result, m) - } else { - // Handle the case where the item is not of the expected type - fmt.Println("Item is not of type map[string]interface{}:", item) } } for _, e := range result { - fmt.Println(e) eventParameter := map[string]interface{}{"kind": "data"} for k, v := range e { eventParameter[k] = v } eventParameters = append(eventParameters, eventParameter) } - /*for _, e := range abiEvent["keys"].([]map[string]interface{}) { - eventParameter := map[string]interface{}{"kind": "key"} - for k, v := range e { - eventParameter[k] = v - } - eventParameters = append(eventParameters, eventParameter) - }*/ + if keys, ok := abiEvent["keys"].([]interface{}); ok { var keyres []map[string]interface{} - fmt.Println("keys is of type ", reflect.TypeOf(abiEvent["keys"])) - fmt.Println("result is of type ", reflect.TypeOf(result)) for _, key := range keys { - fmt.Println("item is of type ", reflect.TypeOf(key)) - fmt.Println("result is of type ", reflect.TypeOf(keyres)) - // Assert the type of item if m, ok := key.(map[string]interface{}); ok { keyres = append(keyres, m) - } else { - // Handle the case where the item is not of the expected type - fmt.Println("Item is not of type map[string]interface{}:", key) } } for _, e := range keyres { - fmt.Println(e) eventParameter := map[string]interface{}{"kind": "key"} for k, v := range e { eventParameter[k] = v @@ -599,26 +508,15 @@ func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]inter } } else { - fmt.Println("not found anything now in else") - //fmt.Println("the type is ", reflect.TypeOf(abiEvent["data"])) - //fmt.Println("the data is ", abiEvent["data"]) - fmt.Println("asdf else 3 is running") - data, ok := abiEvent["data"].([]map[string]interface{}) - fmt.Println("data is", data) - fmt.Println("ok is ", ok) - fmt.Print("in parsig abi event the else2 nil was there") return nil, nil } types := []string{} names := []string{} - fmt.Println("hey hey hey the value of eventparameters is ", eventParameters) for _, eventParameter := range eventParameters { types = append(types, eventParameter["type"].(string)) names = append(names, eventParameter["name"].(string)) } - fmt.Println("types is ", types) - fmt.Println("names is ", names) decodedParams, err := parseAbiParameters( names, types, diff --git a/athena_abi/parse_full_abi_test.go b/athena_abi/parse_full_abi_test.go index 4efb92d5..964b38f4 100644 --- a/athena_abi/parse_full_abi_test.go +++ b/athena_abi/parse_full_abi_test.go @@ -3,7 +3,6 @@ package athena_abi import ( "encoding/hex" "encoding/json" - "fmt" "testing" "github.com/stretchr/testify/assert" @@ -87,74 +86,15 @@ func TestLoadEthAbi(t *testing.T) { assert.Equal(t, "starknet_eth", *ethDecoder.ABIName, "ABI name should match") } -/*func TestLoadWildcardArraySyntax(t *testing.T) { - // Load the ABI - wildcardAbi, err := loadAbi("complex_array", 1) - assert.NoError(t, err, "Failed to load ABI") - - // Convert the hex string to bytes - classHash, err := hex.DecodeString("0031da92cf5f54bcb81b447e219e2b791b23f3052d12b6c9abd04ff2e5626576") - assert.NoError(t, err, "Failed to decode hex string") - - // Create the decoder using the from JSON function - decoder, err := StarknetAbiFromJSON(wildcardAbi, "complex_array", classHash) - assert.NoError(t, err, "Failed to create Starknet ABI from JSON") - - // Add assertions to verify the properties of `decoder` - // Example assertions (adjust according to expected values): - assert.NotNil(t, decoder, "Decoder should not be nil") - //assert.Equal(t, expectedValue, decoder.SomeProperty, "Unexpected value for SomeProperty") -} - - -func TestLoadWildcardArraySyntax(t *testing.T) { - wildcardAbi,err := loadAbi("complex_array", 1) - assert.NoError(t, err, "Loading ABI should not return an error") - // Decode the hex string directly - decodedClassHash, err := hex.DecodeString("0031da92cf5f54bcb81b447e219e2b791b23f3052d12b6c9abd04ff2e5626576") - assert.NoError(t, err, "Failed to decode hex string") - - decoder, err := StarknetAbiFromJSON( - wildcardAbi, - "complex_array", - decodedClassHash, - ) - assert.NoError(t, err, "Failed to decode ABI") - - parsedEvent := decoder.Events["log_storage_cells"] - - // Assert the length of parsed event data - assert.Len(t, parsedEvent.data, 1, "Expected parsed event data length to be 1") - - // Assert the storage_cells data matches the expected structure - assert.Equal(t, parsedEvent.data["storage_cells"], StarknetArray( - StarknetStruct{ - Name: "StorageCell", - Members: []AbiParameter{ - {Name: "key", Type: StarknetCoreType.Felt}, - {Name: "value", Type: StarknetCoreType.Felt}, - }, - }, - ), "Expected storage_cells data structure to match") - - // Assert the event name - assert.Equal(t, parsedEvent.Name, "log_storage_cells", "Expected event name to be 'log_storage_cells'") -} -*/ - func TestLoadWildcardArraySyntax(t *testing.T) { // Load the ABI (you'll need to implement this function) wildcardAbi, err := loadAbi("complex_array", 1) assert.NoError(t, err, "Loading ABI should not return an error") classHash, _ := hex.DecodeString("0031da92cf5f54bcb81b447e219e2b791b23f3052d12b6c9abd04ff2e5626576") - //fmt.Println("wildcard",wildcardAbi) decoder, err := StarknetAbiFromJSON(wildcardAbi, "complex_array", classHash) assert.NoError(t, err, "there should not be error") - fmt.Println("decoder is ", decoder) - fmt.Println("the err is ", err) parsedEvent, ok := decoder.Events["log_storage_cells"] - fmt.Println("parsedevent is ", parsedEvent) assert.True(t, ok, "Event 'log_storage_cells' should exist") assert.Equal(t, 1, len(parsedEvent.data), "Parsed event should have 1 data field") @@ -170,7 +110,6 @@ func TestLoadWildcardArraySyntax(t *testing.T) { assert.Equal(t, "StorageCell", structType.Name) assert.Equal(t, 2, len(structType.Members), "StorageCell struct should have 2 members") - fmt.Println("hello hello the val is ", structType.Members) assert.Equal(t, "key", structType.Members[0].Name) assert.Equal(t, StarknetCoreType(Felt), structType.Members[0].Type) @@ -262,15 +201,12 @@ func TestParseEventKeys(t *testing.T) { // Decode the ABI using StarknetAbiFromJSON parsedAbi, err := StarknetAbiFromJSON(abiJson, "erc20_key_events", classHash) - fmt.Println("parsedabi is helc ", parsedAbi) - fmt.Println("the err is helc ", err) assert.NoError(t, err, "Error parsing ABI for erc20_key_events") assert.NotNil(t, parsedAbi, "Parsed ABI should not be nil for erc20_key_events") // Access the "Approval" event from the parsed ABI approveEvent, ok := parsedAbi.Events["Approval"] assert.True(t, ok, "Approval event should be found in the parsed ABI") - fmt.Println("approve event ", approveEvent) // Validate the event's parameters expectedParameters := []string{"owner", "spender", "value"} assert.Equal(t, expectedParameters, approveEvent.parameters, "Expected parameters do not match") diff --git a/athena_abi/parse_struct_test.go b/athena_abi/parse_struct_test.go index f16b24b7..d3b290f2 100644 --- a/athena_abi/parse_struct_test.go +++ b/athena_abi/parse_struct_test.go @@ -36,7 +36,6 @@ func loadAbi(abiName string, abiVersion int) ([]map[string]interface{}, error) { if err != nil { return nil, fmt.Errorf("failed to decode ABI JSON: %w", err) } - //fmt.Println("Map contents:", abiJson) return abiJson, nil } func init() {