-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from gnosis/add_cronos
Closes #25: Add cronos network
- Loading branch information
Showing
7 changed files
with
95 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
MNEMONIC="" | ||
MNEMONIC="" | ||
RPC="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"gasPrice": 10000000000000, | ||
"gasLimit": 100000, | ||
"signerAddress": "0xE1CB04A0fA36DdD16a06ea828007E35e1a3cBC37", | ||
"transaction": "0xf8a6808609184e72a000830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf355a054b6bc11ebcdd492b5083f82e745b27cf9aabd3afedc969a1fe863219c1094a9a00cd431f6d8e76c58b4ae488c96f95df8c57850088dd362a268cf051b226de259", | ||
"address": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"gasPrice": 10000000000000, | ||
"gasLimit": 100000, | ||
"signerAddress": "0xE1CB04A0fA36DdD16a06ea828007E35e1a3cBC37", | ||
"transaction": "0xf8a8808609184e72a000830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf38202c8a0749cead18bfc5151c8414fab334577f8c56120de5cda871c2237c855962184b3a042f0b6ed04459c15e37381167292f965a93f63e399f99b3c4f0f504b5b934dbb", | ||
"address": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { promises as filesystem } from 'fs' | ||
import * as path from 'path' | ||
import { CompilerOutput, CompilerInput, compileStandardWrapper, CompilerOutputContract } from 'solc' | ||
import { ethers } from 'ethers' | ||
import dotenv from "dotenv"; | ||
import yargs from 'yargs/yargs'; | ||
import { compileContracts } from './utils'; | ||
|
||
dotenv.config() | ||
|
||
async function doStuff() { | ||
const rpcUrl = process.env.RPC | ||
const provider = new ethers.providers.JsonRpcProvider(rpcUrl) | ||
const chainId = (await provider.getNetwork()).chainId | ||
console.log({chainId}) | ||
const compilerOutput = await compileContracts() | ||
const contract = compilerOutput.contracts['deterministic-deployment-proxy.yul']['Proxy'] | ||
const data = "0x" + contract.evm.bytecode.object | ||
const estimate = await provider.estimateGas({ data }) | ||
console.log({estimate: estimate.toString() }) | ||
const gasPrice = await provider.getGasPrice() | ||
console.log({gasPriceGwei: ethers.utils.formatUnits(gasPrice, "gwei"), gasPrice: gasPrice.toString() }) | ||
} | ||
|
||
doStuff().then(() => { | ||
process.exit(0) | ||
}).catch(error => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { promises as filesystem } from 'fs' | ||
import * as path from 'path' | ||
import { CompilerOutput, CompilerInput, compileStandardWrapper } from 'solc' | ||
|
||
export async function compileContracts(): Promise<CompilerOutput> { | ||
const solidityFilePath = path.join(__dirname, '..', 'source', 'deterministic-deployment-proxy.yul') | ||
const soliditySourceCode = await filesystem.readFile(solidityFilePath, 'utf8') | ||
const compilerInput: CompilerInput = { | ||
language: "Yul", | ||
settings: { | ||
optimizer: { | ||
enabled: true, | ||
details: { | ||
yul: true, | ||
}, | ||
}, | ||
outputSelection: { | ||
"*": { | ||
"*": [ "abi", "evm.bytecode.object", "evm.gasEstimates" ] | ||
}, | ||
}, | ||
}, | ||
sources: { | ||
'deterministic-deployment-proxy.yul': { | ||
content: soliditySourceCode, | ||
}, | ||
}, | ||
} | ||
const compilerInputJson = JSON.stringify(compilerInput) | ||
const compilerOutputJson = compileStandardWrapper(compilerInputJson) | ||
const compilerOutput = JSON.parse(compilerOutputJson) as CompilerOutput | ||
const errors = compilerOutput.errors | ||
if (errors) { | ||
let concatenatedErrors = ""; | ||
|
||
for (let error of errors) { | ||
if (/Yul is still experimental/.test(error.message)) continue | ||
concatenatedErrors += error.formattedMessage + "\n"; | ||
} | ||
|
||
if (concatenatedErrors.length > 0) { | ||
throw new Error("The following errors/warnings were returned by solc:\n\n" + concatenatedErrors); | ||
} | ||
} | ||
|
||
return compilerOutput | ||
} |