Skip to content

Commit

Permalink
feat: contract update with safe (#1320)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoslr authored Jan 11, 2024
1 parent aafe4df commit 5c83706
Show file tree
Hide file tree
Showing 20 changed files with 1,186 additions and 495 deletions.
7 changes: 7 additions & 0 deletions packages/smart-contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ yarn hardhat update-contracts

This command will output details about each update on each chain

By default, updates are performed by a Safe wallet. They need to be confirmed by co-owners in the RN Admin Safe.
If the contracts are to be administrated by an EOA, use the flag `eoa`:

```bash
yarn hardhat update-contracts --eoa
```

## Tests

After a local deployment:
Expand Down
29 changes: 7 additions & 22 deletions packages/smart-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import '@matterlabs/hardhat-zksync-verify';
import { subtask, task } from 'hardhat/config';
import { config } from 'dotenv';
import deployAllContracts from './scripts/test-deploy-all';
import { deployAllPaymentContracts } from './scripts/deploy-payments';
import { checkCreate2Deployer } from './scripts-create2/check-deployer';
import { deployDeployer, verifyDeployer } from './scripts-create2/deploy-request-deployer';
import { HardhatRuntimeEnvironmentExtended } from './scripts-create2/types';
Expand Down Expand Up @@ -306,20 +305,6 @@ task('deploy-local-env', 'Deploy a local environment').setAction(async (args, hr
}
});

task(
'deploy-live-payments',
'Deploy payment contracts on a live network. Make sure to update all artifacts before running.',
)
.addFlag('dryRun', 'to prevent any deployment')
.addFlag('force', 'to force re-deployment')
.setAction(async (args, hre) => {
args.force = args.force ?? false;
args.dryRun = args.dryRun ?? false;
args.simulate = args.dryRun;
await hre.run(DEPLOYER_KEY_GUARD);
await deployAllPaymentContracts(args, hre as HardhatRuntimeEnvironmentExtended);
});

task(
'deploy-live-storage',
'Deploy payment contracts on a live network. Make sure to update all artifacts before running.',
Expand Down Expand Up @@ -365,13 +350,13 @@ task(
await deployWithCreate2FromList(hre as HardhatRuntimeEnvironmentExtended);
});

task(
'update-contracts',
'Update the latest deployed contracts from the Create2DeploymentList',
).setAction(async (_args, hre) => {
await hre.run(DEPLOYER_KEY_GUARD);
await updateContractsFromList(hre as HardhatRuntimeEnvironmentExtended);
});
task('update-contracts', 'Update the latest deployed contracts from the Create2DeploymentList')
.addFlag('safe', 'Is the update to be performed in Safe context')
.setAction(async (args, hre) => {
const signWithEoa = args.eoa ?? false;
await hre.run(DEPLOYER_KEY_GUARD);
await updateContractsFromList(hre as HardhatRuntimeEnvironmentExtended, signWithEoa);
});

task(
'verify-contract-from-deployer',
Expand Down
2 changes: 2 additions & 0 deletions packages/smart-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
"@requestnetwork/currency": "0.12.0",
"@requestnetwork/types": "0.39.0",
"@requestnetwork/utils": "0.39.0",
"@safe-global/api-kit": "1.3.1",
"@safe-global/protocol-kit": "1.3.0",
"@superfluid-finance/ethereum-contracts": "1.1.1",
"@typechain/ethers-v5": "7.0.1",
"@typechain/hardhat": "2.1.2",
Expand Down
Loading

0 comments on commit 5c83706

Please sign in to comment.