misc: scripts for setMigrationAdmins whitelisting

This commit is contained in:
vicnaum
2023-10-26 20:58:31 +02:00
parent 54726adbb7
commit 7b81a04bf4
5 changed files with 1072 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
# Read $CALLDATA from calldata.txt
CALLDATA=$(cat calldata.txt)
LENSHUB="0x7582177F9E536aB0b6c721e11f383C326F2Ad1D5"
GOVERNANCE="0x56ebd55b2DD089D91D14Ec131Ad41e8474684822"
GOVOWNER="0x532BbA5445e306cB83cF26Ef89842d4701330A45"
cast send --rpc-url mumbai --unlocked --from $GOVOWNER $GOVERNANCE "executeAsGovernance(address,bytes)" $LENSHUB $CALLDATA

1
script/calldata.txt Normal file

File diff suppressed because one or more lines are too long

1001
script/migrationAdmins.csv Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,53 @@
// Read migrationAdmins.csv
// In the format of:
// index,address
// 0,0x1234...
// 1,0x5678...
// ...
const fs = require('fs');
const file = 'migrationAdmins.csv';
const migrationAdmins = [];
// Read file line by line and save to the array
// Skip the first line
fs.readFileSync(file, 'utf-8')
.split(/\r?\n/)
.slice(1)
.forEach(function (line) {
// If line is empty, skip
if (!line) return;
const [index, address] = line.split(',');
migrationAdmins.push(address);
});
// Function setMigrationAdmins(address[] memory migrationAdmins, bool whitelisted)
// Construct the calldata using migrationAdmins and bool true, using ethers
const ethers = require('ethers');
const abi = [
{
inputs: [
{
internalType: 'address[]',
name: 'migrationAdmins',
type: 'address[]',
},
{
internalType: 'bool',
name: 'whitelisted',
type: 'bool',
},
],
name: 'setMigrationAdmins',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
];
const iface = new ethers.utils.Interface(abi);
const data = iface.encodeFunctionData('setMigrationAdmins', [migrationAdmins, true]);
console.log(data);

View File

@@ -0,0 +1,9 @@
ADMIN_TO_VERIFY=$1
LENSHUB="0x7582177F9E536aB0b6c721e11f383C326F2Ad1D5"
STORAGE_SLOT=29
SLOT=$(cast abi-encode "a(address,uint256)" $ADMIN_TO_VERIFY $STORAGE_SLOT)
KECCAK_HASH=$(cast keccak $SLOT)
cast storage --rpc-url mumbai $LENSHUB $KECCAK_HASH