Skip to content

Commit

Permalink
Add batch transfer deployment and add setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-turek committed Aug 8, 2024
1 parent 1a2bd4c commit cb55d05
Show file tree
Hide file tree
Showing 4 changed files with 574 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {HardhatRuntimeEnvironment} from 'hardhat/types';
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy} = deployments;
const {deployer, sandAdmin} = await getNamedAccounts();
const {deployer} = await getNamedAccounts();

await deploy('BatchTransfer', {
from: deployer,
contract:
'@sandbox-smart-contracts/batch-transfers/contracts/BatchTransfer.sol:BatchTransfer',
log: true,
skipIfAlreadyDeployed: true,
args: [sandAdmin],
});
};

Expand Down
42 changes: 42 additions & 0 deletions packages/deploy/deploy/900_batch_transfer/801_add_operators.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {execute, log, read, catchUnknownSigner} = deployments;
const {deployer} = await getNamedAccounts();

const operatorRole = await read('BatchTransfer', 'OPERATOR_ROLE');

const operators = [
'0x782788bB333feB56bbC426588263Db9671F074c1', // (NFT Vault for DAO)
'0x7A9fe22691c811ea339D9B73150e6911a5343DcA', // (Seb)
'0x51b66b4cb9053726442752f1a722ce5438553a88', // (QA PROD Account)
];

for (const operator of operators) {
const isOperator = await read(
'BatchTransfer',
'hasRole',
operatorRole,
operator
);
if (!isOperator) {
await catchUnknownSigner(
execute(
'BatchTransfer',
{from: deployer, log: true},
'grantRole',
operatorRole,
operator
)
);
log(`[BatchTransfer] Operator role granted to ${operator}`);
}
}
};

export default func;

func.tags = ['BatchTransfer', 'BatchTransfer_setup'];
func.dependencies = ['BatchTransfer_deploy'];
473 changes: 473 additions & 0 deletions packages/deploy/deployments/polygon/BatchTransfer.json

Large diffs are not rendered by default.

Loading

0 comments on commit cb55d05

Please sign in to comment.