Skip to content

Commit 3ff1650

Browse files
authored
chore: bump Tact to 1.6.6 and add formatting to CI (#135)
1 parent 19f0906 commit 3ff1650

File tree

11 files changed

+41
-167
lines changed

11 files changed

+41
-167
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
- name: Build
4747
run: yarn build
4848

49+
- name: Run Tact formatter
50+
run: yarn tact-fmt --check ./src
51+
4952
- name: Type check
5053
run: yarn tsc --noEmit
5154

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
yarn lint:es
55
yarn spell
66
yarn fmt:check
7+
yarn tact-fmt --check ./src

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"build": "yarn build:base && yarn build:governance",
55
"build:base": "tact --config ./tact.config.json --project Jetton",
66
"build:governance": "tact --config ./tact.config.json --project Governance",
7-
"lint": "yarn misti ./tact.config.json",
7+
"lint": "tact-fmt --check ./src && yarn misti ./tact.config.json",
88
"lint:es": "eslint .",
99
"lint:fix": "eslint . --fix",
1010
"test": "yarn test:base && yarn test:governance",
@@ -16,6 +16,7 @@
1616
"verify-deployment": "jest src/e2e-tests/verify-deployment.spec.ts",
1717
"fmt": "yarn prettier -l -w .",
1818
"fmt:check": "yarn prettier --check .",
19+
"fmt:tact": "tact-fmt --write ./src",
1920
"spell": "cspell \"**/*.{ts,js,json,md,yml,tact}\"",
2021
"spell:check": "cspell --no-progress \"**/*.{ts,js,json,md,yml}\"",
2122
"bench": "yarn build && cross-env PRINT_TABLE=true ts-node ./src/benchmarks/benchmarks.ts",
@@ -27,9 +28,9 @@
2728
},
2829
"dependencies": {
2930
"@aws-crypto/sha256-js": "^5.2.0",
30-
"@nowarp/misti": "^0.7.1",
31+
"@nowarp/misti": "^0.8.1",
3132
"@orbs-network/ton-access": "^2.3.3",
32-
"@tact-lang/compiler": "^1.6.5",
33+
"@tact-lang/compiler": "^1.6.6",
3334
"@tact-lang/ton-jest": "^0.0.4",
3435
"@ton/core": "^0.60.1",
3536
"@ton/crypto": "^3.2.0",

src/benchmarks/results_gas.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@
115115
"label": "Optimized checkEitherForwardPayload",
116116
"pr": "https://github.com/tact-lang/jetton/pull/124",
117117
"gas": {
118-
"transfer": "34179",
118+
"transfer": "33953",
119119
"mint": "18520",
120-
"burn": "12862",
120+
"burn": "12749",
121121
"discovery": "6015",
122122
"reportBalance": "4308",
123123
"claimWallet": "3984"
124124
},
125-
"summary": "79868"
125+
"summary": "79529"
126126
}
127127
]
128128
}

src/contracts/base/jetton-minter.tact

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ contract JettonMinter(
135135
}
136136
}
137137

138-
139138
inline fun getJettonWalletInit(address: Address): StateInit {
140139
return initOf JettonWallet(address, myAddress(), 0);
141140
}

src/contracts/base/jetton-wallet.tact

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ contract JettonWallet(
104104
}
105105

