💵

How to Verify Mint Txns

Tags

The BCM can use the init function on the InitMint contract to mint Beans through the diamondCut function, as Beanstalk does not have a native function to mint Beans to a particular address.

InitMint is deployed here:

This InitMint contract has been previously used in BIP-25 and BIP-27.

Table of Contents

Format

diamondCut transactions using InitMint should be formatted like so:

[
	[],
	0x077495925c17230E5e8951443d547ECdbB4925Bb,
	encodedFunctionCall
]
  • _diamondCut is left empty (only if no functions are changed)
  • _init is set to the InitMint address
  • _calldata is set to the encoded function call made to InitMint

Encoding the Function Call

Because the init function call is wrapped in a diamondCut, we need to encode the function calldata.

init has the following signature:

function init(address payee, uint256 amount) external;
  • address payee is the address to mint Beans to
  • uint256 amount is the amount of Beans to mint to the address—since Beans have 6 decimals, the payee amount needs to be multiplied by 1e6 (e.g., 1k beans = 1000000000)

Function calls can be encoded several ways:

  1. Online ABI Encoder
  2. CLI through hardhat

Option 1: Online ABI Encoder

  1. Visit https://abi.hashex.org/.
  2. Click the “Auto-parse” tab.
  3. Paste in the following ABI for InitMint:
  4. [{"inputs":[{"internalType":"address","name":"payee","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"}]
  5. Click “Parse”.
  6. Select init(address,uint256) in the “Function” dropdown.
  7. Enter the corresponding address in the Beans Minted section of the written Snapshot proposal into the payee field.
  8. Enter the corresponding number of Beans in the Beans Minted section of the written Snapshot proposal into the amount field (remember to multiple by 1e6).
  9. Use a site like https://www.diffchecker.com/text-compare/ to compare the encoded call data you generated with the encoded call data in the diamondCut call.
    1. You may need to prepend to encoded data you got from the site with 0x.

Option 2: CLI through hardhat

  1. Clone the Beanstalk repo and make sure MAINNET_RPC in .env is set per 🏗️How to Setup Environment.
  2. Paste the following task into hardhat.config.js in the protocol directory.
  3. task('encodeMint', async function () {
      const payee = '<PAYEE_ADDRESS>'
      const amount = '<PAYEE_AMOUNT>'
      const initMint = await ethers.getContractFactory('InitMint')
      encodedFunctionCall = initMint.interface.encodeFunctionData('init', [payee, amount])
      console.log(encodedFunctionCall)
    })
  4. Set <PAYEE_ADDRESS> the corresponding address in the Beans Minted section of the written Snapshot proposal.
  5. Set <PAYEE_AMOUNT> the corresponding number of Beans in the Beans Minted section of the written Snapshot proposal.
  6. Enter the corresponding number of Beans in the Beans Minted section of the written Snapshot proposal into the amount field (remember to multiple by 1e6).
  7. Run npx hardhat encodeMint from the protocol directory and copy the output in the terminal.
  8. Use a site like https://www.diffchecker.com/text-compare/ to compare the encoded call data you generated with the encoded call data in the diamondCut call.