Open abcoathup opened 4 years ago
We have been able to reproduce this issue by following these steps:
$ mkdir issue1529 && cd issue1529
$ npm init -y
$ npm i @openzeppelin/cli
node v10.19.0 npm 6.14.4 oz --version 2.8.2 Windows Subsystem for Linux 2
$ touch tsconfig.json
$ npx oz init
? Welcome to the OpenZeppelin SDK! Choose a name for your project issue1529
? Initial project version 1.0.0
? Enable typechain support? Yes
? Typechain compilation target truffle-contract compatible
? Typechain output directory ./types/contracts/
Project initialized. Write a new contract in the contracts folder and run 'openzeppelin deploy' to deploy it.
Create a contract
// contracts/Box.sol
// https://docs.openzeppelin.com/learn/developing-smart-contracts#setting-up-a-solidity-project
pragma solidity ^0.5.0;
contract Box {
uint256 private value;
// Emitted when the stored value changes
event ValueChanged(uint256 newValue);
// Stores a new value in the contract
function store(uint256 newValue) public {
value = newValue;
emit ValueChanged(newValue);
}
// Reads the last stored value
function retrieve() public view returns (uint256) {
return value;
}
}
$ npx oz compile
✓ Compiled contracts with solc 0.5.17 (commit.d19bba13)
PATH build/contracts/Box.json
✓ Typechain artifacts generated with truffle
/* Generated by ts-generator ver. 0.0.8 */
/* tslint:disable */
/// <reference types="truffle-typings" />
import { BigNumber } from "bignumber.js";
export interface BoxContract extends Truffle.Contract<BoxInstance> {
"new"(meta?: Truffle.TransactionDetails): Promise<BoxInstance>;
}
export interface BoxInstance extends Truffle.ContractInstance {
retrieve(txDetails?: Truffle.TransactionDetails): Promise<BigNumber>;
store: {
(
newValue: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<Truffle.TransactionResponse>;
call(
newValue: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<void>;
sendTransaction(
newValue: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<string>;
estimateGas(
newValue: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<number>;
};
}
/* Generated by ts-generator ver. 0.0.8 */
/* tslint:disable */
/// <reference types="truffle-typings" />
import * as TruffleContracts from ".";
declare global {
namespace Truffle {
interface Artifacts {
require(name: "Box"): TruffleContracts.BoxContract;
}
}
}
$ npx oz compile
Nothing to compile, all contracts are up to date.
PATH build/contracts/{}.json
✓ Typechain artifacts generated with truffle
/* Generated by ts-generator ver. 0.0.8 */
/* tslint:disable */
/// <reference types="truffle-typings" />
import { BigNumber } from "bignumber.js";
/* Generated by ts-generator ver. 0.0.8 */
/* tslint:disable */
/// <reference types="truffle-typings" />
import * as TruffleContracts from ".";
declare global {
namespace Truffle {
interface Artifacts {}
}
}
$ npx oz compile --verbose
[2020-04-24T01:26:01.387Z@SolidityProjectCompiler.js#call] <started> Nothing to compile, all contracts are up to date.
[2020-04-24T01:26:01.388Z@Compiler.js#compile] <started> Generating typechain artifacts...
PATH build/contracts/{}.json
[2020-04-24T01:26:01.615Z@Compiler.js#compile] <succeeded> Typechain artifacts generated with truffle
[2020-04-24T01:26:01.617Z@ProjectFile.js#write] <started> Updated /home/abcoathup/projects/forum/issue1529/.openzeppelin/project.json
The project owner will review and triage this issue during the next week. In the meantime, you can try the following workaround:
Remove the build
directory and recompile to generate artifacts
$ rm -rf build
$ npx oz compile
Reported in Telegram by Anatol