106106
receive(msg: JettonBurn) {
107-
// we can skip forceBasechain here because with other checks in place it's not possible
107+
// we can skip forceBasechain here because with other checks in place it's not possible
108108
// to acquire jettons outside of basechain, so amount check is enough
109109
require(sender() == self.owner, "Incorrect sender");
110110

src/contracts/governance/constants.tact

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ const MyWorkchain: Bool = false;
33

44
// This is enough for 1 year of storage
55
// And more than 8 years more until freeze
6-
const minTonsForStorage: Int = ton("0.01");
6+
const minTonsForStorage: Int = ton("0.01");
77
const gasForTransfer: Int = 10200;
8-
const gasForBurn: Int = 7500;
8+
const gasForBurn: Int = 7500;

src/contracts/governance/jetton-minter.tact

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ contract GovernanceJettonMinter(
3232

3333
let fwdCount = 1 + sign(msg.masterMsg.forwardTonAmount);
3434
let ctx = context();
35-
require(ctx.value >
35+
require(
36+
ctx.value >
3637
msg.masterMsg.forwardTonAmount +
3738
fwdCount * ctx.readForwardFee() +
3839
(2 * getComputeFee(gasForTransfer, false) + minTonsForStorage),
39-
"Insufficient amount of TON attached"
40+
"Insufficient amount of TON attached",
4041
);
4142

4243
self.totalSupply += msg.masterMsg.amount;
@@ -109,14 +110,15 @@ contract GovernanceJettonMinter(
109110

110111
let ctx = context();
111112
let fwdCount = 1 + sign(msgToSend.forwardTonAmount);
112-
require(ctx.value >
113+
require(
114+
ctx.value >
113115
msgToSend.forwardTonAmount +
114116
fwdCount * ctx.readForwardFee() +
115117
(2 * getComputeFee(gasForTransfer, false) + minTonsForStorage),
116-
"Insufficient amount of TON attached"
118+
"Insufficient amount of TON attached",
117119
);
118120

119-
deploy(DeployParameters{
121+
deploy(DeployParameters {
120122
bounce: false,
121123
value: msg.tonAmount,
122124
mode: SendPayGasSeparately | SendBounceIfActionFail,
@@ -128,22 +130,23 @@ contract GovernanceJettonMinter(
128130
JettonBurn.fromSlice(masterMsgSlice);
129131

130132
let ctx = context();
131-
require(ctx.value > (ctx.readForwardFee() + 2 * getComputeFee(gasForBurn, false)),
132-
"Insufficient amount of TON attached");
133-
134-
deploy(DeployParameters{
133+
require(
134+
ctx.value > (ctx.readForwardFee() + 2 * getComputeFee(gasForBurn, false)),
135+
"Insufficient amount of TON attached",
136+
);
137+
138+
deploy(DeployParameters {
135139
bounce: false,
136140
value: msg.tonAmount,
137141
mode: SendPayGasSeparately | SendBounceIfActionFail,
138142
body: msg.masterMsg,
139143
init: getJettonWalletInit(msg.toAddress),
140144
});
141-
142145
} else if (op == SetStatusOpcode) { // SetStatus opcode
143146
// It is needed to validate the message
144147
SetStatus.fromSlice(masterMsgSlice);
145148

146-
deploy(DeployParameters{
149+
deploy(DeployParameters {
147150
bounce: false,
148151
value: msg.tonAmount,
149152
mode: SendPayGasSeparately | SendBounceIfActionFail,
@@ -210,4 +213,3 @@ asm fun setData(newData: Cell) {
210213
asm fun setCode(newCode: Cell) {
211214
SETCODE
212215
}
213-

src/contracts/governance/jetton-wallet.tact

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ contract JettonWalletGovernance(
2424
let ctx = context();
2525
let fwdCount = 1 + sign(msg.forwardTonAmount); // msg.forwardTonAmount is coins, so it's non-negative
2626

27-
require(ctx.value >
27+
require(
28+
ctx.value >
2829
msg.forwardTonAmount +
2930
fwdCount * ctx.readForwardFee() +
3031
(2 * getComputeFee(gasForTransfer, false) + minTonsForStorage),
31-
"Insufficient amount of TON attached"
32+
"Insufficient amount of TON attached",
3233
);
3334

3435
deploy(DeployParameters {

src/contracts/governance/messages.tact

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ message(0xcb862902) ChangeMetadataUri {
131131
metadata: Slice as remaining;
132132
}
133133

134-
135134
// ============== Additional messages ==============
136135

137136
// provide_wallet_balance#7ac8d559 receiver:MsgAddress include_verify_info:Bool = InternalMsgBody

0 commit comments

Comments
 (0)