Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multisig controller & factory #168

Draft
wants to merge 52 commits into
base: feat/next
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
62f8348
Sketch factory for multisig V2.
andreibancioiu Oct 17, 2024
5bb0c2e
Sketch controller for multisig.
andreibancioiu Oct 17, 2024
a695dd4
Bits of refactoring. Multisig queries, work in progress.
andreibancioiu Oct 17, 2024
af7de7e
More queries, work in progress.
andreibancioiu Oct 17, 2024
5598e64
Rename file.
andreibancioiu Oct 17, 2024
dbe2e78
Additional functions, work in progress.
andreibancioiu Oct 17, 2024
981d93e
More functions.
andreibancioiu Oct 17, 2024
64b0db9
Multisig controller (without factory).
andreibancioiu Oct 17, 2024
4f8b019
Multisig: new endpoints.
andreibancioiu Oct 17, 2024
ab8fafe
More multisig functions.
andreibancioiu Oct 17, 2024
c5156e9
Cleanup parse_execute and await_completed.
andreibancioiu Oct 17, 2024
cd1fc65
Update multisig ABI (test data).
andreibancioiu Oct 17, 2024
5d0a5a0
Adjust call to to_bytes(), to work with older Python.
andreibancioiu Oct 17, 2024
dbd2449
Work in progress.
andreibancioiu Oct 17, 2024
a457e64
Update ABI.
andreibancioiu Oct 17, 2024
eae7e48
Sketch test for multisig etc.
andreibancioiu Oct 17, 2024
72386c4
Fixes, additional implementation.
andreibancioiu Oct 18, 2024
f391977
Allow one to easily do contract deployments via async call.
andreibancioiu Oct 18, 2024
f6aa791
Remove test code.
andreibancioiu Oct 18, 2024
a92e4d2
Adjust resources etc.
andreibancioiu Oct 18, 2024
170fb2b
Bugfixes, extra testing.
andreibancioiu Oct 18, 2024
defb4f7
Extra tests.
andreibancioiu Oct 18, 2024
fba1457
Attempt to fix ProposeTransferExecuteEsdtInput.
andreibancioiu Oct 18, 2024
6ad0c2c
Fix comment.
andreibancioiu Oct 18, 2024
7c72b80
Refactoring.
andreibancioiu Oct 18, 2024
b8896cf
Fix encoding, additional tests etc.
andreibancioiu Oct 21, 2024
005ab21
Increase default DEFAULT_TRANSACTION_AWAITING_PATIENCE_IN_MILLISECONDS.
andreibancioiu Oct 21, 2024
ee19cd7
Fix test.
andreibancioiu Oct 21, 2024
c46a8ba
Additional functions.
andreibancioiu Oct 21, 2024
57dbf75
Improve enum support (allow explicit cast to int).
andreibancioiu Oct 21, 2024
a2d90a0
Implement get_user_role().
andreibancioiu Oct 21, 2024
f28c3f3
Implement get_all_board_members().
andreibancioiu Oct 21, 2024
863e8a1
Additional multisig queries.
andreibancioiu Oct 21, 2024
69d80cc
Split test files.
andreibancioiu Oct 21, 2024
b2766bd
Optimize test (intra-shard).
andreibancioiu Oct 21, 2024
3802070
get_pending_actions_full_info().
andreibancioiu Oct 21, 2024
b387031
Better Address.__repr__.
andreibancioiu Oct 21, 2024
89963cf
Implement CodeMetadataValue - using BytesValue was wrong.
andreibancioiu Oct 21, 2024
57f4e72
Handle explicit enums.
andreibancioiu Oct 22, 2024
f21e5c9
Implement CodeMetadata.
andreibancioiu Oct 22, 2024
75b6212
Improve test (fix regression).
andreibancioiu Oct 22, 2024
67cc3e9
Refactoring, cleanup - remove "ITransactionToDecode".
andreibancioiu Oct 22, 2024
4537d5a
Improve StringValue.
andreibancioiu Oct 22, 2024
5c8b77c
Merge branch 'feat/next' into multisig
andreibancioiu Oct 23, 2024
a389570
Merge branch 'feat/next' into multisig
andreibancioiu Oct 24, 2024
ececf8d
update ProposeSCUpgradeFromSourceInput params
bcosma Oct 25, 2024
363dd4e
Merge branch 'feat/next' into multisig
andreibancioiu Oct 28, 2024
ab6497e
Handle "proposeSyncCall".
andreibancioiu Oct 28, 2024
6137929
Merge branch 'feat/next' into multisig
andreibancioiu Dec 10, 2024
fd825fc
Undo changes commited by mistake (e.g. formatting).
andreibancioiu Dec 10, 2024
01acf45
Add localnet entrypoint.
andreibancioiu Dec 10, 2024
70e62c1
Partial fix after merge.
andreibancioiu Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 64 additions & 26 deletions examples/contracts/multisig-full.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
],
"outputs": []
},
"upgradeConstructor": {
"inputs": [],
"outputs": []
},
"endpoints": [
{
"name": "upgrade",
"mutability": "mutable",
"inputs": [],
"outputs": []
},
{
"docs": [
"Allows the contract to receive funds even if it is marked as unpayable in the protocol."
],
"name": "deposit",
"mutability": "mutable",
"payableInTokens": ["*"],
"payableInTokens": [
"*"
],
"inputs": [],
"outputs": []
},
Expand All @@ -48,7 +48,9 @@
"outputs": []
},
{
"docs": ["Discard all the actions with the given IDs"],
"docs": [
"Discard all the actions with the given IDs"
],
"name": "discardBatch",
"mutability": "mutable",
"inputs": [
Expand All @@ -61,7 +63,9 @@
"outputs": []
},
{
"docs": ["Minimum number of signatures needed to perform any action."],
"docs": [
"Minimum number of signatures needed to perform any action."
],
"name": "getQuorum",
"mutability": "readonly",
"inputs": [],
Expand Down Expand Up @@ -394,7 +398,9 @@
]
},
{
"docs": ["Used by board members to sign actions."],
"docs": [
"Used by board members to sign actions."
],
"name": "sign",
"mutability": "mutable",
"inputs": [
Expand All @@ -406,7 +412,9 @@
"outputs": []
},
{
"docs": ["Sign all the actions in the given batch"],
"docs": [
"Sign all the actions in the given batch"
],
"name": "signBatch",
"mutability": "mutable",
"inputs": [
Expand Down Expand Up @@ -460,7 +468,9 @@
"outputs": []
},
{
"docs": ["Unsign all actions with the given IDs"],
"docs": [
"Unsign all actions with the given IDs"
],
"name": "unsignBatch",
"mutability": "mutable",
"inputs": [
Expand Down Expand Up @@ -548,7 +558,9 @@
]
},
{
"docs": ["Perform all the actions in the given batch"],
"docs": [
"Perform all the actions in the given batch"
],
"name": "performBatch",
"mutability": "mutable",
"inputs": [
Expand All @@ -563,7 +575,9 @@
"name": "dnsRegister",
"onlyOwner": true,
"mutability": "mutable",
"payableInTokens": ["EGLD"],
"payableInTokens": [
"EGLD"
],
"inputs": [
{
"name": "dns_address",
Expand Down Expand Up @@ -599,7 +613,9 @@
"multi_result": true
}
],
"labels": ["multisig-external-view"],
"labels": [
"multisig-external-view"
],
"allow_multiple_var_args": true
},
{
Expand All @@ -622,10 +638,14 @@
"type": "UserRole"
}
],
"labels": ["multisig-external-view"]
"labels": [
"multisig-external-view"
]
},
{
"docs": ["Lists all users that can sign actions."],
"docs": [
"Lists all users that can sign actions."
],
"name": "getAllBoardMembers",
"mutability": "readonly",
"inputs": [],
Expand All @@ -635,10 +655,14 @@
"multi_result": true
}
],
"labels": ["multisig-external-view"]
"labels": [
"multisig-external-view"
]
},
{
"docs": ["Lists all proposers that are not board members."],
"docs": [
"Lists all proposers that are not board members."
],
"name": "getAllProposers",
"mutability": "readonly",
"inputs": [],
Expand All @@ -648,10 +672,14 @@
"multi_result": true
}
],
"labels": ["multisig-external-view"]
"labels": [
"multisig-external-view"
]
},
{
"docs": ["Serialized action data of an action with index."],
"docs": [
"Serialized action data of an action with index."
],
"name": "getActionData",
"mutability": "readonly",
"inputs": [
Expand All @@ -665,7 +693,9 @@
"type": "Action"
}
],
"labels": ["multisig-external-view"]
"labels": [
"multisig-external-view"
]
},
{
"docs": [
Expand All @@ -686,7 +716,9 @@
"type": "List<Address>"
}
],
"labels": ["multisig-external-view"]
"labels": [
"multisig-external-view"
]
},
{
"docs": [
Expand All @@ -706,7 +738,9 @@
"type": "u32"
}
],
"labels": ["multisig-external-view"]
"labels": [
"multisig-external-view"
]
},
{
"docs": [
Expand All @@ -729,7 +763,9 @@
"type": "u32"
}
],
"labels": ["multisig-external-view"]
"labels": [
"multisig-external-view"
]
}
],
"events": [
Expand Down Expand Up @@ -1120,7 +1156,9 @@
},
"ActionFullInfo": {
"type": "struct",
"docs": ["Not used internally, just to retrieve results via endpoint."],
"docs": [
"Not used internally, just to retrieve results via endpoint."
],
"fields": [
{
"name": "action_id",
Expand Down
6 changes: 4 additions & 2 deletions multiversx_sdk/core/transaction_events_parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ def test_multisig_start_perform_action():
'__discriminant__': 5
},
),
signers=[Address.new_from_bech32("erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th").get_public_key(),
Address.new_from_bech32("erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx").get_public_key()]
signers=[
Address.new_from_bech32("erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th").get_public_key(),
Address.new_from_bech32("erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx").get_public_key()
]
)
7 changes: 7 additions & 0 deletions multiversx_sdk/entrypoints/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from dataclasses import dataclass


