Closed anton-trunov closed 4 months ago
This would also have to be updated in ton-org/blueprint, as this example is taken from there and it is what users get when they run npm create ton -- simple-counter --type tact-counter --contractName SimpleCounter
.
We may change its receiver function from this:
receive(msg: Add) {
self.counter += msg.amount;
}
To this:
receive(msg: Add) {
self.counter += msg.amount;
self.reply(null); // reply with excessive amount of Toncoin
// or
self.notify(null); // does the same, but would not bounce
// it is used in Deployable trait to send `DeployOk` with excessive funds back
}
But other than that, the deploy seems to be giving the excess back already — with DeployOk
message provided by the @stdlib/deploy
library and Deployable
trait. It's just that they're using self.notify()
function under the hood, which isn't bounceable and, thus, won't return funds in case of failed deployments.
Oh, and if users aren't using Deployable
trait for deployments, then it won't be giving any excess values unless explicitly made to. But as we're using Deployable
nearly everywhere that shouldn't be a frequent issue, if issue at all.
Let's say the deployer sends 0.05 TONs and calls a simple receiver. They should get the excess back