📕

BIP-49 Runbook

Proposal
July 29, 2024

Links

diamondCut JSON:

bip-49.json13.6KB
{
    "diamondCut": {
        "diamondCut": [
            [
                "0x0000000000000000000000000000000000000000",
                2,
                [
                    "0xa84643e4"
                ]
            ],
            [
                "0xb52af7889b05eF652468E98D249700415a9F587D",
                0,
                [
                    "0xe68a543a"
                ]
            ],
            [
                "0xb52af7889b05eF652468E98D249700415a9F587D",
                1,
                [
                    "0x787cee99",
                    "0xfa345569",
                    "0x1acc0a47",
                    "0x1be655e8",
                    "0x9a516cad",
                    "0x087d78b4",
                    "0x7caa025f",
                    "0xbfe2f3be",
                    "0x6de45df2",
                    "0x014a8a49",
                    "0xbb7de478",
                    "0x43cc4ee0",
                    "0xab434eb7",
                    "0xadef4533",
                    "0x9f06b3fa",
                    "0xb8a04d1b",
                    "0x691bcc88",
                    "0xfc6a19df",
                    "0x13ed3cea",
                    "0xd3c73ec8",
                    "0xa33fa99f",
                    "0x33f37f27"
                ]
            ],
            [
                "0x2604D728D8c6918b8C427bF42aa2ed07ceB5cf23",
                1,
                [
                    "0xb362a6e8"
                ]
            ],
            [
                "0x09D466663586292F5f0c1D99e9547A7A81E887f5",
                1,
                [
                    "0x4aa06652",
                    "0x24dd285c"
                ]
            ],
            [
                "0x51F74C024936E296132c6F4E59b9EEd677eb3B1c",
                1,
                [
                    "0x64ee4b80",
                    "0xca7b7d7b",
                    "0xfc06d2a6"
                ]
            ],
            [
                "0x9fd4daD032324bC569decC3795731aEC309c2923",
                1,
                [
                    "0x2a27c499",
                    "0xeedc7ab9",
                    "0x7ba6cbf8",
                    "0xeb0e1215",
                    "0xd1db56b8",
                    "0x69aa7e02",
                    "0xcc88d4f9",
                    "0x673c75f0",
                    "0x64b3496b",
                    "0x93523425",
                    "0x64887852",
                    "0xb2b0556d",
                    "0x141933bf",
                    "0xf98da2de",
                    "0x383f170f",
                    "0xd1943f7f",
                    "0xcb2d0a3c",
                    "0xcce813a1",
                    "0x6af8e5a4",
                    "0x7d23804d",
                    "0x50539159",
                    "0xbbf459a7",
                    "0xf788b47c",
                    "0xa13a3742",
                    "0x93c9e531",
                    "0x5c975abb",
                    "0xe60d7a83",
                    "0x471bcdbe",
                    "0x43def26e",
                    "0xc50b0fb0",
                    "0x3b2ecb70",
                    "0x16ada547",
                    "0x06c499d8",
                    "0x686b6159",
                    "0x597490c0"
                ]
            ],
            [
                "0x9586878Ea437CBB6D4b6381Bde7B064f531CfB77",
                0,
                [
                    "0x12cb5eab"
                ]
            ],
            [
                "0x9586878Ea437CBB6D4b6381Bde7B064f531CfB77",
                1,
                [
                    "0x304ec65d",
                    "0xb6f42085",
                    "0x1799b3b2",
                    "0x1edb6be1",
                    "0x9bb4e35a",
                    "0x83e08888",
                    "0xdc6ba285",
                    "0x39448802",
                    "0xc85951a1",
                    "0x9c45a1d5",
                    "0x34af5416",
                    "0x1e223143",
                    "0x29130a66",
                    "0x4d622831",
                    "0x69744dd0",
                    "0xf4a057e2",
                    "0x6ae1c014",
                    "0xd47aee59",
                    "0x4a16607c",
                    "0x4f9a9678",
                    "0xf9c4ebde",
                    "0xa3ef48c9",
                    "0x363591d0",
                    "0x94daa221",
                    "0xe3d4e44c",
                    "0xf255da60",
                    "0x93a39bea"
                ]
            ]
        ],
        "initFacetAddress": "0x2d130cEfa0bf9D1a3e0445c9478503c326F2F8E9",
        "functionCall": "0xe1c7392a"
    },
    "encoded": "0x1f931c1c00000000000000000000000000000000000000000000000000000000000000600000000000000000000000002d130cefa0bf9d1a3e0445c9478503c326f2f8e900000000000000000000000000000000000000000000000000000000000011c00000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001a84643e400000000000000000000000000000000000000000000000000000000000000000000000000000000b52af7889b05ef652468e98d249700415a9f587d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001e68a543a00000000000000000000000000000000000000000000000000000000000000000000000000000000b52af7889b05ef652468e98d249700415a9f587d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000016787cee9900000000000000000000000000000000000000000000000000000000fa345569000000000000000000000000000000000000000000000000000000001acc0a47000000000000000000000000000000000000000000000000000000001be655e8000000000000000000000000000000000000000000000000000000009a516cad00000000000000000000000000000000000000000000000000000000087d78b4000000000000000000000000000000000000000000000000000000007caa025f00000000000000000000000000000000000000000000000000000000bfe2f3be000000000000000000000000000000000000000000000000000000006de45df200000000000000000000000000000000000000000000000000000000014a8a4900000000000000000000000000000000000000000000000000000000bb7de4780000000000000000000000000000000000000000000000000000000043cc4ee000000000000000000000000000000000000000000000000000000000ab434eb700000000000000000000000000000000000000000000000000000000adef4533000000000000000000000000000000000000000000000000000000009f06b3fa00000000000000000000000000000000000000000000000000000000b8a04d1b00000000000000000000000000000000000000000000000000000000691bcc8800000000000000000000000000000000000000000000000000000000fc6a19df0000000000000000000000000000000000000000000000000000000013ed3cea00000000000000000000000000000000000000000000000000000000d3c73ec800000000000000000000000000000000000000000000000000000000a33fa99f0000000000000000000000000000000000000000000000000000000033f37f27000000000000000000000000000000000000000000000000000000000000000000000000000000002604d728d8c6918b8c427bf42aa2ed07ceb5cf23000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001b362a6e80000000000000000000000000000000000000000000000000000000000000000000000000000000009d466663586292f5f0c1d99e9547a7a81e887f50000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000024aa066520000000000000000000000000000000000000000000000000000000024dd285c0000000000000000000000000000000000000000000000000000000000000000000000000000000051f74c024936e296132c6f4e59b9eed677eb3b1c00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000364ee4b8000000000000000000000000000000000000000000000000000000000ca7b7d7b00000000000000000000000000000000000000000000000000000000fc06d2a6000000000000000000000000000000000000000000000000000000000000000000000000000000009fd4dad032324bc569decc3795731aec309c29230000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000232a27c49900000000000000000000000000000000000000000000000000000000eedc7ab9000000000000000000000000000000000000000000000000000000007ba6cbf800000000000000000000000000000000000000000000000000000000eb0e121500000000000000000000000000000000000000000000000000000000d1db56b80000000000000000000000000000000000000000000000000000000069aa7e0200000000000000000000000000000000000000000000000000000000cc88d4f900000000000000000000000000000000000000000000000000000000673c75f00000000000000000000000000000000000000000000000000000000064b3496b0000000000000000000000000000000000000000000000000000000093523425000000000000000000000000000000000000000000000000000000006488785200000000000000000000000000000000000000000000000000000000b2b0556d00000000000000000000000000000000000000000000000000000000141933bf00000000000000000000000000000000000000000000000000000000f98da2de00000000000000000000000000000000000000000000000000000000383f170f00000000000000000000000000000000000000000000000000000000d1943f7f00000000000000000000000000000000000000000000000000000000cb2d0a3c00000000000000000000000000000000000000000000000000000000cce813a1000000000000000000000000000000000000000000000000000000006af8e5a4000000000000000000000000000000000000000000000000000000007d23804d000000000000000000000000000000000000000000000000000000005053915900000000000000000000000000000000000000000000000000000000bbf459a700000000000000000000000000000000000000000000000000000000f788b47c00000000000000000000000000000000000000000000000000000000a13a37420000000000000000000000000000000000000000000000000000000093c9e531000000000000000000000000000000000000000000000000000000005c975abb00000000000000000000000000000000000000000000000000000000e60d7a8300000000000000000000000000000000000000000000000000000000471bcdbe0000000000000000000000000000000000000000000000000000000043def26e00000000000000000000000000000000000000000000000000000000c50b0fb0000000000000000000000000000000000000000000000000000000003b2ecb700000000000000000000000000000000000000000000000000000000016ada5470000000000000000000000000000000000000000000000000000000006c499d800000000000000000000000000000000000000000000000000000000686b615900000000000000000000000000000000000000000000000000000000597490c0000000000000000000000000000000000000000000000000000000000000000000000000000000009586878ea437cbb6d4b6381bde7b064f531cfb7700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000112cb5eab000000000000000000000000000000000000000000000000000000000000000000000000000000009586878ea437cbb6d4b6381bde7b064f531cfb7700000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001b304ec65d00000000000000000000000000000000000000000000000000000000b6f42085000000000000000000000000000000000000000000000000000000001799b3b2000000000000000000000000000000000000000000000000000000001edb6be1000000000000000000000000000000000000000000000000000000009bb4e35a0000000000000000000000000000000000000000000000000000000083e0888800000000000000000000000000000000000000000000000000000000dc6ba285000000000000000000000000000000000000000000000000000000003944880200000000000000000000000000000000000000000000000000000000c85951a1000000000000000000000000000000000000000000000000000000009c45a1d50000000000000000000000000000000000000000000000000000000034af5416000000000000000000000000000000000000000000000000000000001e2231430000000000000000000000000000000000000000000000000000000029130a66000000000000000000000000000000000000000000000000000000004d6228310000000000000000000000000000000000000000000000000000000069744dd000000000000000000000000000000000000000000000000000000000f4a057e2000000000000000000000000000000000000000000000000000000006ae1c01400000000000000000000000000000000000000000000000000000000d47aee59000000000000000000000000000000000000000000000000000000004a16607c000000000000000000000000000000000000000000000000000000004f9a967800000000000000000000000000000000000000000000000000000000f9c4ebde00000000000000000000000000000000000000000000000000000000a3ef48c900000000000000000000000000000000000000000000000000000000363591d00000000000000000000000000000000000000000000000000000000094daa22100000000000000000000000000000000000000000000000000000000e3d4e44c00000000000000000000000000000000000000000000000000000000f255da600000000000000000000000000000000000000000000000000000000093a39bea000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004e1c7392a00000000000000000000000000000000000000000000000000000000"
}