@dataclass
class LocalnetEntrypointConfig:
network_provider_url = "http://localhost:7950"
network_provider_kind = "proxy"
chain_id = "localnet"


@dataclass
class TestnetEntrypointConfig:
network_provider_url = "https://testnet-api.multiversx.com"
Expand Down
14 changes: 8 additions & 6 deletions multiversx_sdk/entrypoints/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from multiversx_sdk.delegation.delegation_transactions_factory import \
DelegationTransactionsFactory
from multiversx_sdk.entrypoints.config import (DevnetEntrypointConfig,
LocalnetEntrypointConfig,
MainnetEntrypointConfig,
TestnetEntrypointConfig)
from multiversx_sdk.entrypoints.errors import InvalidNetworkProviderKindError
Expand Down Expand Up @@ -142,28 +143,29 @@ def create_transfers_transactions_factory(self) -> TransferTransactionsFactory:
return TransferTransactionsFactory(TransactionsFactoryConfig(self.chain_id))


class LocalnetEntrypoint(NetworkEntrypoint):
def __init__(self, url: Optional[str] = None, kind: Optional[str] = None) -> None:
url = url or LocalnetEntrypointConfig.network_provider_url
kind = kind or LocalnetEntrypointConfig.network_provider_kind
super().__init__(url, kind, LocalnetEntrypointConfig.chain_id)


class TestnetEntrypoint(NetworkEntrypoint):
def __init__(self, url: Optional[str] = None, kind: Optional[str] = None) -> None:
url = url or TestnetEntrypointConfig.network_provider_url

kind = kind or TestnetEntrypointConfig.network_provider_kind

super().__init__(url, kind, TestnetEntrypointConfig.chain_id)


class DevnetEntrypoint(NetworkEntrypoint):
def __init__(self, url: Optional[str] = None, kind: Optional[str] = None) -> None:
url = url or DevnetEntrypointConfig.network_provider_url

kind = kind or DevnetEntrypointConfig.network_provider_kind

super().__init__(url, kind, DevnetEntrypointConfig.chain_id)


class MainnetEntrypoint(NetworkEntrypoint):
def __init__(self, url: Optional[str] = None, kind: Optional[str] = None) -> None:
url = url or MainnetEntrypointConfig.network_provider_url

kind = kind or MainnetEntrypointConfig.network_provider_kind

super().__init__(url, kind, MainnetEntrypointConfig.chain_id)
Loading
Loading