You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
contract trait Ownable {
event OwnershipRenounced(previousOwner: Address)
event OwnershipTransfered(previousOwner: Address, newOwner: Address)
self :: (any) {
public func getOwner() -> Address
}
self :: (getOwner) {
func setOwner(newOwner: Address)
public func renounceOwnership() {
emit OwnershipRenounced(getOwner())
setOwner(0x0000000000000000)
}
public func transferOwnership(newOwner: Address) {
assert(newOwner != 0x0000000000000000)
emit OwnershipTransfered(getOwner(), newOwner)
setOwner(newOwner)
}
}
}
contract To
62B6
yWallet: Ownable {
visible var owner: Address // visible automatically creates getOwner
// Skipping initialiser not relevant for this example
}
ToyWallet :: (any) {
public init(addr: Address) {
self.owner = addr
}
public func getOwner() -> Address {
return owner
}
}
ToyWallet :: (getOwner) {
func setOwner(newOwner: Address){
self.owner = newOwner
}
}
Error happens at line self :: (getOwner), the error message is Unexpectedly found nil. It is also not possible to change it to getOwner(), which gives another error.
The text was updated successfully, but these errors were encountered:
Error happens at line
self :: (getOwner)
, the error message isUnexpectedly found nil
. It is also not possible to change it togetOwner()
, which gives another error.The text was updated successfully, but these errors were encountered: