Skip to content

Commit 884f2f8

Browse files
Merge pull request #180 from tonlabs/1.6.1-rc
Version 1.6.1
2 parents cab5e63 + fff41ac commit 884f2f8

File tree

9 files changed

+69
-14
lines changed

9 files changed

+69
-14
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.6.1] - 2023-03-28
6+
7+
### New
8+
9+
- Added new option `--base-path <path>` for `solidity compile` command (required solc 0.67.0 or later).
10+
11+
Use the given path as the root of the source tree instead of the root of the filesystem.
12+
13+
### Updated
14+
15+
- As of solc 0.67.0, the use of the "now" keyword is deprecated. The "block.timestamp" keyword should be used instead.
16+
- The `contracts/HelloWallet.sol` contract has been updated to require solc 0.67.0 or later to compile.
17+
- The sample contract created with `everdev sol create` now requires solc 0.67.0 or later to compile.
18+
519
## [1.6.0] - 2023-02-13
620

721
### New

contracts/HelloWallet.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* This file was generated by EverDev.
44
* EverDev is a part of TON OS (see http://ton.dev).
55
*/
6-
pragma ton-solidity >= 0.35.0;
6+
pragma ton-solidity >= 0.67.0;
77
pragma AbiHeader expire;
88

99
// This is class that describes you smart contract.
@@ -16,7 +16,7 @@ contract HelloWallet {
1616
// Contract can have a `constructor` – function that will be called when contract will be deployed to the blockchain.
1717
// In this example constructor adds current time to the instance variable.
1818
// All contracts need call tvm.accept(); for succeeded deploy
19-
constructor() public {
19+
constructor() {
2020
// Check that contract's public key is set
2121
require(tvm.pubkey() != 0, 101);
2222
// Check that message has signature (msg.pubkey() is not zero) and
@@ -27,7 +27,7 @@ contract HelloWallet {
2727
// messages, which bring no value (henceno gas) with themselves.
2828
tvm.accept();
2929

30-
timestamp = now;
30+
timestamp = block.timestamp;
3131
}
3232

3333
function renderHelloWorld () public pure returns (string) {
@@ -43,7 +43,7 @@ contract HelloWallet {
4343
// Tells to the TVM that we accept this message.
4444
tvm.accept();
4545
// Update timestamp
46-
timestamp = now;
46+
timestamp = block.timestamp;
4747
}
4848

4949
// Function returns value of state variable `timestamp`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "everdev",
3-
"version": "1.6.0",
3+
"version": "1.6.1",
44
"description": "Everscale Dev Environment",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/__tests__/checkArgs.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from "fs"
22
import path from "path"
33

44
import { doneTests, initTests, deleteFolderRecursive } from "./init"
5-
import { StringTerminal, runCommand } from ".."
5+
import { StringTerminal, consoleTerminal, runCommand } from ".."
66

77
const outPath = path.resolve(__dirname, "..", "..", `${Date.now()}-tmp`)
88

@@ -12,6 +12,8 @@ beforeEach(() => deleteFolderRecursive(outPath))
1212
afterEach(() => deleteFolderRecursive(outPath))
1313

1414
test("Should create HelloWallet.tvc in user defined output directory", async () => {
15+
await runCommand(consoleTerminal, "sol update", {})
16+
1517
const solPath = path.resolve(
1618
__dirname,
1719
"..",

src/__tests__/parser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ test("everdev sol compile a.sol", async () => {
5252
expect(args).toEqual({
5353
code: false,
5454
file: "a.sol",
55+
basePath: ".",
5556
includePath: "node_modules",
5657
outputDir: "",
5758
})
@@ -73,6 +74,7 @@ test("everdev sol compile a.sol b.sol --output-dir somedir", async () => {
7374
expect(args).toEqual({
7475
code: false,
7576
file: "a.sol b.sol",
77+
basePath: ".",
7678
includePath: "node_modules",
7779
outputDir: "somedir",
7880
})

src/__tests__/sol.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ test("AST of all source files in a JSON", async () => {
2828
"contracts",
2929
"HelloWallet.sol",
3030
)
31-
const astPath = path.resolve(__dirname, "..", "..", "HelloWallet.ast.json")
31+
const astPath = path.resolve(
32+
__dirname,
33+
"..",
34+
"..",
35+
"HelloWallet.sol_json.ast",
36+
)
37+
// Remove output file if exists
38+
try {
39+
fs.unlinkSync(astPath)
40+
} catch (_) {}
41+
3242
await runCommand(terminal, "sol ast --format json", {
3343
file: solPath,
3444
})

src/__tests__/wrap.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import path from "path"
22

33
import { doneTests, initTests, deleteFiles } from "./init"
4-
import { StringTerminal, runCommand } from ".."
4+
import { consoleTerminal, StringTerminal, runCommand } from ".."
55

66
beforeAll(initTests)
77
afterAll(doneTests)
88

99
test("Shoud create HelloWallet.abi.json file", async () => {
10+
await runCommand(consoleTerminal, "sol update", {})
1011
const solPath = path.resolve(
1112
__dirname,
1213
"..",

src/controllers/solidity/index.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,18 @@ export const solidityCompileCommand: Command = {
108108
title: "Output folder (current is default)",
109109
defaultValue: "",
110110
},
111+
{
112+
name: "base-path",
113+
alias: "b",
114+
type: "folder",
115+
title: "Set the given path as the root of the source tree (required solc 0.67.0 or later)",
116+
defaultValue: ".",
117+
},
111118
{
112119
name: "include-path",
113120
alias: "i",
114121
type: "folder",
115-
title: "Additional path(s) for inputs (required solc 0.57.0 or higher), node_modules is default",
122+
title: "Additional path(s) for inputs (required solc 0.57.0 or later), node_modules is default",
116123
defaultValue: "node_modules",
117124
},
118125
],
@@ -121,6 +128,7 @@ export const solidityCompileCommand: Command = {
121128
args: {
122129
file: string
123130
outputDir: string
131+
basePath: string
124132
includePath: string
125133
code: boolean
126134
},
@@ -129,6 +137,7 @@ export const solidityCompileCommand: Command = {
129137
for (const file of args.file.split(" ")) {
130138
const { fileDir, fileName } = resolveSoliditySource(file)
131139
const outputDir = path.resolve(args.outputDir ?? ".")
140+
const basePath = path.resolve(args.basePath ?? ".")
132141
const includePath = args.includePath
133142
? args.includePath
134143
.split(",")
@@ -176,9 +185,11 @@ export const solidityCompileCommand: Command = {
176185
await components.compiler.silentRun(terminal, fileDir, [
177186
"-o",
178187
outputDir,
188+
...(await addBasePathOption(basePath)),
179189
...(await addIncludePathOption(includePath)),
180190
fileName,
181191
])
192+
182193
linkerOut = await components.linker.silentRun(
183194
terminal,
184195
fileDir,
@@ -235,11 +246,18 @@ export const solidityAstCommand: Command = {
235246
title: "Output folder (current is default)",
236247
defaultValue: "",
237248
},
249+
{
250+
name: "base-path",
251+
alias: "b",
252+
type: "folder",
253+
title: "Set the given path as the root of the source tree (required solc 0.67.0 or later)",
254+
defaultValue: ".",
255+
},
238256
{
239257
name: "include-path",
240258
alias: "i",
241259
type: "folder",
242-
title: "Additional path(s) for inputs (required solc 0.57.0 or higher), node_modules is default",
260+
title: "Additional path(s) for inputs (required solc 0.57.0 or later), node_modules is default",
243261
defaultValue: "node_modules",
244262
},
245263
],
@@ -248,6 +266,7 @@ export const solidityAstCommand: Command = {
248266
args: {
249267
file: string
250268
format: string
269+
basePath: string
251270
includePath: string
252271
outputDir?: string
253272
},
@@ -260,6 +279,7 @@ export const solidityAstCommand: Command = {
260279
await Component.ensureInstalledAll(terminal, components)
261280
const { fileDir, fileName } = resolveSoliditySource(file)
262281
args.outputDir = path.resolve(args.outputDir ?? ".")
282+
const basePath = path.resolve(args.basePath ?? ".")
263283
const includePath = args.includePath
264284
? args.includePath
265285
.split(",")
@@ -272,6 +292,7 @@ export const solidityAstCommand: Command = {
272292
`--ast-${args.format}`,
273293
"--output-dir",
274294
args.outputDir,
295+
...(await addBasePathOption(basePath)),
275296
...(await addIncludePathOption(includePath)),
276297
fileName,
277298
])
@@ -364,3 +385,8 @@ async function addIncludePathOption(paths: string[]) {
364385
? ["--include-path", ...paths]
365386
: []
366387
}
388+
async function addBasePathOption(path: string) {
389+
return (await components.compiler.getCurrentVersion()) >= "0.67.0"
390+
? ["--base-path", path]
391+
: []
392+
}

src/controllers/solidity/snippets.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const BasicContract = `
33
* This file was generated by EverDev.
44
* EverDev is a part of EVER OS (see https://everos.dev).
55
*/
6-
pragma ton-solidity >= 0.35.0;
6+
pragma ton-solidity >= 0.67.0;
77
pragma AbiHeader expire;
88
99
// This is class that describes you smart contract.
@@ -16,7 +16,7 @@ contract {name} {
1616
// Contract can have a \`constructor\` – function that will be called when contract will be deployed to the blockchain.
1717
// In this example constructor adds current time to the instance variable.
1818
// All contracts need call tvm.accept(); for succeeded deploy
19-
constructor() public {
19+
constructor() {
2020
// Check that contract's public key is set
2121
require(tvm.pubkey() != 0, 101);
2222
// Check that message has signature (msg.pubkey() is not zero) and
@@ -27,7 +27,7 @@ contract {name} {
2727
// messages, which bring no value (henceno gas) with themselves.
2828
tvm.accept();
2929
30-
timestamp = now;
30+
timestamp = block.timestamp;
3131
}
3232
3333
function renderHelloWorld () public pure returns (string) {
@@ -42,7 +42,7 @@ contract {name} {
4242
// Tells to the TVM that we accept this message.
4343
tvm.accept();
4444
// Update timestamp
45-
timestamp = now;
45+
timestamp = block.timestamp;
4646
}
4747
4848
function sendValue(address dest, uint128 amount, bool bounce) public view {

0 commit comments

Comments
 (0)