tact-lang / tact-docs

Tact main documentation
https://docs.tact-lang.org
42 stars 36 forks source link

Example on how to check sender privileges in receivers #126

Closed anton-trunov closed 3 months ago

anton-trunov commented 4 months ago

For instance, we can show an example like this here: https://docs.tact-lang.org/book/receive and cross link to https://docs.tact-lang.org/language/ref/common#require

It can be something really simple, e.g.

receive(msg: FooBarMsg) {
    require(self.contractOwner == sender(), "Only the owner can increase foobars");
    self.foobars += 1;
}
novusnota commented 3 months ago

I think that specific examples like this should exist in a Cookbook: #140.