Skip to content

Commit

Permalink
Merge pull request #838 from oceanprotocol/feature/optimism_deployment
Browse files Browse the repository at this point in the history
deploy Optimism
  • Loading branch information
alexcos20 authored Nov 14, 2023
2 parents 1c03bef + 2ef49c4 commit b8377a1
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 46 deletions.
34 changes: 34 additions & 0 deletions addresses/address.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,39 @@
"DFRewards": "0xc37F8341Ac6e4a94538302bCd4d49Cf0852D30C0",
"DFStrategyV1": "0x3c21a90599b5B7f37014cA5Bf30d3f1b73d7e391",
"PredictoorHelper": "0xE9397625Df9B63f0C152f975234b7988b54710B8"
},
"optimism_sepolia": {
"chainId": 11155420,
"Ocean": "0xf26c6C93f9f1d725e149d95f8E7B2334a406aD10",
"OPFCommunityFeeCollector": "0xF6410bf5d773C7a41ebFf972f38e7463FA242477",
"startBlock": 3867703,
"Router": "0x1B083D8584dd3e6Ff37d04a6e7e82b5F622f3985",
"FixedPrice": "0x69B6E54Ad2b3c2801d11d8Ad56ea1d892555b776",
"ERC20Template": {
"1": "0x2112Eb973af1DBf83a4f11eda82f7a7527D7Fde5",
"2": "0x80E63f73cAc60c1662f27D2DFd2EA834acddBaa8"
},
"ERC721Template": {
"1": "0x3C5605202eD47C162450AE975415473e73F93072"
},
"Dispenser": "0x30E4CC2C7A9c6aA2b2Ce93586E3Df24a3A00bcDD",
"ERC721Factory": "0xDEfD0018969cd2d4E648209F876ADe184815f038"
},
"optimism": {
"chainId": 10,
"Ocean": "0x2561aa2bB1d2Eb6629EDd7b0938d7679B8b49f9E",
"OPFCommunityFeeCollector": "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8",
"startBlock": 112181681,
"Router": "0xf26c6C93f9f1d725e149d95f8E7B2334a406aD10",
"FixedPrice": "0xDBDa486d8fE29F75e9Ca858F438b380Fc14b1232",
"ERC20Template": {
"1": "0xF6410bf5d773C7a41ebFf972f38e7463FA242477",
"2": "0x1B083D8584dd3e6Ff37d04a6e7e82b5F622f3985"
},
"ERC721Template": {
"1": "0x69B6E54Ad2b3c2801d11d8Ad56ea1d892555b776"
},
"Dispenser": "0x2112Eb973af1DBf83a4f11eda82f7a7527D7Fde5",
"ERC721Factory": "0x80E63f73cAc60c1662f27D2DFd2EA834acddBaa8"
}
}
32 changes: 31 additions & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,26 @@ module.exports = {
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
optimism_sepolia: {
url:
process.env.NETWORK_RPC_URL !== undefined ? process.env.NETWORK_RPC_URL : "",
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
optimism: {
url:
process.env.NETWORK_RPC_URL !== undefined ? process.env.NETWORK_RPC_URL : "",
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},

},
etherscan: {
apiKey: {
oasis_saphire_testnet: process.env.ETHERSCAN_API_KEY,
oasis_saphire: process.env.ETHERSCAN_API_KEY
oasis_saphire: process.env.ETHERSCAN_API_KEY,
optimism_sepolia: process.env.ETHERSCAN_API_KEY,
optimism: process.env.ETHERSCAN_API_KEY
},
customChains: [
{
Expand Down Expand Up @@ -189,6 +203,22 @@ module.exports = {
apiURL: "https://testnet.explorer.sapphire.oasis.dev/api",
browserURL: "https://testnet.explorer.sapphire.oasis.dev/",
},
},
{
network: "optimism_sepolia",
chainId: 11155420,
urls: {
apiURL: "https://api-sepolia-optimistic.etherscan.io/api",
browserURL: "https://sepolia-optimism.etherscan.io/",
},
},
{
network: "optimism",
chainId: 10,
urls: {
apiURL: "https://api-optimistic.etherscan.io/api",
browserURL: "https://optimism.etherscan.io/",
},
}
]
},
Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
"dependencies": {
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@nomiclabs/hardhat-vyper": "^3.0.3",
"@nomiclabs/hardhat-vyper": "^3.0.5",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"@openzeppelin/contracts": "^4.8.3",
"dotenv": "^16.3.1",
"eth-permit": "^0.2.3",
"ethereum-waffle": "^4.0.10",
"ethereumjs-util": "^7.1.5",
"ethers": "^5.7.2",
"hardhat": "^2.18.0",
"hardhat": "^2.18.3",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-gas-reporter": "^1.0.8",
"solidity-bytes-utils": "^0.8.0",
Expand Down
86 changes: 58 additions & 28 deletions scripts/deploy-contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let shouldDeployMocks = false;
let shouldDeployOPFCommunityFeeCollector = false;
let shouldDeployOPFCommunity = true;
let shouldDeployPredictoorHelper = false;
let shouldDeployPredictoor = false
const logging = true;
const show_verify = true;

Expand Down Expand Up @@ -117,6 +118,19 @@ async function main() {
shouldDeployOPFCommunityFeeCollector = false;
shouldDeployVesting = true;
break;
case 10:
networkName = "optimism";
OPFOwner = '0xC7EC1970B09224B317c52d92f37F5e1E4fF6B687'
OceanTokenAddress = "0x2561aa2bB1d2Eb6629EDd7b0938d7679B8b49f9E";
routerOwner = OPFOwner;
sleepAmount = 30
shouldDeployOceanToken = false;
shouldDeployV4 = true;
shouldDeployDF = false;
shouldDeployVE = false;
gasPrice = ethers.utils.parseUnits('0.013', 'gwei')
gasLimit = 28000000
break;
case 0x89:
networkName = "polygon";
productionNetwork = true;
Expand Down Expand Up @@ -225,6 +239,7 @@ async function main() {
gasPrice = ethers.utils.parseUnits('100', 'gwei')
gasLimit = 15000000
shouldDeployPredictoorHelper = true;
shouldDeployPredictoor = true;
pdrTrueValSubmiter = "0x886A892670A7afc719Dcf36eF92c798203F74B67"
break;
case 23295:
Expand All @@ -239,6 +254,7 @@ async function main() {
gasPrice = ethers.utils.parseUnits('100', 'gwei')
gasLimit = 28000000
shouldDeployPredictoorHelper = true;
shouldDeployPredictoor = true;
pdrTrueValSubmiter = "0x005FD44e007866508f62b04ce9f43dd1d36D0c0c"
break;
case 44787:
Expand All @@ -254,7 +270,18 @@ async function main() {
shouldDeployDF = false;
shouldDeployVE = false;
break;

case 11155420:
networkName = "optimism_sepolia";
OPFOwner = '0xC7EC1970B09224B317c52d92f37F5e1E4fF6B687'
routerOwner = OPFOwner;
sleepAmount = 30
shouldDeployOceanToken = true;
shouldDeployV4 = true;
shouldDeployDF = false;
shouldDeployVE = false;
gasPrice = ethers.utils.parseUnits('1', 'gwei')
gasLimit = 28000000
break;
default:
OPFOwner = owner.address;
networkName = "development";
Expand All @@ -263,6 +290,7 @@ async function main() {
shouldDeployOceanToken = true;
shouldDeployVesting = true;
shouldDeployPredictoorHelper = true;
shouldDeployPredictoor = true;
sleepAmount = 0
break;
}
Expand Down Expand Up @@ -326,8 +354,7 @@ async function main() {
await ocean.connect(owner).mint(oceanHolder.address,ethers.utils.parseUnits('100000', 'ether'), options);
}
}
wallet = new Wallet.fromMnemonic(process.env.MNEMONIC);


if (sleepAmount > 0) await sleep(sleepAmount)
if (OPFOwner != owner.address) {
console.log("\tTransfer ownership of Ocean Token");
Expand Down Expand Up @@ -490,18 +517,21 @@ async function main() {
}
if (sleepAmount > 0) await sleep(sleepAmount)

if (logging) console.info("Deploying ERC20Template3");
const ERC203Template = await ethers.getContractFactory(
"ERC20Template3",
owner
);
let templateERC20Template3
if (options) templateERC20Template3 = await ERC203Template.connect(owner).deploy(options);
else templateERC20Template3 = await ERC203Template.connect(owner).deploy();
await templateERC20Template3.deployTransaction.wait();
if (show_verify) {
console.log("\tRun the following to verify on etherscan");
console.log("\tnpx hardhat verify --network " + networkName + " " + templateERC20Template3.address)

let templateERC20Template3=null
if(shouldDeployPredictoor){
if (logging) console.info("Deploying ERC20Template3");
const ERC203Template = await ethers.getContractFactory(
"ERC20Template3",
owner
);
if (options) templateERC20Template3 = await ERC203Template.connect(owner).deploy(options);
else templateERC20Template3 = await ERC203Template.connect(owner).deploy();
await templateERC20Template3.deployTransaction.wait();
if (show_verify) {
console.log("\tRun the following to verify on etherscan");
console.log("\tnpx hardhat verify --network " + networkName + " " + templateERC20Template3.address)
}
}


Expand Down Expand Up @@ -601,19 +631,19 @@ async function main() {
addresses.ERC20Template[currentTokenCount.toString()] =
templateERC20Enterprise.address;

if (logging) console.info("Adding ERC20Template3 to ERC721Factory");
if (options) templateadd = await factoryERC721.connect(owner).addTokenTemplate(templateERC20Template3.address, options);
else templateadd = await factoryERC721.connect(owner).addTokenTemplate(templateERC20Template3.address);
await templateadd.wait();
if (sleepAmount > 0) await sleep(sleepAmount)
if (options) currentTokenCount = await factoryERC721.getCurrentTemplateCount(options);
else currentTokenCount = await factoryERC721.getCurrentTemplateCount(options);

if (options) tokenTemplate = await factoryERC721.getTokenTemplate(currentTokenCount, options);
else tokenTemplate = await factoryERC721.getTokenTemplate(currentTokenCount);

addresses.ERC20Template[currentTokenCount.toString()] =
templateERC20Template3.address;
if(shouldDeployPredictoor){
if (logging) console.info("Adding ERC20Template3 to ERC721Factory");
if (options) templateadd = await factoryERC721.connect(owner).addTokenTemplate(templateERC20Template3.address, options);
else templateadd = await factoryERC721.connect(owner).addTokenTemplate(templateERC20Template3.address);
await templateadd.wait();
if (sleepAmount > 0) await sleep(sleepAmount)
if (options) currentTokenCount = await factoryERC721.getCurrentTemplateCount(options);
else currentTokenCount = await factoryERC721.getCurrentTemplateCount(options);
if (options) tokenTemplate = await factoryERC721.getTokenTemplate(currentTokenCount, options);
else tokenTemplate = await factoryERC721.getTokenTemplate(currentTokenCount);
addresses.ERC20Template[currentTokenCount.toString()] =
templateERC20Template3.address;
}

// SET REQUIRED ADDRESS
if (sleepAmount > 0) await sleep(sleepAmount)
Expand Down

0 comments on commit b8377a1

Please sign in to comment.