-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #566 from EvgeniyZZ/develop
Add IMA perdeployed
- Loading branch information
Showing
44 changed files
with
1,863 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
PROJECT_DIR=$(dirname $DIR) | ||
export ENDPOINT=${ENDPOINT:-http://localhost:8545} | ||
export ENV=test | ||
|
||
|
||
py.test $PROJECT_DIR/tests/ima $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# flake8: noqa | ||
from skale.contracts.base_contract import BaseContract, transaction_method | ||
from skale.contracts.config_controller.config_controller import ConfigController | ||
|
||
__all__ = [ | ||
'ConfigController' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of SKALE.py | ||
# | ||
# Copyright (C) 2019-Present SKALE Labs | ||
# | ||
# SKALE.py is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# SKALE.py is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with SKALE.py. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
from skale.contracts.base_contract import BaseContract, transaction_method | ||
from eth_typing import ChecksumAddress | ||
from skale.transactions.result import TxRes | ||
|
||
|
||
class ConfigController(BaseContract): | ||
"""Config controller contract""" | ||
|
||
def default_admin_role(self) -> bytes: | ||
return self.contract.functions.DEFAULT_ADMIN_ROLE().call() | ||
|
||
def deployer_admin_role(self) -> bytes: | ||
return self.contract.functions.DEPLOYER_ADMIN_ROLE().call() | ||
|
||
def deployer_role(self) -> bytes: | ||
return self.contract.functions.DEPLOYER_ROLE().call() | ||
|
||
def mtm_admin_role(self) -> bytes: | ||
return self.contract.functions.MTM_ADMIN_ROLE().call() | ||
|
||
def allowed_origin_role(self, deployer: ChecksumAddress) -> bytes: | ||
return self.contract.functions.allowedOriginRole(deployer).call() | ||
|
||
def allowed_origin_role_admin(self, deployer: ChecksumAddress) -> bytes: | ||
return self.contract.functions.allowedOriginRoleAdmin(deployer).call() | ||
|
||
def has_role(self, role: bytes, address: ChecksumAddress) -> bool: | ||
return bool(self.contract.functions.hasRole(role, address).call()) | ||
|
||
def get_role_admin(self, role: bytes) -> bytes: | ||
return self.contract.functions.getRoleAdmin(role).call() | ||
|
||
def get_role_member(self, role: bytes, index: int) -> bytes: | ||
return self.contract.functions.getRoleMember(role, index).call() | ||
|
||
def get_role_member_count(self, role: bytes) -> int: | ||
return self.contract.functions.getRoleMemberCount(role).call() | ||
|
||
def is_address_whitelisted(self, address: ChecksumAddress) -> bool: | ||
return bool(self.contract.functions.isAddressWhitelisted(address).call()) | ||
|
||
def is_deployment_allowed( | ||
self, | ||
transaction_origin: ChecksumAddress, | ||
deployer: ChecksumAddress | ||
) -> bool: | ||
return bool(self.contract.functions.isDeploymentAllowed(transaction_origin, deployer).call()) | ||
|
||
@transaction_method | ||
def grant_role( | ||
self, | ||
role: bytes, | ||
address: ChecksumAddress | ||
) -> TxRes: | ||
return self.contract.functions.grantRole(role, address) | ||
|
||
@transaction_method | ||
def add_allowed_origin_role_admin( | ||
self, | ||
role: bytes, | ||
address: ChecksumAddress | ||
) -> TxRes: | ||
return self.contract.functions.addAllowedOriginRoleAdmin(role, address) | ||
|
||
@transaction_method | ||
def allow_origin( | ||
self, | ||
transaction_origin: ChecksumAddress, | ||
deployer: ChecksumAddress | ||
) -> TxRes: | ||
return self.contract.functions.allowOrigin(transaction_origin, deployer) | ||
|
||
@transaction_method | ||
def add_to_whitelist(self, address: ChecksumAddress) -> TxRes: | ||
return self.contract.functions.addToWhitelist(address) | ||
|
||
@transaction_method | ||
def revoke_role(self, role: bytes, address: ChecksumAddress) -> TxRes: | ||
return self.contract.functions.revokeRole(role, address) | ||
|
||
@transaction_method | ||
def renounce_role(self, role: bytes, address: ChecksumAddress) -> TxRes: | ||
return self.contract.functions.renounceRole(role, address) | ||
|
||
@transaction_method | ||
def remove_allowed_origin_role_admin( | ||
self, | ||
role: bytes, | ||
address: ChecksumAddress | ||
) -> TxRes: | ||
return self.contract.functions.removeAllowedOriginRoleAdmin(role, address) | ||
|
||
@transaction_method | ||
def forbid_origin( | ||
self, | ||
transaction_origin: ChecksumAddress, | ||
deployer: ChecksumAddress | ||
) -> TxRes: | ||
return self.contract.functions.forbidOrigin(transaction_origin, deployer) | ||
|
||
@transaction_method | ||
def remove_from_whitelist(self, address: ChecksumAddress) -> TxRes: | ||
return self.contract.functions.removeFromWhitelist(address) | ||
|
||
@transaction_method | ||
def enable_free_contract_deployment(self) -> TxRes: | ||
return self.contract.functions.enableFreeContractDeployment() | ||
|
||
@transaction_method | ||
def disable_free_contract_deployment(self) -> TxRes: | ||
return self.contract.functions.disableFreeContractDeployment() | ||
|
||
def is_fcd_enabled(self) -> str: | ||
return self.contract.functions.isFCDEnabled().call() | ||
|
||
@transaction_method | ||
def enable_mtm(self) -> TxRes: | ||
return self.contract.functions.enableMTM() | ||
|
||
@transaction_method | ||
def disable_mtm(self) -> TxRes: | ||
return self.contract.functions.disableMTM() | ||
|
||
def is_mtm_enabled(self) -> str: | ||
return self.contract.functions.isMTMEnabled().call() | ||
|
||
def get_version(self) -> str: | ||
return self.contract.functions.version().call() | ||
|
||
@transaction_method | ||
def set_version(self, new_version) -> TxRes: | ||
return self.contract.functions.setVersion(new_version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of SKALE.py | ||
# | ||
# Copyright (C) 2019-Present SKALE Labs | ||
# | ||
# SKALE.py is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# SKALE.py is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with SKALE.py. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
from skale.contracts.base_contract import BaseContract | ||
from skale.skale_config_controller import SkaleConfigController | ||
|
||
|
||
class ConfigControllerContract(BaseContract[SkaleConfigController]): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# flake8: noqa | ||
from skale.contracts.base_contract import BaseContract, transaction_method | ||
from skale.contracts.context.context import Context | ||
|
||
__all__ = [ | ||
'Context' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of SKALE.py | ||
# | ||
# Copyright (C) 2019-Present SKALE Labs | ||
# | ||
# SKALE.py is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# SKALE.py is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with SKALE.py. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
from skale.contracts.base_contract import BaseContract, transaction_method | ||
from eth_typing import ChecksumAddress | ||
from skale.transactions.result import TxRes | ||
|
||
|
||
class Context(BaseContract): | ||
"""Context contract""" | ||
|
||
def get_schain_name(self) -> str: | ||
return self.contract.functions.getSchainName().call() | ||
|
||
def get_schain_owner_address(self) -> bytes: | ||
return self.contract.functions.getSchainOwnerAddress().call() | ||
|
||
@transaction_method | ||
def set_schain_owner_address(self, newOwner: ChecksumAddress) -> TxRes: | ||
return self.contract.functions.setSchainOwnerAddress(newOwner) | ||
|
||
def get_version(self) -> str: | ||
return self.contract.functions.version().call() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of SKALE.py | ||
# | ||
# Copyright (C) 2019-Present SKALE Labs | ||
# | ||
# SKALE.py is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# SKALE.py is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with SKALE.py. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
from skale.contracts.base_contract import BaseContract | ||
from skale.skale_context import SkaleContext | ||
|
||
|
||
class ContextContract(BaseContract[SkaleContext]): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# flake8: noqa | ||
from skale.contracts.base_contract import BaseContract, transaction_method | ||
from skale.contracts.etherbase.etherbase import Etherbase | ||
|
||
__all__ = [ | ||
'Etherbase' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of SKALE.py | ||
# | ||
# Copyright (C) 2019-Present SKALE Labs | ||
# | ||
# SKALE.py is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# SKALE.py is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with SKALE.py. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
from skale.contracts.base_contract import BaseContract, transaction_method | ||
from eth_typing import ChecksumAddress | ||
from skale.transactions.result import TxRes | ||
|
||
|
||
class Etherbase(BaseContract): | ||
"""Etherbase contract""" | ||
|
||
def default_admin_role(self) -> bytes: | ||
return self.contract.functions.DEFAULT_ADMIN_ROLE().call() | ||
|
||
def ether_manager_role(self) -> bytes: | ||
return self.contract.functions.ETHER_MANAGER_ROLE().call() | ||
|
||
@transaction_method | ||
def retrieve(self, address: ChecksumAddress) -> TxRes: | ||
return self.contract.functions.retrieve(address) | ||
|
||
@transaction_method | ||
def partially_retrieve(self, address: ChecksumAddress, amount: int) -> TxRes: | ||
return self.contract.functions.partiallyRetrieve(address, amount) | ||
|
||
def has_role(self, role: bytes, address: ChecksumAddress) -> bool: | ||
return bool(self.contract.functions.hasRole(role, address).call()) | ||
|
||
def get_role_admin(self, role: bytes) -> bytes: | ||
return self.contract.functions.getRoleAdmin(role).call() | ||
|
||
def get_role_member(self, role: bytes, index: int) -> bytes: | ||
return self.contract.functions.getRoleMember(role, index).call() | ||
|
||
def get_role_member_count(self, role: bytes) -> int: | ||
return self.contract.functions.getRoleMemberCount(role).call() | ||
|
||
@transaction_method | ||
def grant_role( | ||
self, | ||
role: bytes, | ||
address: ChecksumAddress | ||
) -> TxRes: | ||
return self.contract.functions.grantRole(role, address) | ||
|
||
@transaction_method | ||
def revoke_role(self, role: bytes, address: ChecksumAddress) -> TxRes: | ||
return self.contract.functions.revokeRole(role, address) | ||
|
||
@transaction_method | ||
def renounce_role(self, role: bytes, address: ChecksumAddress) -> TxRes: | ||
return self.contract.functions.renounceRole(role, address) | ||
|
||
def get_version(self) -> str: | ||
return self.contract.functions.version().call() | ||
|
||
@transaction_method | ||
def set_version(self, new_version) -> TxRes: | ||
return self.contract.functions.setVersion(new_version) |
Oops, something went wrong.