-
Notifications
You must be signed in to change notification settings - Fork 0
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
CU-86dt24n2g - Allow user to add/change icon link if they can verify … #10
Conversation
…themselves on the smart contract
def get_deployer(script_hash: UInt160, sender: UInt160) -> Optional[UInt160]: | ||
contract: Contract = ContractManagement.get_contract(script_hash) | ||
@public(name='canChangeMetaData', safe=True) | ||
def can_change_meta_data(contract_script_hash: UInt160, contract_owner: UInt160) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming the function can_change_meta_data
to can_change_metadata
to follow the camelCase naming convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metadata is a single word. We should change on the annotation as well to canChangeMetadata
has_verify = True | ||
break | ||
if has_verify: | ||
if runtime.check_witness(contract_script_hash): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider handling the case where runtime.check_witness(contract_script_hash)
returns None
. This could potentially lead to a NoneType
error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for the check_witness to return None
?
|
||
current_contract_owner: UInt160 = get_contract_owner(contract_script_hash) | ||
if isinstance(current_contract_owner, UInt160): | ||
if runtime.check_witness(current_contract_owner): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider handling the case where runtime.check_witness(current_contract_owner)
returns None
. This could potentially lead to a NoneType
error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, is it possible for the check_witness to return None
?
def get_deployer(script_hash: UInt160, sender: UInt160) -> Optional[UInt160]: | ||
contract: Contract = ContractManagement.get_contract(script_hash) | ||
@public(name='canChangeMetaData', safe=True) | ||
def can_change_meta_data(contract_script_hash: UInt160, contract_owner: UInt160) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metadata is a single word. We should change on the annotation as well to canChangeMetadata
has_verify = True | ||
break | ||
if has_verify: | ||
if runtime.check_witness(contract_script_hash): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for the check_witness to return None
?
|
||
current_contract_owner: UInt160 = get_contract_owner(contract_script_hash) | ||
if isinstance(current_contract_owner, UInt160): | ||
if runtime.check_witness(current_contract_owner): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, is it possible for the check_witness to return None
?
|
||
return sender | ||
# check if the contract was deployed by the given address | ||
computed_script_hash: bytes = _compute_contract_hash(contract_owner, contract) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for the _compute_contract_hash to return None?
…themselves on the smart contract