Overview

Init Contract

InitBipMiscImprovements: 0x2d130cEfa0bf9D1a3e0445c9478503c326F2F8E9

Facets Being Removed

Facets Being Added

Verifying the Transaction

Setup

  1. Follow 🏗️How to Setup Environment, pulling and compiling the latest changes on the bip-misc-upgrades branch.

The Diamond Cut Transaction

Add the following bip49enc task to hardhat.config.js per How to Verify Facet Changes.

You can verify that the following data value in the final line of code is the one that corresponds to the BIP transaction by comparing it with the Raw data field on the Safe multisig transaction.

task('bip49enc', async function () {
  const bcm = await impersonateBeanstalkOwner()
  await mintEth(bcm.address)
  await bcm.sendTransaction({to: BEANSTALK, value: 0, data: '0x1f931c1c00000000000000000000000000000000000000000000000000000000000000600000000000000000000000002d130cefa0bf9d1a3e0445c9478503c326f2f8e900000000000000000000000000000000000000000000000000000000000011c00000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000007e00000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001a84643e400000000000000000000000000000000000000000000000000000000000000000000000000000000b52af7889b05ef652468e98d249700415a9f587d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001e68a543a00000000000000000000000000000000000000000000000000000000000000000000000000000000b52af7889b05ef652468e98d249700415a9f587d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000016787cee9900000000000000000000000000000000000000000000000000000000fa345569000000000000000000000000000000000000000000000000000000001acc0a47000000000000000000000000000000000000000000000000000000001be655e8000000000000000000000000000000000000000000000000000000009a516cad00000000000000000000000000000000000000000000000000000000087d78b4000000000000000000000000000000000000000000000000000000007caa025f00000000000000000000000000000000000000000000000000000000bfe2f3be000000000000000000000000000000000000000000000000000000006de45df200000000000000000000000000000000000000000000000000000000014a8a4900000000000000000000000000000000000000000000000000000000bb7de4780000000000000000000000000000000000000000000000000000000043cc4ee000000000000000000000000000000000000000000000000000000000ab434eb700000000000000000000000000000000000000000000000000000000adef4533000000000000000000000000000000000000000000000000000000009f06b3fa00000000000000000000000000000000000000000000000000000000b8a04d1b00000000000000000000000000000000000000000000000000000000691bcc8800000000000000000000000000000000000000000000000000000000fc6a19df0000000000000000000000000000000000000000000000000000000013ed3cea00000000000000000000000000000000000000000000000000000000d3c73ec800000000000000000000000000000000000000000000000000000000a33fa99f0000000000000000000000000000000000000000000000000000000033f37f27000000000000000000000000000000000000000000000000000000000000000000000000000000002604d728d8c6918b8c427bf42aa2ed07ceb5cf23000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001b362a6e80000000000000000000000000000000000000000000000000000000000000000000000000000000009d466663586292f5f0c1d99e9547a7a81e887f50000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000024aa066520000000000000000000000000000000000000000000000000000000024dd285c0000000000000000000000000000000000000000000000000000000000000000000000000000000051f74c024936e296132c6f4e59b9eed677eb3b1c00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000364ee4b8000000000000000000000000000000000000000000000000000000000ca7b7d7b00000000000000000000000000000000000000000000000000000000fc06d2a6000000000000000000000000000000000000000000000000000000000000000000000000000000009fd4dad032324bc569decc3795731aec309c29230000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000232a27c49900000000000000000000000000000000000000000000000000000000eedc7ab9000000000000000000000000000000000000000000000000000000007ba6cbf800000000000000000000000000000000000000000000000000000000eb0e121500000000000000000000000000000000000000000000000000000000d1db56b80000000000000000000000000000000000000000000000000000000069aa7e0200000000000000000000000000000000000000000000000000000000cc88d4f900000000000000000000000000000000000000000000000000000000673c75f00000000000000000000000000000000000000000000000000000000064b3496b0000000000000000000000000000000000000000000000000000000093523425000000000000000000000000000000000000000000000000000000006488785200000000000000000000000000000000000000000000000000000000b2b0556d00000000000000000000000000000000000000000000000000000000141933bf00000000000000000000000000000000000000000000000000000000f98da2de00000000000000000000000000000000000000000000000000000000383f170f00000000000000000000000000000000000000000000000000000000d1943f7f00000000000000000000000000000000000000000000000000000000cb2d0a3c00000000000000000000000000000000000000000000000000000000cce813a1000000000000000000000000000000000000000000000000000000006af8e5a4000000000000000000000000000000000000000000000000000000007d23804d000000000000000000000000000000000000000000000000000000005053915900000000000000000000000000000000000000000000000000000000bbf459a700000000000000000000000000000000000000000000000000000000f788b47c00000000000000000000000000000000000000000000000000000000a13a37420000000000000000000000000000000000000000000000000000000093c9e531000000000000000000000000000000000000000000000000000000005c975abb00000000000000000000000000000000000000000000000000000000e60d7a8300000000000000000000000000000000000000000000000000000000471bcdbe0000000000000000000000000000000000000000000000000000000043def26e00000000000000000000000000000000000000000000000000000000c50b0fb0000000000000000000000000000000000000000000000000000000003b2ecb700000000000000000000000000000000000000000000000000000000016ada5470000000000000000000000000000000000000000000000000000000006c499d800000000000000000000000000000000000000000000000000000000686b615900000000000000000000000000000000000000000000000000000000597490c0000000000000000000000000000000000000000000000000000000000000000000000000000000009586878ea437cbb6d4b6381bde7b064f531cfb7700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000112cb5eab000000000000000000000000000000000000000000000000000000000000000000000000000000009586878ea437cbb6d4b6381bde7b064f531cfb7700000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001b304ec65d00000000000000000000000000000000000000000000000000000000b6f42085000000000000000000000000000000000000000000000000000000001799b3b2000000000000000000000000000000000000000000000000000000001edb6be1000000000000000000000000000000000000000000000000000000009bb4e35a0000000000000000000000000000000000000000000000000000000083e0888800000000000000000000000000000000000000000000000000000000dc6ba285000000000000000000000000000000000000000000000000000000003944880200000000000000000000000000000000000000000000000000000000c85951a1000000000000000000000000000000000000000000000000000000009c45a1d50000000000000000000000000000000000000000000000000000000034af5416000000000000000000000000000000000000000000000000000000001e2231430000000000000000000000000000000000000000000000000000000029130a66000000000000000000000000000000000000000000000000000000004d6228310000000000000000000000000000000000000000000000000000000069744dd000000000000000000000000000000000000000000000000000000000f4a057e2000000000000000000000000000000000000000000000000000000006ae1c01400000000000000000000000000000000000000000000000000000000d47aee59000000000000000000000000000000000000000000000000000000004a16607c000000000000000000000000000000000000000000000000000000004f9a967800000000000000000000000000000000000000000000000000000000f9c4ebde00000000000000000000000000000000000000000000000000000000a3ef48c900000000000000000000000000000000000000000000000000000000363591d00000000000000000000000000000000000000000000000000000000094daa22100000000000000000000000000000000000000000000000000000000e3d4e44c00000000000000000000000000000000000000000000000000000000f255da600000000000000000000000000000000000000000000000000000000093a39bea000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004e1c7392a00000000000000000000000000000000000000000000000000000000'})
})

