Skip to content

Instantly share code, notes, and snippets.

@cassc
Created September 26, 2023 02:36
Show Gist options
  • Save cassc/721cc756a647d92169c27e4415a58f2d to your computer and use it in GitHub Desktop.
Save cassc/721cc756a647d92169c27e4415a58f2d to your computer and use it in GitHub Desktop.
Comilation standard json input with remapping
{
"sources": {
"Filename.sol": {
"content": "import \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\npragma solidity >=0.7 <0.9.0;\n\n/**\n * @title Storage\n * @dev Store & retrieve value in a variable\n * @custom:dev-run-script ./scripts/deploy_with_ethers.ts\n */\ncontract Storage {\n\n uint256 number;\n\n /**\n * @dev Store value in variable\n * @param num value to store\n */\n function store(uint256 num) public {\n number = num;\n }\n\n /**\n * @dev Return value \n * @return value of 'number'\n */\n function retrieve() public view returns (uint256){\n return number;\n }\n}"
}
},
"language": "Solidity",
"settings": {
"remappings": ["@openzeppelin=node_modules/@openzeppelin/", "@asldfas=none-exists"]
}
}
@cassc
Copy link
Author

cassc commented Sep 26, 2023

Aussming the openzepplin package is installed from the following package.json

{
  "name": "dummy",
  "version": "1.0.0",
  "dependencies": {
    "@chainlink/contracts": "^0.7",
    "@openzeppelin/contracts": "^4.7.3"}
}

@cassc
Copy link
Author

cassc commented Sep 26, 2023

To compile:

npm i
solc  --standard-json standard-input.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment