Skip to content

Commit 2f96c37

Browse files
committed
Add Freezer SC wrapper
1 parent 2b63283 commit 2f96c37

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

sdk/contracts/Freezer.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import sys
2+
3+
from sdk.contracts.base_wrapper import BaseWrapper
4+
from sdk.registry import Registry
5+
6+
from web3 import Web3
7+
8+
9+
# TODO: test when other called SC wrappers will be written and callable
10+
class Freezer(BaseWrapper):
11+
"""
12+
Attributes:
13+
web3: Web3
14+
Web3 object
15+
registry: Registry
16+
Registry object
17+
address: str
18+
Contract's address
19+
abi: list
20+
Contract's ABI
21+
wallet: Wallet
22+
Wallet object to sign transactions
23+
"""
24+
25+
def __init__(self, web3: Web3, registry: Registry, address: str, abi: list, wallet: 'Wallet' = None):
26+
super().__init__(web3, registry, wallet=wallet)
27+
self.web3 = web3
28+
self.address = address
29+
self._contract = self.web3.eth.contract(self.address, abi=abi)
30+
self.__wallet = wallet
31+
32+
def freeze(self, target: str):
33+
return self._contract.functions.freeze(target).call()
34+
35+
def unfreeze(self, target: str):
36+
return self._contract.functions.unfreeze(target).call()
37+
38+
def is_frozen(self, address: str) -> bool:
39+
return self._contract.functions.isFrozen(address).call()

0 commit comments

Comments
 (0)