Skip to content

Export local-ovm environment from "synthetix" #1356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 30, 2021
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
23 changes: 17 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const data = {
mainnet: require('./publish/deployed/mainnet'),
goerli: require('./publish/deployed/goerli'),
'goerli-ovm': require('./publish/deployed/goerli-ovm'),
'local-ovm': require('./publish/deployed/local-ovm'),
'kovan-ovm': require('./publish/deployed/kovan-ovm'),
'mainnet-ovm': require('./publish/deployed/mainnet-ovm'),
};
Expand Down Expand Up @@ -38,6 +39,10 @@ const chainIdMapping = Object.entries({
42: {
network: 'kovan',
},
420: {
network: 'local',
useOvm: true,
},

// Hardhat fork of mainnet: https://hardhat.org/config/#hardhat-network
31337: {
Expand Down Expand Up @@ -226,7 +231,7 @@ const getPathToNetwork = ({ network = 'mainnet', file = '', useOvm = false, path

// Pass in fs and path to avoid webpack wrapping those
const loadDeploymentFile = ({ network, path, fs, deploymentPath, useOvm = false }) => {
if (!deploymentPath && network !== 'local' && (!path || !fs)) {
if (!deploymentPath && (!path || !fs)) {
return data[getFolderNameForNetwork({ network, useOvm })].deployment;
}
const pathToDeployment = deploymentPath
Expand Down Expand Up @@ -325,7 +330,7 @@ const getAST = ({ source, path, fs, match = /^contracts\// } = {}) => {
const getFeeds = ({ network, path, fs, deploymentPath, useOvm = false } = {}) => {
let feeds;

if (!deploymentPath && network !== 'local' && (!path || !fs)) {
if (!deploymentPath && (!path || !fs)) {
feeds = data[getFolderNameForNetwork({ network, useOvm })].feeds;
} else {
const pathToFeeds = deploymentPath
Expand Down Expand Up @@ -372,7 +377,7 @@ const getSynths = ({
} = {}) => {
let synths;

if (!deploymentPath && network !== 'local' && (!path || !fs)) {
if (!deploymentPath && (!path || !fs)) {
synths = data[getFolderNameForNetwork({ network, useOvm })].synths;
} else {
const pathToSynthList = deploymentPath
Expand Down Expand Up @@ -435,7 +440,7 @@ const getStakingRewards = ({
fs,
deploymentPath,
} = {}) => {
if (!deploymentPath && network !== 'local' && (!path || !fs)) {
if (!deploymentPath && (!path || !fs)) {
return data[getFolderNameForNetwork({ network, useOvm })].rewards;
}

Expand Down Expand Up @@ -463,7 +468,7 @@ const getShortingRewards = ({
fs,
deploymentPath,
} = {}) => {
if (!deploymentPath && network !== 'local' && (!path || !fs)) {
if (!deploymentPath && (!path || !fs)) {
return data[getFolderNameForNetwork({ network, useOvm })]['shorting-rewards'];
}

Expand Down Expand Up @@ -515,6 +520,12 @@ const getUsers = ({ network = 'mainnet', user, useOvm = false } = {}) => {
// Deterministic account #0 when using `npx hardhat node`
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
}),
'local-ovm': Object.assign({}, base, {
// Deterministic account #0 when using `npx hardhat node`
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
deployer: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
oracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
}),
};

const users = Object.entries(
Expand All @@ -534,7 +545,7 @@ const getVersions = ({
} = {}) => {
let versions;

if (!deploymentPath && network !== 'local' && (!path || !fs)) {
if (!deploymentPath && (!path || !fs)) {
versions = data[getFolderNameForNetwork({ network, useOvm })].versions;
} else {
const pathToVersions = deploymentPath
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"publish/deployed/mainnet/*",
"publish/deployed/mainnet-ovm/*",
"publish/deployed/goerli/*",
"publish/deployed/goerli-ovm/*"
"publish/deployed/goerli-ovm/*",
"publish/deployed/local-ovm/*"
],
"bin": {
"snx": "bin.js"
Expand Down
3 changes: 3 additions & 0 deletions publish/deployed/local-ovm/deployment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"targets": {}
}
6 changes: 6 additions & 0 deletions publish/deployed/local-ovm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
deployment: require('./deployment.json'),
synths: require('./synths.json'),
rewards: require('./rewards.json'),
feeds: require('./feeds.json'),
};