Last active
July 26, 2022 14:29
-
-
Save milancermak/b78a52d293ebf36ebae8ee882a1b0cde to your computer and use it in GitHub Desktop.
shared external funcs in cairo
This file contains hidden or 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 openzeppelin.access.ownable import Ownable | |
# this import brings public function from ownable_external.cairo | |
# into this contract; the OWNABLE is just a placeholder, because | |
# something has to be imported, Cairo doesn't support | |
# `from foo import *` nor `import foo` | |
from contracts.ownable_external import OWNABLE | |
@constructor | |
func constructor{ | |
syscall_ptr: felt*, | |
pedersen_ptr: HashBuiltin*, | |
range_check_ptr | |
}(owner : felt): | |
Ownable.initializer(owner) | |
return () | |
end | |
@external | |
func my_func(): | |
end | |
This file contains hidden or 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 openzeppelin.access.ownable import Ownable | |
const OWNABLE = 1 | |
@external | |
func transferOwnership{ | |
syscall_ptr: felt*, | |
pedersen_ptr: HashBuiltin*, | |
range_check_ptr | |
}(newOwner: felt): | |
Ownable.transfer_ownership(newOwner) | |
return () | |
end | |
@external | |
func renounceOwnership{ | |
syscall_ptr: felt*, | |
pedersen_ptr: HashBuiltin*, | |
range_check_ptr | |
}(): | |
Ownable.renounce_ownership() | |
return () | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment