Skip to content

Commit

Permalink
Merge pull request #42 from rsksmart/development
Browse files Browse the repository at this point in the history
Merge development into master
  • Loading branch information
ezequiel-rodriguez authored Mar 27, 2024
2 parents 13f8bf3 + 8b8feee commit 506ca34
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 16 deletions.
10 changes: 9 additions & 1 deletion dist/lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ function Compiler({ solcCache } = {}) {



const { optimizer } = settings;
const { optimizer, metadata } = settings;

if (optimizer) {
let { runs } = optimizer;
runs = runs ? parseInt(runs) : 200;
settings.optimizer.runs = runs;
}

if (metadata) {
settings.metadata.useLiteralContent = true;
} else {
settings.metadata = { useLiteralContent: true };
}

return {
language: 'Solidity',
sources,
Expand Down
2 changes: 1 addition & 1 deletion dist/lib/defaultConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
port: 3008,
solcCache: '/tmp/solc',
log: {},
timeout: 60000 };exports.default = _default;
timeout: 600000 };exports.default = _default;
14 changes: 8 additions & 6 deletions dist/lib/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function Verifier(options = {}) {

if (!compiled) {
for (const path of Object.keys(contracts)) {
const file = path.split('/').pop();
if (file.split('.')[0] === KEY) {
const contractName = path.split('/').pop().split('.')[0];
if (contractName === KEY) {
compiled = contracts[path][KEY];
}
}
Expand All @@ -59,18 +59,20 @@ function Verifier(options = {}) {
const { sources } = JSON.parse(compiled.metadata);

for (const [path, { content }] of Object.entries(sources)) {
const name = path.split('/').pop().split();
const name = path.split('/').pop().split('.')[0];
const sourceObj = { path, file: path.split('/').pop() };

if (name === KEY) {
sourceObj.contents = content;
usedSources.unshift(sourceObj);
} else {
sourceObj.hash = (0, _utils.getHash)(content);
usedSources.push(sourceObj);
}

usedSources.push(sourceObj);
}
} catch (e) {}
} catch (err) {
return Promise.reject(err);
}
}

const { evm, abi } = compiled;
Expand Down
10 changes: 9 additions & 1 deletion src/lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ export function Compiler ({ solcCache } = {}) {
]
}
}
const { optimizer } = settings
const { optimizer, metadata } = settings

if (optimizer) {
let { runs } = optimizer
runs = (runs) ? parseInt(runs) : 200
settings.optimizer.runs = runs
}

if (metadata) {
settings.metadata.useLiteralContent = true
} else {
settings.metadata = { useLiteralContent: true }
}

return {
language: 'Solidity',
sources,
Expand Down
1 change: 0 additions & 1 deletion src/lib/defaultConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ export default {
log: {},
timeout: 600000
}

14 changes: 8 additions & 6 deletions src/lib/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export function Verifier (options = {}) {

if (!compiled) {
for (const path of Object.keys(contracts)) {
const file = path.split('/').pop()
if (file.split('.')[0] === KEY) {
const contractName = path.split('/').pop().split('.')[0]
if (contractName === KEY) {
compiled = contracts[path][KEY]
}
}
Expand All @@ -59,18 +59,20 @@ export function Verifier (options = {}) {
const { sources } = JSON.parse(compiled.metadata)

for (const [path, { content }] of Object.entries(sources)) {
const name = path.split('/').pop().split()
const name = path.split('/').pop().split('.')[0]
const sourceObj = { path, file: path.split('/').pop() }

if (name === KEY) {
sourceObj.contents = content
usedSources.unshift(sourceObj)
} else {
sourceObj.hash = getHash(content)
usedSources.push(sourceObj)
}

usedSources.push(sourceObj)
}
} catch (e) {}
} catch (err) {
return Promise.reject(err)
}
}

const { evm, abi } = compiled
Expand Down

0 comments on commit 506ca34

Please sign in to comment.