-
-
Save fracek/846d3082f9803a7e65edc44292da9241 to your computer and use it in GitHub Desktop.
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
utils/ownable.cairo:11:5: Cannot compare 'starkware.cairo.common.invoke.invoke.Return' and 'felt'. | |
assert existing_owner = 0 | |
^***********************^ |
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
%lang starknet | |
from starkware.cairo.common.invoke import invoke | |
from starkware.cairo.common.alloc import alloc | |
func initialize_owner{syscall_ptr : felt*}(owner_reader, owner_writer, initial_owner : felt): | |
alloc_locals | |
let (owner_reader_args : felt*) = alloc() | |
let existing_owner = invoke(owner_reader, 0, owner_reader_args) | |
assert existing_owner = 0 | |
let (owner_writer_args : felt*) = alloc() | |
assert [owner_writer_args] = initialize_owner | |
invoke(owner_writer, 1, owner_writer_args) | |
return () | |
end |
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
%lang starknet | |
from starkware.cairo.common.registers import get_label_location | |
from starkware.starknet.common.syscalls import get_caller_address | |
from utils.ownable import initialize_owner | |
@storage_var | |
func _owner() -> (owner : felt): | |
end | |
@external | |
func initialize{syscall_ptr : felt*}(): | |
let (initial_owner) = get_caller_address() | |
tempvar syscall_ptr = syscall_ptr | |
let (owner_reader) = get_label_location(_owner.read) | |
let (owner_writer) = get_label_location(_owner.write) | |
initialize_owner(owner_reader, owner_writer, initial_owner) | |
tempvar syscall_ptr = syscall_ptr | |
return () | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment