Skip to content

Commit c4fe79f

Browse files
committed
Minor changes in methods parameters
1 parent fffdd15 commit c4fe79f

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

sdk/contracts/AccountsWrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ def __init__(self, web3: Web3, registry: Registry, address: str, abi: list, wall
3333
self._contract = self.web3.eth.contract(self.address, abi=abi)
3434
self.__wallet = wallet
3535

36-
def create_account(self) -> str:
36+
def create_account(self, parameters: dict = None) -> str:
3737
"""
3838
Creates an account
3939
4040
Returns:
4141
Transaction hash
4242
"""
4343
func_call = self._contract.functions.createAccount()
44-
return self.__wallet.send_transaction(func_call)
44+
return self.__wallet.send_transaction(func_call, parameters=parameters)
4545

4646
def get_attestation_signer(self, account: str) -> str:
4747
"""
@@ -137,7 +137,7 @@ def is_account(self, account: str) -> bool:
137137
Returns:
138138
Returns `true` if account exists. Returns `false` otherwise
139139
"""
140-
return self._contract.functions.isAccount().call()
140+
return self._contract.functions.isAccount(account).call()
141141

142142
def is_signer(self, address: str) -> bool:
143143
"""

sdk/contracts/GovernanceWrapper.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@ def withdraw(self) -> str:
336336

337337
return self.__wallet.send_transaction(func_call)
338338

339-
def propose(self, values: List[int], destinations: List[str], data: bytes, data_lengths: List[int], description_url: str) -> int:
339+
def propose(self, values: List[int], destinations: List[str], data: bytes, data_lengths: List[int], description_url: str, parameters: dict = None) -> int:
340340
func_call = self._contract.functions.propose(
341341
values, destinations, data, data_lengths, description_url)
342342

343-
return self.__wallet.send_transaction(func_call)
343+
return self.__wallet.send_transaction(func_call, parameters)
344344

345345
def proposal_exists(self, proposal_id: int) -> bool:
346346
"""
@@ -559,7 +559,7 @@ def _lesser_and_greater_after_upvote(self, upvoter: str, proposal_id: int) -> di
559559

560560
return self._lesser_and_greater(proposal_id, upvote_queue)
561561

562-
def upvote(self, proposal_id: int, upvoter: str) -> str:
562+
def upvote(self, proposal_id: int, upvoter: str, parameters: dict = None) -> str:
563563
"""
564564
Applies provided upvoter's upvote to given proposal
565565
@@ -578,9 +578,9 @@ def upvote(self, proposal_id: int, upvoter: str) -> str:
578578
func_call = self._contract.functions.upvote(
579579
proposal_id, lesser_id, greater_id)
580580

581-
return self.__wallet.send_transaction(func_call)
581+
return self.__wallet.send_transaction(func_call, parameters)
582582

583-
def revoke_upvote(self, upvoter: str) -> str:
583+
def revoke_upvote(self, upvoter: str, parameters: dict = None) -> str:
584584
"""
585585
Revokes provided upvoter's upvote
586586
@@ -593,7 +593,7 @@ def revoke_upvote(self, upvoter: str) -> str:
593593
func_call = self._contract.functions.revokeUpvote(
594594
lesser_id, greater_id)
595595

596-
return self.__wallet.send_transaction(func_call)
596+
return self.__wallet.send_transaction(func_call, parameters)
597597

598598
def approve(self, proposal_id: int) -> str:
599599
"""
@@ -613,7 +613,7 @@ def approve(self, proposal_id: int) -> str:
613613

614614
return self.__wallet.send_transaction(func_call)
615615

616-
def vote(self, proposal_id: int, vote: str) -> str:
616+
def vote(self, proposal_id: int, vote: str, parameters: dict = None) -> str:
617617
"""
618618
Applies `sender`'s vote choice to a given proposal
619619
@@ -632,7 +632,7 @@ def vote(self, proposal_id: int, vote: str) -> str:
632632
func_call = self._contract.functions.vote(
633633
proposal_id, proposal_index, vote_num)
634634

635-
return self.__wallet.send_transaction(func_call)
635+
return self.__wallet.send_transaction(func_call, parameters)
636636

637637
def get_vote_value(self, proposal_id: int, voter: str) -> str:
638638
"""

sdk/contracts/LockedGoldWrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def withdraw(self, index: int) -> str:
4949

5050
return self.__wallet.send_transaction(func_call)
5151

52-
def lock(self, value: int) -> str:
52+
def lock(self, parameters: dict = None) -> str:
5353
"""
5454
Locks gold to be used for voting
5555
@@ -63,7 +63,7 @@ def lock(self, value: int) -> str:
6363
"""
6464
func_call = self._contract.functions.lock()
6565

66-
return self.__wallet.send_transaction(func_call, parameters={'value': value})
66+
return self.__wallet.send_transaction(func_call, parameters=parameters)
6767

6868
def unlock(self, value: int) -> str:
6969
"""

sdk/contracts/MultiSigWrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, web3: Web3, registry: Registry, address: str, abi: list, wall
3333
self._contract = self.web3.eth.contract(self.address, abi=abi)
3434
self.__wallet = wallet
3535

36-
def submit_or_confirm_transaction(self, destination: str, tx_data: str, value: str = '0') -> str:
36+
def submit_or_confirm_transaction(self, destination: str, tx_data: str, value: str = '0', parameters: dict = None) -> str:
3737
"""
3838
Allows an owner to submit and confirm a transaction.
3939
If an unexecuted transaction matching `tx_object` exists on the multisig, adds a confirmation to that tx ID.
@@ -59,12 +59,12 @@ def submit_or_confirm_transaction(self, destination: str, tx_data: str, value: s
5959
if transaction[2] == data and transaction[0] == destination and transaction[1] == value and not transaction[3]:
6060
func_call = self._contract.functions.confirmTransaction(
6161
tx_id + 1)
62-
return self.__wallet.send_transaction(func_call)
62+
return self.__wallet.send_transaction(func_call, parameters)
6363

6464
func_call = self._contract.functions.submitTransaction(
6565
destination, value, tx_data)
6666

67-
return self.__wallet.send_transaction(func_call)
67+
return self.__wallet.send_transaction(func_call, parameters)
6868

6969
def is_owner(self, owner: str) -> bool:
7070
return self._contract.functions.isOwner(owner).call()

sdk/contracts/SortedOraclesWrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def is_oldest_report_expired(self, token: str) -> List[bool, str]:
125125

126126
return self._contract.functions.isOldestReportExpired(token_address).call()
127127

128-
def remove_expired_reports(self, token: str, num_reports: int = None) -> str:
128+
def remove_expired_reports(self, token: str, num_reports: int = None, parameteres: dict = None) -> str:
129129
"""
130130
Removes expired reports, if any exist
131131
@@ -148,7 +148,7 @@ def remove_expired_reports(self, token: str, num_reports: int = None) -> str:
148148

149149
func_call = self._contract.functions.removeExpiredReports(token_address, num_reports)
150150

151-
return self.__wallet.send_transaction(func_call)
151+
return self.__wallet.send_transaction(func_call, parameteres)
152152

153153
def report(self, token: str, value: int, oracle_address: str) -> str:
154154
"""

sdk/contracts/ValidatorsWrapper.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, web3: Web3, registry: Registry, address: str, abi: list, wall
3232
self._contract = self.web3.eth.contract(self.address, abi=abi)
3333
self.__wallet = wallet
3434

35-
def set_next_commission_update(self, commission: int) -> str:
35+
def set_next_commission_update(self, commission: int, parameters: dict = None) -> str:
3636
"""
3737
Queues an update to a validator group's commission
3838
@@ -47,9 +47,9 @@ def set_next_commission_update(self, commission: int) -> str:
4747
func_call = self._contract.functions.setNextCommissionUpdate(
4848
commission)
4949

50-
return self.__wallet.send_transaction(func_call)
50+
return self.__wallet.send_transaction(func_call, parameters)
5151

52-
def update_commission(self) -> str:
52+
def update_commission(self, parameters: dict = None) -> str:
5353
"""
5454
Updates a validator group's commission based on the previously queued update
5555
@@ -59,7 +59,7 @@ def update_commission(self) -> str:
5959
"""
6060
func_call = self._contract.functions.updateCommission()
6161

62-
return self.__wallet.send_transaction(func_call)
62+
return self.__wallet.send_transaction(func_call, parameters)
6363

6464
def get_validator_locked_gold_requirements(self) -> dict:
6565
"""
@@ -477,7 +477,7 @@ def deregister_validator(self, validator_address: str) -> str:
477477
raise Exception(
478478
f"{validator_address} is not a registered validator")
479479

480-
def register_validator_group(self, commission: int) -> str:
480+
def register_validator_group(self, commission: int, parameters: dict = None) -> str:
481481
"""
482482
Registers a validator group with no member validators
483483
Fails if the account is already a validator or validator group
@@ -492,7 +492,7 @@ def register_validator_group(self, commission: int) -> str:
492492
"""
493493
func_call = self._contract.functions.registerValidatorGroup(commission)
494494

495-
return self.__wallet.send_transaction(func_call)
495+
return self.__wallet.send_transaction(func_call, parameters)
496496

497497
def deregister_validator_group(self, validator_group_address: str) -> str:
498498
"""
@@ -515,7 +515,7 @@ def deregister_validator_group(self, validator_group_address: str) -> str:
515515
raise Exception(
516516
f"{validator_group_address} is not a registered validator")
517517

518-
def affiliate(self, group: str) -> str:
518+
def affiliate(self, group: str, parameters: dict = None) -> str:
519519
"""
520520
Affiliates a validator with a group, allowing it to be added as a member
521521
De-affiliates with the previously affiliated group if present
@@ -529,7 +529,7 @@ def affiliate(self, group: str) -> str:
529529
"""
530530
func_call = self._contract.functions.affiliate(group)
531531

532-
return self.__wallet.send_transaction(func_call)
532+
return self.__wallet.send_transaction(func_call, parameters)
533533

534534
def deaffiliate(self) -> str:
535535
func_call = self._contract.functions.deaffiliate()
@@ -564,7 +564,7 @@ def reset_slashing_multiplier(self) -> str:
564564

565565
return self.__wallet.send_transaction(func_call)
566566

567-
def add_member(self, group: str, validator: str) -> str:
567+
def add_member(self, group: str, validator: str, parameters: dict = None) -> str:
568568
"""
569569
Adds a member to the end of a validator group's list of members
570570
Fails if `validator` has not set their affiliation to this account
@@ -587,11 +587,11 @@ def add_member(self, group: str, validator: str) -> str:
587587
func_call = self._contract.functions.addFirstMember(
588588
validator, lesser_greater['lesser'], lesser_greater['greater'])
589589

590-
return self.__wallet.send_transaction(func_call)
590+
return self.__wallet.send_transaction(func_call, parameters)
591591
else:
592592
func_call = self._contract.functions.addMember(validator)
593593

594-
return self.__wallet.send_transaction(func_call)
594+
return self.__wallet.send_transaction(func_call, parameters)
595595

596596
def remove_member(self, validator: str) -> str:
597597
"""
@@ -609,7 +609,7 @@ def remove_member(self, validator: str) -> str:
609609

610610
return self.__wallet.send_transaction(func_call)
611611

612-
def reorder_member(self, group_addr: str, validator: str, new_index: int) -> str:
612+
def reorder_member(self, group_addr: str, validator: str, new_index: int, parameters: dict = None) -> str:
613613
"""
614614
Reorders a member within a validator group
615615
Fails if `validator` is not a member of the account's validator group
@@ -648,7 +648,7 @@ def reorder_member(self, group_addr: str, validator: str, new_index: int) -> str
648648
func_call = self._contract.functions.reorderMember(
649649
validator, next_member, prev_member)
650650

651-
return self.__wallet.send_transaction(func_call)
651+
return self.__wallet.send_transaction(func_call, parameters)
652652
except ValueError:
653653
raise Exception(
654654
f"ValidatorGroup {group_addr} does not include ${validator}")

sdk/contracts/base_wrapper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def create_all_the_contracts(self):
4040
raise Exception(
4141
f"Error occurs while create all the contracts objecst:\n{sys.exc_info()[1]}")
4242

43-
def create_and_get_contract_by_name(self, contract_name: str) -> 'ContractWrapperObject':
44-
self.create_contract_by_name(contract_name)
43+
def create_and_get_contract_by_name(self, contract_name: str, contract_address: str = None) -> 'ContractWrapperObject':
44+
self.create_contract_by_name(contract_name, contract_address)
4545
return self.get_contract_by_name(contract_name)
4646

4747
def get_contract_by_name(self, contract_name: str) -> 'ContractWrapperObject':
@@ -59,7 +59,7 @@ def get_contract_by_name(self, contract_name: str) -> 'ContractWrapperObject':
5959
"Such a contract was not created yet, call create_contract_by_name() or create_all_the_contracts() first")
6060
return contract_obj
6161

62-
def create_contract_by_name(self, contract_name: str):
62+
def create_contract_by_name(self, contract_name: str, contract_address: str = None):
6363
"""
6464
Creates contract wrapper object by contract name and saves to the dictionary
6565
@@ -69,7 +69,7 @@ def create_contract_by_name(self, contract_name: str):
6969
contract_obj = self.contracts.get(contract_name)
7070
if contract_obj:
7171
return
72-
contract_data = self.registry.load_contract_by_name(contract_name)
72+
contract_data = self.registry.load_contract_by_name(contract_name, contract_address)
7373

7474
self.create_contract(
7575
contract_name, contract_data['address'], contract_data['abi'])

0 commit comments

Comments
 (0)