From 8cf4c8e78325245f1da3ba09a5fb6d364be15528 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Sat, 25 May 2024 10:18:47 +0200 Subject: [PATCH 1/2] feat: make receiver in Tact template refund remaining value Deploy returns excessive funds when the user uses `@stdlib/deploy` and `Deployable` trait. Therefore, it would be nice to showcase how to do the same in `receive()` functions right in the counter template. Related links: * https://github.com/tact-lang/tact-docs/issues/231 * https://github.com/tact-lang/tact-docs/pull/232 --- src/templates/tact/counter/contracts/contract.tact.template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/templates/tact/counter/contracts/contract.tact.template b/src/templates/tact/counter/contracts/contract.tact.template index 5eb553b..90c0c49 100644 --- a/src/templates/tact/counter/contracts/contract.tact.template +++ b/src/templates/tact/counter/contracts/contract.tact.template @@ -17,6 +17,9 @@ contract {{name}} with Deployable { receive(msg: Add) { self.counter += msg.amount; + + // Notify the caller that the receiver was executed and forward remaining value back + self.notify("Cashback".asComment()); } get fun counter(): Int { From 67986d5453705ff3c8c1576405cb5671f681d3bb Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Sat, 25 May 2024 10:20:55 +0200 Subject: [PATCH 2/2] chore: update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3937e76..aaba4ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- Changed `contract.tact.template` counter template to return remaining value from the message + ## [0.20.0] - 2024-05-07 ### Added