Skip to content

Commit

Permalink
Merge pull request #180 from tonlabs/1.6.1-rc
Browse files Browse the repository at this point in the history
Version 1.6.1
  • Loading branch information
Artem-Zhdanov authored Mar 29, 2023
2 parents cab5e63 + fff41ac commit 884f2f8
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 14 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

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

## [1.6.1] - 2023-03-28

### New

- Added new option `--base-path <path>` for `solidity compile` command (required solc 0.67.0 or later).

Use the given path as the root of the source tree instead of the root of the filesystem.

### Updated

- As of solc 0.67.0, the use of the "now" keyword is deprecated. The "block.timestamp" keyword should be used instead.
- The `contracts/HelloWallet.sol` contract has been updated to require solc 0.67.0 or later to compile.
- The sample contract created with `everdev sol create` now requires solc 0.67.0 or later to compile.

## [1.6.0] - 2023-02-13

### New
Expand Down
8 changes: 4 additions & 4 deletions contracts/HelloWallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* This file was generated by EverDev.
* EverDev is a part of TON OS (see http://ton.dev).
*/
pragma ton-solidity >= 0.35.0;
pragma ton-solidity >= 0.67.0;
pragma AbiHeader expire;

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

timestamp = now;
timestamp = block.timestamp;
}

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

// Function returns value of state variable `timestamp`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "everdev",
"version": "1.6.0",
"version": "1.6.1",
"description": "Everscale Dev Environment",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion src/__tests__/checkArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from "fs"
import path from "path"

import { doneTests, initTests, deleteFolderRecursive } from "./init"
import { StringTerminal, runCommand } from ".."
import { StringTerminal, consoleTerminal, runCommand } from ".."

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

Expand All @@ -12,6 +12,8 @@ beforeEach(() => deleteFolderRecursive(outPath))
afterEach(() => deleteFolderRecursive(outPath))

