Skip to content

Commit

Permalink
feat[stdlib]: SendBounceIfActionFail constant for sendmode from rec…
Browse files Browse the repository at this point in the history
…ent TVM update (#122)
  • Loading branch information
Gusarich authored Feb 16, 2024
1 parent 4e03144 commit 116a135
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Binary and octal literals with underscores as numerical separators: PR [#99](https://github.com/tact-lang/tact/pull/99)
- Ternary conditional operator (`condition ? then : else`): PR [#97](https://github.com/tact-lang/tact/pull/97)
- The `--version` command-line flag for the Tact executable: PR [#137](https://github.com/tact-lang/tact/pull/137)
- The `SendBounceIfActionFail` send mode constant to the standard library: PR [#122](https://github.com/tact-lang/tact/pull/122)

### Changed
- Decimal and hexadecimal literals now allow underscores as numerical separators: PR [#99](https://github.com/tact-lang/tact/pull/99)
Expand Down
53 changes: 27 additions & 26 deletions src/imports/stdlib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ files['std/contract.tact'] =
files['std/crypto.tact'] =
'QG5hbWUoY2VsbF9oYXNoKQpleHRlbmRzIG5hdGl2ZSBoYXNoKHNlbGY6IENlbGwpOiBJbnQ7CgpAbmFtZShzbGljZV9oYXNoKQpleHRlbmRzIG5hdGl2ZSBoYXNoKHNl' +
'bGY6IFNsaWNlKTogSW50OwoKQG5hbWUoY2hlY2tfc2lnbmF0dXJlKQpuYXRpdmUgY2hlY2tTaWduYXR1cmUoaGFzaDogSW50LCBzaWduYXR1cmU6IFNsaWNlLCBwdWJs' +
'aWNfa2V5OiBJbnQpOiBCb29sOwoKQG5hbWUoY2hlY2tfZGF0YV9zaWduYXR1cmUpCm5hdGl2ZSBjaGVja0RhdGFTaWduYXR1cmUoaGFzaDogU2xpY2UsIHNpZ25hdHVy' +
'ZTogU2xpY2UsIHB1YmxpY19rZXk6IFNsaWNlKTogQm9vbDs=';
'aWNfa2V5OiBJbnQpOiBCb29sOwoKQG5hbWUoY2hlY2tfZGF0YV9zaWduYXR1cmUpCm5hdGl2ZSBjaGVja0RhdGFTaWduYXR1cmUoZGF0YTogU2xpY2UsIHNpZ25hdHVy' +
'ZTogU2xpY2UsIHB1YmxpY19rZXk6IEludCk6IEJvb2w7Cg==';
files['std/debug.tact'] =
'QG5hbWUodGhyb3cpCm5hdGl2ZSBuYXRpdmVUaHJvdyhjb2RlOiBJbnQpOwoKQG5hbWUodGhyb3dfd2hlbikKbmF0aXZlIG5hdGl2ZVRocm93V2hlbihjb2RlOiBJbnQs' +
'IGNvbmRpdGlvbjogQm9vbCk7CgpAbmFtZSh0aHJvdykKbmF0aXZlIHRocm93KGNvZGU6IEludCk7CgpAbmFtZSh0aHJvd191bmxlc3MpCm5hdGl2ZSBuYXRpdmVUaHJv' +
Expand All @@ -192,30 +192,31 @@ files['std/reserve.tact'] =
files['std/send.tact'] =
'QG5hbWUoc2VuZF9yYXdfbWVzc2FnZSkKbmF0aXZlIG5hdGl2ZVNlbmRNZXNzYWdlKGNlbGw6IENlbGwsIG1vZGU6IEludCk7Cgpjb25zdCBTZW5kUmVtYWluaW5nQmFs' +
'YW5jZTogSW50ID0gMTI4Owpjb25zdCBTZW5kUmVtYWluaW5nVmFsdWU6IEludCA9IDY0Owpjb25zdCBTZW5kSWdub3JlRXJyb3JzOiBJbnQgPSAyOwpjb25zdCBTZW5k' +
'UGF5R2FzU2VwYXJhdGVseTogSW50ID0gMTsKY29uc3QgU2VuZERlc3Ryb3lJZlplcm86IEludCA9IDMyOwoKc3RydWN0IFNlbmRQYXJhbWV0ZXJzIHsKICAgIGJvdW5j' +
'ZTogQm9vbCA9IHRydWU7CiAgICB0bzogQWRkcmVzczsKICAgIHZhbHVlOiBJbnQ7CiAgICBtb2RlOiBJbnQgPSAwOwogICAgYm9keTogQ2VsbD8gPSBudWxsOwogICAg' +
'Y29kZTogQ2VsbD8gPSBudWxsO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sKfQoKaW5saW5lIGZ1biBlbWl0KGJvZHk6' +
'IENlbGwpIHsKICAgIC8vIGV4dF9vdXRfbXNnX2luZm8kMTEgc3JjOk1zZ0FkZHJlc3NJbnQgZGVzdDpNc2dBZGRyZXNzRXh0IGNyZWF0ZWRfbHQ6dWludDY0IGNyZWF0' +
'ZWRfYXQ6dWludDMyCiAgICAvLyAgICAgICAgICAgICAgICAgICAgIG1heWJlOiBzdGF0ZUluaXQgKGZhbHNlKSBib2R5UmVmOiBib29sICh0cnVlKQogICAgbGV0IGM6' +
'IENlbGwgPSBiZWdpbkNlbGwoKQogICAgICAgIC5zdG9yZVVpbnQoMTUyMTE4MDcyMDI3Mzg3NTI4MTc5NjA0Mzg0NjQ1MTMsIDEwNCkKICAgICAgICAuc3RvcmVSZWYo' +
'Ym9keSkKICAgICAgICAuZW5kQ2VsbCgpOwogICAgbmF0aXZlU2VuZE1lc3NhZ2UoYywgMCk7Cn0KCkBuYW1lKGFjY2VwdF9tZXNzYWdlKQpuYXRpdmUgYWNjZXB0TWVz' +
'c2FnZSgpOwoKQG5hbWUoY29tbWl0KQpuYXRpdmUgY29tbWl0KCk7';
files['std/text.tact'] =
'Ly8KLy8gU3RyaW5nIGJ1aWxkZXIKLy8KCkBuYW1lKF9fdGFjdF9zdHJpbmdfYnVpbGRlcl9zdGFydF9zdHJpbmcpCm5hdGl2ZSBiZWdpblN0cmluZygpOiBTdHJpbmdC' +
'dWlsZGVyOwoKQG5hbWUoX190YWN0X3N0cmluZ19idWlsZGVyX3N0YXJ0X2NvbW1lbnQpCm5hdGl2ZSBiZWdpbkNvbW1lbnQoKTogU3RyaW5nQnVpbGRlcjsKCkBuYW1l' +
Expand Down
1 change: 1 addition & 0 deletions stdlib/std/send.tact
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const SendRemainingValue: Int = 64;
const SendIgnoreErrors: Int = 2;
const SendPayGasSeparately: Int = 1;
const SendDestroyIfZero: Int = 32;
const SendBounceIfActionFail: Int = 16;

struct SendParameters {
bounce: Bool = true;
Expand Down

0 comments on commit 116a135

Please sign in to comment.