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/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/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/cairo_type_decoders_test.go b/athena_abi/cairo_type_decoders_test.go index 2b3127ca..3332780c 100644 --- a/athena_abi/cairo_type_decoders_test.go +++ b/athena_abi/cairo_type_decoders_test.go @@ -7,32 +7,492 @@ 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]) + 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", + 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") + }) + } +} + +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) } - // needed to convert []*big.Int into []interface{} - interfaceSlice := make([]interface{}, len(test.decoded)) - for i, v := range test.decoded { - interfaceSlice[i] = 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) } - encodedCalldata, err := EncodeFromTypes([]StarknetType{test.starknetType}, []interface{}{interfaceSlice}) - assert.Equal(t, nil, err) - assert.Equal(t, test.calldata, encodedCalldata) + + _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/core.go b/athena_abi/core.go new file mode 100644 index 00000000..93f98fcd --- /dev/null +++ b/athena_abi/core.go @@ -0,0 +1,161 @@ +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 + } + if parsedEvent != nil { + parsedAbiEvents = append(parsedAbiEvents, *parsedEvent) + } else { + continue + } + } + + 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, _ := groupedAbi["impl"] + 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/decode.go b/athena_abi/decode.go index 5328a706..1929cc40 100644 --- a/athena_abi/decode.go +++ b/athena_abi/decode.go @@ -49,7 +49,7 @@ func DecodeCoreTypes(decodeType StarknetCoreType, callData *[]*big.Int) (interfa Msg: fmt.Sprintf("not enough calldata to decode %s", decodeType.idStr()), } } - decodeTypeMaxVal, _ := decodeType.maxValue() + decodeTypeMaxVal, _ := StarknetCoreType(U128).maxValue() if decodedLow.Cmp(big.NewInt(0)) < 0 || decodedLow.Cmp(decodeTypeMaxVal) > 0 { return nil, fmt.Errorf("low Exceeds U128 range") } @@ -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...) + arrayItems = append(arrayItems, decoded[0]) } + outputData = append(outputData, arrayItems) case StarknetOption: optionPresent, err := pop(callData) if err != nil { @@ -177,15 +179,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,15 +207,17 @@ 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: + var tupleItems []interface{} for _, tupleMembers := range t.Members { decoded, err := DecodeFromTypes([]StarknetType{tupleMembers}, callData) if err != nil { return nil, err } - outputData = append(outputData, decoded...) + tupleItems = append(tupleItems, decoded[0]) } + outputData = append(outputData, tupleItems) case StarknetNonZero: decoded, err := DecodeFromTypes([]StarknetType{t.InnerType}, callData) if err != nil { diff --git a/athena_abi/encode.go b/athena_abi/encode.go index c6a15d62..5d8a922c 100644 --- a/athena_abi/encode.go +++ b/athena_abi/encode.go @@ -128,7 +128,7 @@ func EncodeFromTypes(types []StarknetType, values []interface{}) ([]*big.Int, er } encoded, err := EncodeFromParams(t.Members, structValue) if err != nil { - return nil, err + return nil, &TypeDecodeError{Msg: fmt.Sprintf("Failed to Encode %v to %T", encodeValue, encodeType)} } encodedCalldata = append(encodedCalldata, encoded...) 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") +} diff --git a/athena_abi/invalid_encoder_types_test.go b/athena_abi/invalid_encoder_types_test.go new file mode 100644 index 00000000..f76c1bdf --- /dev/null +++ b/athena_abi/invalid_encoder_types_test.go @@ -0,0 +1,314 @@ +package athena_abi + +import ( + "fmt" + "math/big" + "regexp" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestEncodeInvalidEnumsraises(t *testing.T) { + + testEnum := StarknetEnum{ + Name: "TestEnum", + Variants: []struct { + Name string + Type StarknetType + }{ + {"a", StarknetCoreType(U256)}, + {"b", StarknetCoreType(U64)}, + {"c", StarknetCoreType(Bool)}, + }, + } + + errorPattern := regexp.MustCompile("enum value .* must have exactly one key-value pair") + // Test case 1: More than one key-value pair + t.Run("MoreThanOneKeyValuePair", func(t *testing.T) { + _, err := EncodeFromTypes( + []StarknetType{testEnum}, + []interface{}{ + map[string]interface{}{"a": 100, "b": 200}, + }, + ) + + assert.Error(t, err, "Expected an error for multiple key-value pairs") + + if err != nil { + assert.Regexp(t, errorPattern, err.Error(), "Error should match the expected pattern for multiple key-value pairs") + } + }) + + // Test case 2: Zero key-value pairs + t.Run("ZeroKeyValuePair", func(t *testing.T) { + _, err := EncodeFromTypes( + []StarknetType{testEnum}, + []interface{}{ + map[string]interface{}{}, + }, + ) + + assert.Error(t, err, "Expected an error for zero key-value pairs") + if err != nil { + assert.Regexp(t, errorPattern, err.Error(), "Error should match the expected pattern for zero key-value pairs") + } + }) +} + +func TestEncodeInvalidFelts(t *testing.T) { + // Test 1: Exceeding max Felt value + errorPattern := regexp.MustCompile(`\d+ does not fit into (Felt|ContractAddress|EthAddress)`) + + maxFeltValue, _ := StarknetCoreType(Felt).maxValue() + tooLargeFelt := new(big.Int).Add(maxFeltValue, big.NewInt(1)) + + _, err := EncodeFromTypes( + []StarknetType{StarknetCoreType(Felt)}, + []interface{}{tooLargeFelt}, + ) + assert.Error(t, err) + assert.Regexp(t, errorPattern, err.Error(), "Error should match the expected error pattern") + + // Test 2: Exceeding max ContractAddress value + maxContractAddrValue, _ := StarknetCoreType(ContractAddress).maxValue() + tooLargeContractAddr := new(big.Int).Add(maxContractAddrValue, big.NewInt(1)) + + _, err = EncodeFromTypes( + []StarknetType{StarknetCoreType(ContractAddress)}, + []interface{}{tooLargeContractAddr}, + ) + assert.Error(t, err) + assert.Regexp(t, errorPattern, err.Error(), "Error should match the expected error pattern") + + // Test 3: Exceeding max EthAddress value + tooLargeEthAddress := new(big.Int) + tooLargeEthAddress.SetString("123456789012345678901234567890123456789012", 16) + + _, err = EncodeFromTypes( + []StarknetType{StarknetCoreType(EthAddress)}, + []interface{}{tooLargeEthAddress}, + ) + assert.Error(t, err) + assert.Regexp(t, errorPattern, err.Error(), "Error should match the expected error pattern") +} + +func TestEncodeInvalidIntValue(t *testing.T) { + // Test 1: Value exceeding max U256 + tooLargeU256 := new(big.Int).Exp(big.NewInt(2), big.NewInt(256), nil) + + _, err := EncodeFromTypes( + []StarknetType{StarknetCoreType(U256)}, + []interface{}{tooLargeU256}, + ) + assert.Error(t, err) + regexU256 := regexp.MustCompile(`value \d+ is out of range for U256`) + assert.Regexp(t, regexU256, err.Error()) + + // Test 2: Negative value for U128 + negativeValue := big.NewInt(-1) + + _, err = EncodeFromTypes( + []StarknetType{StarknetCoreType(U128)}, + []interface{}{negativeValue}, + ) + assert.Error(t, err) + regexU128 := regexp.MustCompile(`value -?\d+ is out of range for U128`) + assert.Regexp(t, regexU128, err.Error()) + + // Test 3: Value exceeding max U64 + tooLargeU64 := new(big.Int).Exp(big.NewInt(2), big.NewInt(64), nil) + + _, err = EncodeFromTypes( + []StarknetType{StarknetCoreType(U64)}, + []interface{}{tooLargeU64}, + ) + assert.Error(t, err) + regexU64 := regexp.MustCompile(`value \d+ is out of range for U64`) + assert.Regexp(t, regexU64, err.Error()) + +} + +func TestEncodeInvalidDictValues(t *testing.T) { + + rawUintStruct := StarknetStruct{ + Name: "CustomUint256", + Members: []AbiParameter{ + {Name: "low", Type: StarknetCoreType(U128)}, + {Name: "high", Type: StarknetCoreType(U128)}, + }, + } + + // Test 1: Negative value for "low" + negativeLow := map[string]interface{}{ + "low": big.NewInt(-1), + "high": big.NewInt(12324), + } + + _, err := EncodeFromTypes([]StarknetType{rawUintStruct}, []interface{}{negativeLow}) + assert.Error(t, err) + errorPattern := regexp.MustCompile(`Failed to Encode (.*?) to \w+`) + assert.Regexp(t, errorPattern, err.Error()) + + // Test 2: "low" exceeds MAX_U128 + MAX_U128, _ := StarknetCoreType(U128).maxValue() + tooLargeLow := map[string]interface{}{ + "low": new(big.Int).Add(MAX_U128, big.NewInt(1)), + "high": big.NewInt(4543535), + } + + _, err = EncodeFromTypes([]StarknetType{rawUintStruct}, []interface{}{tooLargeLow}) + assert.Error(t, err) + assert.Regexp(t, errorPattern, err.Error()) + + // Test 3: Negative value for "high" + negativeHigh := map[string]interface{}{ + "low": big.NewInt(652432), + "high": big.NewInt(-1), + } + + _, err = EncodeFromTypes([]StarknetType{rawUintStruct}, []interface{}{negativeHigh}) + assert.Error(t, err) + assert.Regexp(t, errorPattern, err.Error()) + + // Test 4: "high" exceeds MAX_U128 + tooLargeHigh := map[string]interface{}{ + "low": big.NewInt(0), + "high": new(big.Int).Add(MAX_U128, big.NewInt(1)), + } + + _, err = EncodeFromTypes([]StarknetType{rawUintStruct}, []interface{}{tooLargeHigh}) + assert.Error(t, err) + assert.Regexp(t, errorPattern, err.Error()) +} + +func TestEncodeInvalidType(t *testing.T) { + tests := []struct { + encodeType StarknetType + encodeValues []interface{} + errorMessage string + }{ + { + encodeType: StarknetCoreType(U64), + encodeValues: []interface{}{ + "wololoo", + nil, + map[string]interface{}{"low": 12}, + "0xaabbccddff001122334455", + }, + errorMessage: `cannot encode value of type .* to U64`, + }, + { + encodeType: StarknetCoreType(Bool), + encodeValues: []interface{}{ + nil, + []interface{}{nil, true, false}, + 123, + map[string]interface{}{"low": 1234, "high": 0}, + }, + errorMessage: `cannot encode non-boolean value .* to Bool`, + }, + { + encodeType: StarknetArray{InnerType: StarknetCoreType(U64)}, + encodeValues: []interface{}{ + nil, + "0x12334455", + map[string]interface{}{"low": 1234, "high": 0}, + false, + }, + errorMessage: `.* cannot be encoded into a StarknetArray`, + }, + } + + for _, tt := range tests { + for _, encodeValue := range tt.encodeValues { + t.Run(fmt.Sprintf("%v-%v", tt.encodeType, encodeValue), func(t *testing.T) { + _, err := EncodeFromTypes([]StarknetType{tt.encodeType}, []interface{}{encodeValue}) + if err == nil { + t.Errorf("expected error matching %q but got none", tt.errorMessage) + return + } + + if !errorMatches(err.Error(), tt.errorMessage) { + t.Errorf("expected error matching %q but got %q", tt.errorMessage, err.Error()) + } + }) + } + } +} + +func TestDecodeExtraCalldata(t *testing.T) { + types := []StarknetType{StarknetCoreType(U8), StarknetCoreType(U256)} + callData := []*big.Int{big.NewInt(123), big.NewInt(0)} + errorPattern := "not enough calldata to decode U256" + t.Run(fmt.Sprintf("%v", types), func(t *testing.T) { + _, err := DecodeFromTypes(types, &callData) + if err == nil { + t.Errorf("expected error matching %q but got none", errorPattern) + return + } + + if !errorMatches(err.Error(), errorPattern) { + t.Errorf("expected error matching %q but got %q", errorPattern, err.Error()) + } + }) +} + +func TestDecodeInvalidUIntValues(t *testing.T) { + + MAX_U128, _ := StarknetCoreType(U128).maxValue() + tests := []struct { + types []StarknetType + callData []*big.Int + expectedError string + }{ + { + types: []StarknetType{StarknetCoreType(U256)}, + callData: []*big.Int{new(big.Int).Add(MAX_U128, big.NewInt(1)), big.NewInt(0)}, + expectedError: "low Exceeds U128 range", + }, + { + types: []StarknetType{StarknetCoreType(U256)}, + callData: []*big.Int{new(big.Int).Add(MAX_U128, big.NewInt(1)), new(big.Int).Add(MAX_U128, big.NewInt(1))}, + expectedError: "low Exceeds U128 range", + }, + { + types: []StarknetType{StarknetCoreType(U256)}, + callData: []*big.Int{new(big.Int).Sub(big.NewInt(0), big.NewInt(1)), big.NewInt(0)}, + expectedError: "low Exceeds U128 range", + }, + { + types: []StarknetType{StarknetCoreType(U256)}, + callData: []*big.Int{big.NewInt(0), new(big.Int).Add(MAX_U128, big.NewInt(1))}, + expectedError: "high Exceeds U128 range", + }, + { + types: []StarknetType{StarknetCoreType(U256)}, + callData: []*big.Int{big.NewInt(0), new(big.Int).Sub(big.NewInt(0), big.NewInt(1))}, + expectedError: "high Exceeds U128 range", + }, + } + + for _, tt := range tests { + t.Run(fmt.Sprintf("%v", tt.callData), func(t *testing.T) { + _, err := DecodeFromTypes(tt.types, &tt.callData) + if err == nil { + t.Errorf("expected error matching %q but got none", tt.expectedError) + return + } + + if !errorMatches(err.Error(), tt.expectedError) { + t.Errorf("expected error matching %q but got %q", tt.expectedError, err.Error()) + } + }) + } +} + +func errorMatches(errorMessage, pattern string) bool { + + matched, err := regexp.MatchString(pattern, errorMessage) + if err != nil { + return false + } + return matched +} diff --git a/athena_abi/parse.go b/athena_abi/parse.go index 2ff6cc35..dacc189e 100644 --- a/athena_abi/parse.go +++ b/athena_abi/parse.go @@ -10,11 +10,13 @@ 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" { + typeStr, _ := entry["type"].(string) + if typeStr == "struct" || typeStr == "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(typeStr)], entry) } + } return grouped } @@ -109,6 +111,10 @@ 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 sortedTypeDefJson, nil } @@ -150,21 +156,35 @@ 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{}) { + memberInterfaces, ok := abiStruct["members"].([]interface{}) + if !ok { + return StarknetStruct{}, fmt.Errorf("invalid type for members: expected []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 +197,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 @@ -209,8 +242,8 @@ func parseType(abiType string, customTypes map[string]interface{}) (StarknetType } return res, nil } - parts := strings.Split(abiType, "::")[1:] + switch { case len(parts) == 1 && parts[0] == "felt252": return Felt, nil @@ -226,7 +259,7 @@ 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"): res, err := parseType(extractInnerType(abiType), customTypes) if err != nil { return nil, err @@ -244,26 +277,33 @@ 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: + abiType := strings.TrimSpace(abiType) if val, exists := customTypes[abiType]; exists { return val.(StarknetType), nil - } - if abiType == "felt" { + } else if abiType == "felt" { 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 { + return nil, &InvalidAbiError{ + Msg: "Invalid ABI type: " + abiType, + } } - return nil, &InvalidAbiError{ - Msg: "Invalid ABI type: " + abiType, - } + } } @@ -284,20 +324,19 @@ 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 { @@ -315,7 +354,6 @@ func ParseTuple(abiType string, customTypes map[string]interface{}) (StarknetTup outputTypes = append(outputTypes, res) } } - if tupleClose > 0 { parenthesisCache = parenthesisCache[:len(parenthesisCache)-tupleClose] if len(parenthesisCache) == 0 { @@ -380,11 +418,13 @@ 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{}) + 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, @@ -394,9 +434,9 @@ 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)) } parsedOutputs, err := ParseAbiTypes( @@ -418,7 +458,12 @@ func ParseAbiEvent(abiEvent map[string]interface{}, customTypes map[string]inter eventParameters := []map[string]interface{}{} if value, exists := abiEvent["kind"]; exists { if value == "struct" { - eventParameters = abiEvent["members"].([]map[string]interface{}) + eventMembers := abiEvent["members"].([]interface{}) + + for _, member := range eventMembers { + mem, _ := member.(map[string]interface{}) + eventParameters = append(eventParameters, mem) + } } else { return nil, nil } @@ -430,33 +475,48 @@ 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 { + var result []map[string]interface{} + for _, item := range data { + // Assert the type of item + if m, ok := item.(map[string]interface{}); ok { + result = append(result, m) + } + } + for _, e := range result { 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 + + if keys, ok := abiEvent["keys"].([]interface{}); ok { + var keyres []map[string]interface{} + for _, key := range keys { + if m, ok := key.(map[string]interface{}); ok { + keyres = append(keyres, m) + } + } + for _, e := range keyres { + eventParameter := map[string]interface{}{"kind": "key"} + for k, v := range e { + eventParameter[k] = v + } + eventParameters = append(eventParameters, eventParameter) } - eventParameters = append(eventParameters, eventParameter) } + } else { return nil, nil } types := []string{} names := []string{} - for _, eventParameter := range eventParameters { types = append(types, eventParameter["type"].(string)) names = append(names, eventParameter["name"].(string)) } - decodedParams, err := parseAbiParameters( names, types, diff --git a/athena_abi/parse_full_abi_test.go b/athena_abi/parse_full_abi_test.go new file mode 100644 index 00000000..964b38f4 --- /dev/null +++ b/athena_abi/parse_full_abi_test.go @@ -0,0 +1,229 @@ +package athena_abi + +import ( + "encoding/hex" + "encoding/json" + "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 (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") + decoder, err := StarknetAbiFromJSON(wildcardAbi, "complex_array", classHash) + assert.NoError(t, err, "there should not be error") + parsedEvent, ok := decoder.Events["log_storage_cells"] + 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") + 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") +} + +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) + 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") + // 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/athena_abi/parse_struct_test.go b/athena_abi/parse_struct_test.go new file mode 100644 index 00000000..d3b290f2 --- /dev/null +++ b/athena_abi/parse_struct_test.go @@ -0,0 +1,260 @@ +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) +} + +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") +} 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 +}