Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ jobs:
at: .
- restore_cache:
keys:
- v3-optimism-build-
- v4-optimism-build-
- run:
name: Build docker containers if necessary
command: |
if [ ! -d ./optimism ]; then
npx hardhat ops --fresh --build --build-ops
fi;
- save_cache:
key: v3-optimism-build-
key: v4-optimism-build-
paths:
- ./optimism
- run:
Expand Down
4 changes: 2 additions & 2 deletions .circleci/src/jobs/job-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ steps:
at: .
- restore_cache:
keys:
- v3-optimism-build-{{ checksum "package-lock.json" }}
- v4-optimism-build-{{ checksum "package-lock.json" }}
- run:
name: Build docker containers if necessary
command: |
if [ ! -d ./optimism ]; then
npx hardhat ops --fresh --build --build-ops
fi;
- save_cache:
key: v3-optimism-build-{{ checksum "package-lock.json" }}
key: v4-optimism-build-{{ checksum "package-lock.json" }}
paths:
- ./optimism
- run:
Expand Down
9 changes: 6 additions & 3 deletions hardhat/tasks/task-interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ task('interact', 'Interact with a deployed Synthetix instance from the command l
.addOptionalParam('providerUrl', 'The http provider to use for communicating with the blockchain')
.addOptionalParam('deploymentPath', 'Specify the path to the deployment data directory')
.setAction(async (taskArguments, hre) => {
const { useOvm, useFork, gasLimit, deploymentPath, targetNetwork } = taskArguments;
let { providerUrl, gasPrice, privateKey } = taskArguments;

const { useOvm, useFork, deploymentPath, targetNetwork } = taskArguments;
let { providerUrl, gasLimit, gasPrice, privateKey } = taskArguments;
// ------------------
// Default values per network
// ------------------
Expand All @@ -31,6 +30,10 @@ task('interact', 'Interact with a deployed Synthetix instance from the command l
const defaults = DEFAULTS[key];
providerUrl = providerUrl || defaults.providerUrl;
gasPrice = gasPrice || defaults.gasPrice;
if (useOvm) {
gasPrice = synthetix.constants.OVM_GAS_PRICE_GWEI;
gasLimit = undefined;
}

// ------------------
// Setup
Expand Down
2 changes: 1 addition & 1 deletion hardhat/tasks/task-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ task('ops', 'Run Optimism chain')
.addOptionalParam(
'optimismCommit',
'Commit to checkout',
'd9fd67d2502a590e116ffdb6c1c53003a045e318'
'dc4bd5381e4c75516e251cc1d1d81bcf1e4d2d7d'
)
.setAction(async (taskArguments, hre, runSuper) => {
taskArguments.maxMemory = true;
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const constants = {
ZERO_ADDRESS: '0x' + '0'.repeat(40),
ZERO_BYTES32: '0x' + '0'.repeat(64),

OVM_GAS_PRICE_GWEI: '0.0',
OVM_GAS_PRICE_GWEI: '0.015',

inflationStartTimestampInSecs: 1551830400, // 2019-03-06T00:00:00Z
};
Expand Down
13 changes: 10 additions & 3 deletions publish/src/Deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,21 @@ class Deployer {
}

async sendDummyTx() {
await this.provider.web3.eth.sendTransaction({
const tx = {
from: this.account,
to: '0x0000000000000000000000000000000000000001',
data: '0x0000000000000000000000000000000000000000000000000000000000000000',
value: 0,
gas: 1000000,
gasPrice: ethers.utils.parseUnits(this.gasPrice.toString(), 'gwei'),
});
};

if (this.useOvm) {
tx.gas = await this.provider.web3.eth.estimateGas(tx);
} else {
tx.gas = 1000000;
}

await this.provider.web3.eth.sendTransaction(tx);

if (this.nonceManager) {
this.nonceManager.incrementNonce();
Expand Down
4 changes: 2 additions & 2 deletions publish/src/commands/deploy/import-addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { toBytes32 } = require('../../../..');

const { reportDeployedContracts } = require('../../util');

module.exports = async ({ addressOf, deployer, dryRun, limitPromise, runStep, useFork }) => {
module.exports = async ({ addressOf, deployer, dryRun, limitPromise, runStep, useOvm }) => {
console.log(gray(`\n------ CONFIGURE ADDRESS RESOLVER ------\n`));

const { AddressResolver, ReadProxyAddressResolver } = deployer.deployedContracts;
Expand Down Expand Up @@ -55,7 +55,7 @@ module.exports = async ({ addressOf, deployer, dryRun, limitPromise, runStep, us
);

const { pending } = await runStep({
gasLimit: 6e6, // higher gas required
gasLimit: 6e6, // higher gas required for mainnet
contract: `AddressResolver`,
target: AddressResolver,
read: 'areAddressesImported',
Expand Down
5 changes: 3 additions & 2 deletions publish/src/commands/deploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ const deploy = async ({

const runStep = async opts => {
const { noop, ...rest } = await performTransactionalStepWeb3({
gasLimit: methodCallGasLimit, // allow overriding of gasLimit
...opts,
// no gas limit on OVM (use system limit), otherwise use provided limit or the methodCall amount
gasLimit: useOvm ? undefined : opts.gasLimit || methodCallGasLimit,
account,
dryRun,
explorerLinkPrefix,
Expand Down Expand Up @@ -332,7 +333,7 @@ const deploy = async ({
dryRun,
limitPromise,
runStep,
useFork,
useOvm,
});

await rebuildResolverCaches({
Expand Down
4 changes: 2 additions & 2 deletions publish/src/commands/deploy/rebuild-resolver-caches.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ module.exports = async ({
for (let i = 0; i < contractsToRebuildCache.length; i += addressesChunkSize) {
const chunk = contractsToRebuildCache.slice(i, i + addressesChunkSize);
await runStep({
gasLimit: useOvm ? undefined : 7e6,
gasLimit: 7e6,
contract: `AddressResolver`,
target: AddressResolver,
publiclyCallable: true, // does not require owner
Expand Down Expand Up @@ -309,7 +309,7 @@ module.exports = async ({
for (let i = 0; i < binaryOptionMarketsToRebuildCacheOn.length; i += addressesChunkSize) {
const chunk = binaryOptionMarketsToRebuildCacheOn.slice(i, i + addressesChunkSize);
await runStep({
gasLimit: useOvm ? undefined : 7e6,
gasLimit: 7e6,
contract: `BinaryOptionMarketManager`,
target: BinaryOptionMarketManager,
publiclyCallable: true, // does not require owner
Expand Down
24 changes: 16 additions & 8 deletions publish/src/commands/owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const owner = async ({
network,
newOwner,
deploymentPath,
gasPrice = DEFAULTS.gasPrice,
gasLimit = DEFAULTS.gasLimit,
gasPrice,
gasLimit,
privateKey,
yes,
useOvm,
Expand Down Expand Up @@ -223,12 +223,16 @@ const owner = async ({
// track lastNonce submitted
lastNonce = newNonce;
} else {
const tx = await wallet.sendTransaction({
const params = {
to: target,
gasPrice: ethers.utils.parseUnits(gasPrice, 'gwei'),
gasLimit: ethers.BigNumber.from(gasLimit),
data,
});
};
if (gasLimit) {
params.gasLimit = ethers.BigNumber.from(gasLimit);
}

const tx = await wallet.sendTransaction(params);
const receipt = await tx.wait();

logTx(receipt);
Expand Down Expand Up @@ -313,12 +317,16 @@ const owner = async ({
// track lastNonce submitted
lastNonce = newNonce;
} else {
const tx = await wallet.sendTransaction({
const params = {
to: deployedContract.address,
gasPrice: ethers.utils.parseUnits(gasPrice, 'gwei'),
gasLimit: ethers.BigNumber.from(gasLimit),
data: encodedData,
});
};
if (gasLimit) {
params.gasLimit = ethers.BigNumber.from(gasLimit);
}

const tx = await wallet.sendTransaction(params);
const receipt = await tx.wait();

logTx(receipt);
Expand Down