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.
25 lines
509 B
25 lines
509 B
2 years ago
|
import "@stdlib/ownable";
|
||
|
import "./messages";
|
||
|
|
||
|
|
||
|
contract Linker {
|
||
|
index: Int;
|
||
|
master: Address;
|
||
|
owner: Address?;
|
||
|
neighbor: Address?;
|
||
|
|
||
|
init(index: Int, owner: Address) {
|
||
|
self.index = index;
|
||
|
self.owner = owner;
|
||
|
|
||
|
let ctx: Context = context();
|
||
|
self.master = ctx.sender;
|
||
|
}
|
||
|
|
||
|
receive(msg: SetLinkerNeighbor) {
|
||
|
let ctx: Context = context();
|
||
|
require(ctx.sender == self.master, "Invalid sender");
|
||
|
self.neighbor = msg.neighbor;
|
||
|
}
|
||
|
}
|