test("Should create HelloWallet.tvc in user defined output directory", async () => {
await runCommand(consoleTerminal, "sol update", {})

const solPath = path.resolve(
__dirname,
"..",
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ test("everdev sol compile a.sol", async () => {
expect(args).toEqual({
code: false,
file: "a.sol",
basePath: ".",
includePath: "node_modules",
outputDir: "",
})
Expand All @@ -73,6 +74,7 @@ test("everdev sol compile a.sol b.sol --output-dir somedir", async () => {
expect(args).toEqual({
code: false,
file: "a.sol b.sol",
basePath: ".",
includePath: "node_modules",
outputDir: "somedir",
})
Expand Down
12 changes: 11 additions & 1 deletion src/__tests__/sol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@ test("AST of all source files in a JSON", async () => {
"contracts",
"HelloWallet.sol",
)
const astPath = path.resolve(__dirname, "..", "..", "HelloWallet.ast.json")
const astPath = path.resolve(
__dirname,
"..",
"..",
"HelloWallet.sol_json.ast",
)
// Remove output file if exists
try {
fs.unlinkSync(astPath)
} catch (_) {}

await runCommand(terminal, "sol ast --format json", {
file: solPath,
})
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/wrap.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import path from "path"

import { doneTests, initTests, deleteFiles } from "./init"
import { StringTerminal, runCommand } from ".."
import { consoleTerminal, StringTerminal, runCommand } from ".."

beforeAll(initTests)
afterAll(doneTests)

test("Shoud create HelloWallet.abi.json file", async () => {
await runCommand(consoleTerminal, "sol update", {})
const solPath = path.resolve(
__dirname,
"..",
Expand Down
30 changes: 28 additions & 2 deletions src/controllers/solidity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,18 @@ export const solidityCompileCommand: Command = {
title: "Output folder (current is default)",
defaultValue: "",
},
{
name: "base-path",
alias: "b",
type: "folder",
title: "Set the given path as the root of the source tree (required solc 0.67.0 or later)",
defaultValue: ".",
},
{
name: "include-path",
alias: "i",
type: "folder",
title: "Additional path(s) for inputs (required solc 0.57.0 or higher), node_modules is default",
title: "Additional path(s) for inputs (required solc 0.57.0 or later), node_modules is default",
defaultValue: "node_modules",
},
],
Expand All @@ -121,6 +128,7 @@ export const solidityCompileCommand: Command = {
args: {
file: string
outputDir: string
basePath: string
includePath: string
code: boolean
},
Expand All @@ -129,6 +137,7 @@ export const solidityCompileCommand: Command = {
for (const file of args.file.split(" ")) {
const { fileDir, fileName } = resolveSoliditySource(file)
const outputDir = path.resolve(args.outputDir ?? ".")
const basePath = path.resolve(args.basePath ?? ".")
const includePath = args.includePath
? args.includePath
.split(",")
Expand Down Expand Up @@ -176,9 +185,11 @@ export const solidityCompileCommand: Command = {
await components.compiler.silentRun(terminal, fileDir, [
"-o",
outputDir,
...(await addBasePathOption(basePath)),
...(await addIncludePathOption(includePath)),
fileName,
])

linkerOut = await components.linker.silentRun(
terminal,
fileDir,
Expand Down Expand Up @@ -235,11 +246,18 @@ export const solidityAstCommand: Command = {
title: "Output folder (current is default)",
defaultValue: "",
},
{
name: "base-path",
alias: "b",
type: "folder",
title: "Set the given path as the root of the source tree (required solc 0.67.0 or later)",
defaultValue: ".",
},
{
name: "include-path",
alias: "i",
type: "folder",
title: "Additional path(s) for inputs (required solc 0.57.0 or higher), node_modules is default",
title: "Additional path(s) for inputs (required solc 0.57.0 or later), node_modules is default",
defaultValue: "node_modules",
},
],
Expand All @@ -248,6 +266,7 @@ export const solidityAstCommand: Command = {
args: {
file: string
format: string
basePath: string
includePath: string
outputDir?: string
},
Expand All @@ -260,6 +279,7 @@ export const solidityAstCommand: Command = {
await Component.ensureInstalledAll(terminal, components)
const { fileDir, fileName } = resolveSoliditySource(file)
args.outputDir = path.resolve(args.outputDir ?? ".")
const basePath = path.resolve(args.basePath ?? ".")
const includePath = args.includePath
? args.includePath
.split(",")
Expand All @@ -272,6 +292,7 @@ export const solidityAstCommand: Command = {
`--ast-${args.format}`,
"--output-dir",
args.outputDir,
...(await addBasePathOption(basePath)),
...(await addIncludePathOption(includePath)),
fileName,
])
Expand Down Expand Up @@ -364,3 +385,8 @@ async function addIncludePathOption(paths: string[]) {
? ["--include-path", ...paths]
: []
}
async function addBasePathOption(path: string) {
return (await components.compiler.getCurrentVersion()) >= "0.67.0"
? ["--base-path", path]
: []
}
8 changes: 4 additions & 4 deletions src/controllers/solidity/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const BasicContract = `
* This file was generated by EverDev.
* EverDev is a part of EVER OS (see https://everos.dev).
*/
pragma ton-solidity >= 0.35.0;
pragma ton-solidity >= 0.67.0;
pragma AbiHeader expire;
// This is class that describes you smart contract.
Expand All @@ -16,7 +16,7 @@ contract {name} {
// Contract can have a \`constructor\` – function that will be called when contract will be deployed to the blockchain.
// In this example constructor adds current time to the instance variable.
// All contracts need call tvm.accept(); for succeeded deploy
constructor() public {
constructor() {
// Check that contract's public key is set
require(tvm.pubkey() != 0, 101);
// Check that message has signature (msg.pubkey() is not zero) and
Expand All @@ -27,7 +27,7 @@ contract {name} {
// messages, which bring no value (henceno gas) with themselves.
tvm.accept();
timestamp = now;
timestamp = block.timestamp;
}
function renderHelloWorld () public pure returns (string) {
Expand All @@ -42,7 +42,7 @@ contract {name} {
// Tells to the TVM that we accept this message.
tvm.accept();
// Update timestamp
timestamp = now;
timestamp = block.timestamp;
}
function sendValue(address dest, uint128 amount, bool bounce) public view {
Expand Down

0 comments on commit 884f2f8

Please sign in to comment.