Skip to content

Commit

Permalink
Merge pull request #180 from CirclesUBI/save-contract-addresses
Browse files Browse the repository at this point in the history
Save contract addresses
  • Loading branch information
llunaCreixent authored Mar 16, 2023
2 parents dc5ded5 + c0a8f19 commit 9b5967c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 9 deletions.
9 changes: 8 additions & 1 deletion migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const fs = require('fs');

const Hub = artifacts.require('./Hub.sol');
const { convertToBaseUnit } = require('../test/helpers/math');

Expand All @@ -11,5 +13,10 @@ module.exports = async function (deployer) {
convertToBaseUnit(50),
'92592592592592',
'7776000',
);
).then((result) => {
fs.writeFile('addresses', `${result.address} \n`, (err) => {
// Checking for errors
if (err) throw err;
});
});
};
14 changes: 12 additions & 2 deletions migrations/3_deploy_safe.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const fs = require('fs');

const truffleContract = require('@truffle/contract');
const proxyArtifacts = require('@circles/safe-contracts/build/contracts/ProxyFactory.json');
const safeArtifacts = require('@circles/safe-contracts/build/contracts/GnosisSafe.json');
Expand All @@ -9,6 +11,14 @@ GnosisSafe.setProvider(web3.currentProvider);
ProxyFactory.setProvider(web3.currentProvider);

module.exports = async function (deployer, network, accounts) {
await deployer.deploy(GnosisSafe, { from: accounts[0] });
return deployer.deploy(ProxyFactory, { from: accounts[0] });
await deployer.deploy(GnosisSafe, { from: accounts[0] }).then((result) => {
fs.appendFile('addresses', `${result.address} \n`, (err) => {
if (err) throw err;
});
});
return deployer.deploy(ProxyFactory, { from: accounts[0] }).then((result) => {
fs.appendFile('addresses', `${result.address} \n`, (err) => {
if (err) throw err;
});
});
};
38 changes: 32 additions & 6 deletions migrations/4_deploy_safe_1.3.0.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const fs = require('fs');

const truffleContract = require('@truffle/contract');
const proxyArtifacts = require('@gnosis.pm/safe-contracts/build/artifacts/contracts/proxies/GnosisSafeProxyFactory.sol/GnosisSafeProxyFactory.json');
const safeArtifacts = require('@gnosis.pm/safe-contracts/build/artifacts/contracts/GnosisSafe.sol/GnosisSafe.json');
Expand All @@ -21,10 +23,34 @@ DefaultCallbackHandler.setProvider(web3.currentProvider);
GnosisSafeL2.setProvider(web3.currentProvider);

module.exports = async function (deployer, network, accounts) {
await deployer.deploy(MultiSend, { from: accounts[0] });
await deployer.deploy(GnosisSafe, { from: accounts[0] });
await deployer.deploy(MultiSendCallOnly, { from: accounts[0] });
await deployer.deploy(ProxyFactory, { from: accounts[0] });
await deployer.deploy(DefaultCallbackHandler, { from: accounts[0] });
return deployer.deploy(GnosisSafeL2, { from: accounts[0] });
await deployer.deploy(MultiSend, { from: accounts[0] }).then((result) => {
fs.appendFile('addresses', `${result.address} \n`, (err) => {
if (err) throw err;
});
});
await deployer.deploy(GnosisSafe, { from: accounts[0] }).then((result) => {
fs.appendFile('addresses', `${result.address} \n`, (err) => {
if (err) throw err;
});
});
await deployer.deploy(MultiSendCallOnly, { from: accounts[0] }).then((result) => {
fs.appendFile('addresses', `${result.address} \n`, (err) => {
if (err) throw err;
});
});
await deployer.deploy(ProxyFactory, { from: accounts[0] }).then((result) => {
fs.appendFile('addresses', `${result.address} \n`, (err) => {
if (err) throw err;
});
});
await deployer.deploy(DefaultCallbackHandler, { from: accounts[0] }).then((result) => {
fs.appendFile('addresses', `${result.address} \n`, (err) => {
if (err) throw err;
});
});
return deployer.deploy(GnosisSafeL2, { from: accounts[0] }).then((result) => {
fs.appendFile('addresses', `${result.address} \n`, (err) => {
if (err) throw err;
});
});
};

0 comments on commit 9b5967c

Please sign in to comment.