Skip to content

Commit

Permalink
add - when GnosisSafeL2 is already deployed, skip it
Browse files Browse the repository at this point in the history
  • Loading branch information
devbest555 committed May 30, 2024
1 parent 64d7e9f commit 60ebb1e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 37 deletions.
22 changes: 14 additions & 8 deletions deploy/deploy_gnosis_safe.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@ module.exports = async function ({ getNamedAccounts, deployments }) {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const { getConfig } = require('../scripts/utils');

const network = await ethers.provider.getNetwork();
const chainId = network.chainId;
console.log("Chain ID: ", chainId);

await deploy('GnosisSafeL2', {
from: deployer,
args: [],
log: true,
deterministicDeployment: false,
skipIfAlreadyDeployed: true,
});

const {GnosisSafeL2} = getConfig(chainId);

if (GnosisSafeL2 == "") {
await deploy('GnosisSafeL2', {
from: deployer,
args: [],
log: true,
deterministicDeployment: false,
skipIfAlreadyDeployed: true,
});
}
};

module.exports.id = 'deploy_gnosis_safe'
Expand Down
17 changes: 10 additions & 7 deletions deploy/deploy_ownablee.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@ module.exports = async function ({ getNamedAccounts, deployments }) {
const network = await ethers.provider.getNetwork();
const chainId = network.chainId;

const {vabToken, usdcAdress, walletAddress} = getConfig(chainId);
let GnosisSafeAddress = GnosisSafeL2;
if (GnosisSafeAddress == "") {
this.GnosisSafe = await deployments.get('GnosisSafeL2');
GnosisSafeAddress = this.GnosisSafe.address;
}

console.log("------------- Ownablee Deployment -----------------");
console.log({vabToken, usdcAdress, walletAddress});
const {vabToken, usdcAdress, walletAddress, GnosisSafeL2} = getConfig(chainId);

this.GnosisSafe = await deployments.get('GnosisSafeL2');

console.log("------------- Ownablee Deployment -----------------");
console.log({vabToken, usdcAdress, walletAddress, GnosisSafeL2});

await deploy('Ownablee', {
from: deployer,
args: [
walletAddress,
vabToken,
usdcAdress,
// this.GnosisSafe.address
"0x170341dfFAD907f9695Dc1C17De622A5A2F28259",
GnosisSafeAddress,
// "0xe0536a4D730a78DB8B4c4605D73e107201d9543e"
// "0x3E5e853d1784cDB519DB1eB175B374FB53FE285C"
],
Expand Down
44 changes: 23 additions & 21 deletions deploy/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,30 @@ module.exports = async function ({ deployments }) {
console.log("Private Signers Address", {user1: signer1.address, user2: signer2.address});
// console.log("Private Signers", signer1, signer2);

const GnosisSafeContract = await ethers.getContractAt('GnosisSafeL2', this.GnosisSafeL2.address)
const threshold = await GnosisSafeContract.getThreshold();
try {
if (threshold == 0) {
await GnosisSafeContract.connect(deployer).setup(
[signer1.address, signer2.address],
2,
addressZero,
"0x",
addressZero,
addressZero,
0,
addressZero,
{from: deployer.address}
)
}
console.log('complete => GnosisSafeL2 setup')
} catch (ex) {
console.log('error => GnosisSafeL2 setup', ex)
const {GnosisSafeL2} = getConfig(chainId);

if (GnosisSafeL2 == "") {
const GnosisSafeContract = await ethers.getContractAt('GnosisSafeL2', this.GnosisSafeL2.address)
const threshold = await GnosisSafeContract.getThreshold();
try {
if (threshold == 0) {
await GnosisSafeContract.connect(deployer).setup(
[signer1.address, signer2.address],
2,
addressZero,
"0x",
addressZero,
addressZero,
0,
addressZero,
{from: deployer.address}
)
}
console.log('complete => GnosisSafeL2 setup')
} catch (ex) {
console.log('error => GnosisSafeL2 setup', ex)
}
}



const FactoryFilmNFTContract = await ethers.getContractAt('FactoryFilmNFT', this.FactoryFilmNFT.address)

Expand Down
2 changes: 1 addition & 1 deletion scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const CONFIG = {
FactoryFilmNFT: "",
FactorySubNFT: "",
FactoryTierNFT: "",
GnosisSafeL2: "",
GnosisSafeL2: "0x170341dffad907f9695dc1c17de622a5a2f28259",
Ownablee: "",
Property: "",
StakingPool: "",
Expand Down

0 comments on commit 60ebb1e

Please sign in to comment.