Verifying the Diamond Cut

  1. Follow How to Verify Facet Changes.
  2. Verify there are no remaining function selectors from the Facets Being Deprecated section above.
  3. Verify that all function selectors from the Facets Being Added section above are present.

Verifying the Deployed Code

  1. Add the following tasks to hardhat.config.js :
  2. task("verifybip-49", async function () {
      facetNames = [
        "UnripeFacet",
        "ConvertFacet",
        "ConvertGettersFacet",
        "SeasonFacet",
        "SeasonGettersFacet",
        "FertilizerFacet"
      ];
    
      facetLibraries = {
        UnripeFacet: { LibLockedUnderlying: "0x38980F78D9d242fBB4fE9aEaBB0A3eA7a0509d48" },
        ConvertFacet: { LibConvert: "0x7a92A0a493CAfFf4A9dC5802c8042dC3Ba35c022" },
        SeasonFacet: {
          LibGauge: "0xcd8AD6026D8C9c74E04cfEd97A167Ce54D8520b2",
          LibIncentive: "0x9d5E1F29ABc45205Cf95161DEe74C1df95E11052",
          LibLockedUnderlying: "0x38980F78D9d242fBB4fE9aEaBB0A3eA7a0509d48",
          LibWellMinting: "0xc0EadEfb4A8336C3B259d612998c539841cA8963",
          LibGerminate: "0x4785E65632b519f432382bC292be3AC9dE699089"
        },
        SeasonGettersFacet: {
          LibLockedUnderlying: "0x38980F78D9d242fBB4fE9aEaBB0A3eA7a0509d48",
          LibWellMinting: "0xc0EadEfb4A8336C3B259d612998c539841cA8963"
        },
      };
    
      deployedFacetAddresses = {
        UnripeFacet: "0xb52af7889b05eF652468E98D249700415a9F587D",
        ConvertFacet: "0x2604D728D8c6918b8C427bF42aa2ed07ceB5cf23",
        ConvertGettersFacet: "0x09D466663586292F5f0c1D99e9547A7A81E887f5",
        SeasonFacet: "0x51F74C024936E296132c6F4E59b9EEd677eb3B1c",
        SeasonGettersFacet: "0x9fd4daD032324bC569decC3795731aEC309c2923",
        FertilizerFacet: "0x9586878Ea437CBB6D4b6381Bde7B064f531CfB77",
      };
    
      // get the bytecode by deploying facets.
      data = await getFacetBytecode(facetNames, facetLibraries, true);
      // compare facet bytecode with on-chain bytecode.
      await compareBytecode(data, deployedFacetAddresses, false);
    });
    
    async function getFacetBytecode(facetNames, facetLibraries, verbose = false) {
      if (verbose) {
        console.log("Starting Bytecode Verification");
      }
      data = [];
      // loop through all facets:
      for (const facet of facetNames) {
        if (verbose) {
          console.log(`Deploying ${facet}`);
        }
    
        // check if facet is in facetLibraries:
        if (facet in facetLibraries) {
          // deploy libraries from facet dictionary:
          for (const [libraryName, address] of Object.entries(facetLibraries[facet])) {
            const libraryFactory = await ethers.getContractFactory(libraryName);
            libraryContract = await libraryFactory.deploy();
            await libraryContract.deployed();
            const bytecode = await ethers.provider.getCode(libraryContract.address);
            await network.provider.send("hardhat_setCode", [address, bytecode]);
          }
        }
    
        // deploy facet:
        const facetFactory = await ethers.getContractFactory(facet, {
          libraries: facetLibraries[facet]
        });
    
        facetContract = await facetFactory.deploy();
        await facetContract.deployed();
    
        const bytecode = await ethers.provider.getCode(facetContract.address);
        // add facet to data dictionary:
        facetData = {};
        facetData[facet] = {
          "Contract Creation Code": facetContract.deployTransaction["data"].slice(2),
          "Deployed Bytecode": bytecode
        };
        data.push(facetData);
      }
    
      // write data to file:
      const facetBytecode = `facetBytecode-${Math.floor(Date.now() / 1000)}-${facetNames.length}-facets.json`;
      fs.writeFileSync(`diamondCuts/${facetBytecode}`, JSON.stringify(data, null, 2));
      console.log(`Facet bytecode written to diamondCuts/${facetBytecode}`);
      return data;
    }
    
    async function compareBytecode(data, deployedFacetAddresses, verbose = true) {
      invalidFacets = [];
      validFacets = [];
      for (const facets of data) {
        const [name] = Object.keys(facets);
        address = deployedFacetAddresses[name];
        const onchainBytecode = await ethers.provider.getCode(address);
        const jsonBytecode = facets[name]["Deployed Bytecode"];
    
        if (onchainBytecode != jsonBytecode) {
          invalidFacets.push(name);
        } else {
          validFacets.push(name);
        }
      }
      if (verbose) {
        console.log("valid facets: ", validFacets);
        console.log("invalid facets: ", invalidFacets);
      }
      if (invalidFacets.length > 0) {
        console.log("Invalid Facet Bytecode: ", invalidFacets);
      } else {
        console.log("All Facets Bytecode are valid!");
      }
    }
  3. Verify that each facet has the correct deployed code by:
  4. Runing an anvil node forked from mainnet:

    anvil --fork-url https://eth.llamarpc.com --chain-id 1337 

    Runing the script in a separate window in the protocol/ directory:

    npx hardhat clean && npx hardhat compile && npx hardhat verifybip-49 --network localhost

    Validate that facet bytecode are correct.

Submitting Message Signature

Once Signers have verified the transaction, they shall submit and sign a verified message on Etherscan with their BCM address (guide).

Template message: Confirming that I have reviewed BIP-49 with BCM transaction nonce 81, Safe transaction hash 0x425d0779ecec50f443f71ed6a43a57121d3f159c19aa8b0599a908cd1f74807b, commit hash 10c50916acdd1a2ea8c3699217779cbbe549389e and Snapshot proposal https://snapshot.org/#/beanstalkdao.eth/proposal/0x6d9816a73f63a122bc19d0e2690fbe744becc18dbeef2a25a39f8a48da1d44d7.