Tags
The following is a guide on verifying that the expected facet addresses are added/changed/removed upon the execution of a diamondCut
call.
- Follow How to Setup Environment.
- Add the following code to the
hardhat.config.js
file in theprotocol
directory of the cloned repository. - Run the following command in a separate terminal window (in the same directory) to the mainnet fork that you started per How to Setup Environment.
- Go to a site like https://www.diffchecker.com/text-compare/ and paste the output in the first text field.
- Add the hardhat tasks in the BIP Runbooks that corresponds to the
diamondCut
call to thehardhat.config.js
file. The following is an example from BIP-50. - Run the following command in the same terminal window as step (3). Again,
bip50enc
is just an example from BIP-50—see the respective BIP Runbooks. This will execute thediamondCut
. - Run the
facet
task again. - Go back to https://www.diffchecker.com/text-compare/ and paste the new output in the second text field.
- Click “Find Difference” to generate the diff.
- Manually view the diff and confirm that the expected facet addresses from the BIP Runbooks are correspondingly added, changed or removed.
Note that you may have to add the import for getBeanstalk
on line 10 from .utils
.
task('facet', async function () {
const bs = await getBeanstalk("0xD1A0060ba708BC4BCD3DA6C37EFa8deDF015FB70")
console.log(await bs.facets())
})
You may have to add an import for getBeanstalk
from utils.js
.
npx hardhat facet --network localhost | pbcopy
This command will get a list of all the facet addresses and their function selectors. pbcopy
copies the output to your clipboard.
task('bip50part1enc', async function () {
const bcm = await impersonateBeanstalkOwner()
await mintEth(bcm.address)
await bcm.sendTransaction({to: BEANSTALK, value: 0, data: 'TBD'})
})
npx hardhat bip50part1enc --network localhost
npx hardhat facet --network localhost | pbcopy