tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
275 stars 56 forks source link

Make a utility function or alias to existing function for returning excessive funds from any receiver #358

Open novusnota opened 1 month ago

novusnota commented 1 month ago

self.notify() function in the Base trait (/stdlib/std/base.tact) is perfectly fine on its own, but is not very descriptive when it's used to return excessive funds.

I think we need to introduce an alias for self.notify() , such that it's clear what is going on when it's used for sending remaining nanoToncoins from the received message. For example, it can be called self.refundExcessive(), self.returnExcess(), self.refundRemaining(), self.sendRemaining() or just self.refund().

Maybe, we can play on the fact that it works just as self.notify(), so it may be called like self.notifyRefund() / self.refundNotify() or self.notifyWithRemaining().

Alternatively, it doesn't have to be tied to Base trait and the function can be defined as a global static, and be named refund(), refundRemaining() or cashback() :)

Related to https://github.com/tact-lang/tact-docs/issues/231