BeanstalkFarms/Beanstalk

RFC: ERC1155 Deposits

Closed this issue · 0 comments

Brean0 commented

Summary

Improve Beanstalk EVM integration by revising beanstalk deposits to conform to the ERC1155 standard.

Problem

Currently, beanstalk native assets (deposits and pods) do not conform to any ERC standard. This limits composability within DeFi, and adds additional developer overhead when developing on top of beanstalk, as beanstalk-specific functionally has to be added (For example, Depot has `transferDeposit(s)).

Proposed Solution

  • Represent Beanstalk Deposits as an ERC1155 standard. ERC20s cannot work, as an ERC20 would need to be deployed for every new deposit, and ERC721 does not support fungibility within a given id.
  • ERC1155s support an id and value. For a Beanstalk Deposit, an id is the concatenation of the asset address (20 bytes) , and the stem of the deposit (12 bytes).
  • Introduce a MetadataFacet, which contains on-chain metadata for an given ERC1155.

Specification

  • introduce a mapping mapping(bytes32 => Deposit) deposits
  • add ERC1155 events to Deposit deposits, withdraws, and transfers.
  • add 0xd9b67a26 to the ERC-165 supportsInterface array.