You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
637 B
31 lines
637 B
import "@stdlib/ownable"; |
|
import "./messages"; |
|
import "./constants"; |
|
|
|
|
|
contract Linker { |
|
index: Int; |
|
master: Address; |
|
owner: Address; |
|
neighbor: Address?; |
|
|
|
init(index: Int, owner: Address, master: Address) { |
|
self.index = index; |
|
self.owner = owner; |
|
self.master = master; |
|
} |
|
|
|
receive(msg: SetLinkerNeighbor) { |
|
let ctx: Context = context(); |
|
require(ctx.sender == self.master, "Invalid sender"); |
|
self.neighbor = msg.neighbor; |
|
} |
|
|
|
get fun owner(): Address? { |
|
return self.owner; |
|
} |
|
|
|
get fun master(): Address { |
|
return self.master; |
|
} |
|
}
|
|
|