Skip to content

Commit

Permalink
Add SafeToL2Migration contract abi (#2246)
Browse files Browse the repository at this point in the history
* Add SafeToL2Migration contract abi

* Update test with new contract deployments
  • Loading branch information
falvaradorodriguez authored Oct 10, 2024
1 parent b192da2 commit 9ecc7e7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ psycogreen==1.0.2
psycopg2==2.9.9
redis==5.0.8
requests==2.32.3
safe-eth-py[django]==6.0.0b37
safe-eth-py[django]==6.0.0b38
web3==6.20.2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from config.settings.base import STATICFILES_DIRS
from safe_transaction_service.contracts.models import Contract

TRUSTED_FOR_DELEGATE_CALL = ["MultiSendCallOnly", "MultiSend"]
TRUSTED_FOR_DELEGATE_CALL = ["MultiSendCallOnly", "MultiSend", "SafeToL2Migration"]


def generate_safe_contract_display_name(contract_name: str, version: str) -> str:
Expand Down
9 changes: 8 additions & 1 deletion safe_transaction_service/contracts/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_update_safe_contracts_logo(self, mock_chain_id: MagicMock):
self.assertEqual(current_no_safe_contract_logo, previous_random_contract_logo)

# Missing safe addresses should be added
self.assertEqual(Contract.objects.count(), 19)
self.assertEqual(Contract.objects.count(), 22)

# Contract name and display name should be correctly generated
safe_l2_130_address = "0x3E5c63644E683549055b9Be8653de26E0B4CD36E"
Expand Down Expand Up @@ -92,3 +92,10 @@ def test_update_safe_contracts_logo(self, mock_chain_id: MagicMock):
self.assertEqual(contract.display_name, "Safe: MultiSendCallOnly 1.4.1")
# MultiSendCallOnly should be trusted for delegate calls
self.assertTrue(contract.trusted_for_delegate_call)

safe_to_l2_migration = "0xfF83F6335d8930cBad1c0D439A841f01888D9f69"
contract = Contract.objects.get(address=safe_to_l2_migration)
self.assertEqual(contract.name, "SafeToL2Migration")
self.assertEqual(contract.display_name, "SafeToL2Migration 1.4.1")
# SafeToL2Migration should be trusted for delegate calls
self.assertTrue(contract.trusted_for_delegate_call)
5 changes: 5 additions & 0 deletions safe_transaction_service/contracts/tx_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
get_erc721_contract,
get_kyber_network_proxy_contract,
get_multi_send_contract,
get_safe_to_l2_migration_contract,
get_safe_V0_0_1_contract,
get_safe_V1_0_0_contract,
get_safe_V1_1_1_contract,
Expand Down Expand Up @@ -476,6 +477,9 @@ def get_supported_abis(self) -> Iterable[ABIFunction]:
]

gnosis_safe = [gnosis_safe_allowance_module_abi]

safe_to_l2_migration = [get_safe_to_l2_migration_contract(self.dummy_w3).abi]

erc_contracts = [
get_erc721_contract(self.dummy_w3).abi,
get_erc20_contract(self.dummy_w3).abi,
Expand All @@ -502,6 +506,7 @@ def get_supported_abis(self) -> Iterable[ABIFunction]:
+ sight_contracts
+ gnosis_protocol
+ gnosis_safe
+ safe_to_l2_migration
+ erc_contracts
+ self.multisend_abis
+ supported_abis
Expand Down
12 changes: 12 additions & 0 deletions safe_transaction_service/history/tests/mocks/deployments_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,22 @@
"contractName": "SafeL2",
"address": "0x29fcB43b46531BcA003ddC8FCB67FFE91900C762",
},
{
"contractName": "SafeMigration",
"address": "0x526643F69b81B008F46d95CD5ced5eC0edFFDaC6",
},
{
"contractName": "SafeProxyFactory",
"address": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67",
},
{
"contractName": "SafeToL2Migration",
"address": "0xfF83F6335d8930cBad1c0D439A841f01888D9f69",
},
{
"contractName": "SafeToL2Setup",
"address": "0xBD89A1CE4DDe368FFAB0eC35506eEcE0b1fFdc54",
},
{
"contractName": "SignMessageLib",
"address": "0xd53cd0aB83D845Ac265BE939c57F53AD838012c9",
Expand Down

0 comments on commit 9ecc7e7

Please sign in to comment.