-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Akshat Mittal <[email protected]>
- Loading branch information
1 parent
a5235dd
commit cda7d8a
Showing
25 changed files
with
341 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import hre, { ethers } from 'hardhat' | ||
|
||
import { getChainId, isValidContract } from '../../../common/blockchain-utils' | ||
import { getDeploymentFile, getDeploymentFilename, IDeployments } from '../common' | ||
import { initiateMultisigTxs } from '../utils' | ||
import { MetaTransactionData } from '@safe-global/safe-core-sdk-types' | ||
|
||
async function main() { | ||
// ==== Read Configuration ==== | ||
const [burner] = await hre.ethers.getSigners() | ||
const chainId = await getChainId(hre) | ||
|
||
console.log(`Saving Facets to Facade on network ${hre.network.name} (${chainId}) | ||
with burner account: ${burner.address}`) | ||
|
||
const deploymentFilename = getDeploymentFilename(chainId) | ||
const deployments = <IDeployments>getDeploymentFile(deploymentFilename) | ||
|
||
// Check facade exists | ||
if (!deployments.facade) { | ||
throw new Error(`Missing deployed contracts in network ${hre.network.name}`) | ||
} else if (!(await isValidContract(hre, deployments.facade))) { | ||
throw new Error(`Facade contract not found in network ${hre.network.name}`) | ||
} | ||
|
||
// ******************** Save Facets to Facade ****************************************/ | ||
|
||
if (hre.network.name == 'localhost' || hre.network.name == 'hardhat') { | ||
console.log('Skipping saving facets on localhost') | ||
return | ||
} | ||
|
||
const facade = await ethers.getContractAt('Facade', deployments.facade) | ||
|
||
const facets = [ | ||
await ethers.getContractAt('ReadFacet', deployments.facets.readFacet), | ||
await ethers.getContractAt('ActFacet', deployments.facets.actFacet), | ||
await ethers.getContractAt('MaxIssuableFacet', deployments.facets.maxIssuableFacet), | ||
await ethers.getContractAt('BackingBufferFacet', deployments.facets.backingBufferFacet), | ||
await ethers.getContractAt('RevenueFacet', deployments.facets.revenueFacet), | ||
] | ||
|
||
const txs = facets.map((facet): MetaTransactionData => { | ||
return { | ||
to: facade.address, | ||
value: '0', | ||
data: facade.interface.encodeFunctionData('save', [ | ||
facet.address, | ||
Object.entries(facet.functions).map(([fn]) => facet.interface.getSighash(fn)), | ||
]), | ||
} | ||
}) | ||
|
||
await initiateMultisigTxs(chainId, txs) | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error) | ||
process.exitCode = 1 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.