Skip to content
Berry Docs
Berry Press

On-chain contracts

On-chain contracts

Network: Robinhood Chain mainnet, chain id 4663.

Berry keeps one up-to-date list of its contract addresses: GET /api/config. Read them from there every time rather than copying them from a page. An address that does not match it did not come from Berry.

For the deposit factory, always use the depositFactory field of GET /api/config instead of a saved address.

Main functions

IsolatedFactory: createVault(address token, uint256 amount) -> address vault
                 vaultsOf(address creator) -> address[]
Vault:    position() -> (token, amount, open)
          withdraw()                       // creator only
          harvest(uint256 minOut)          // operator or creator
InferenceRouter: creditedOf(address creator) -> uint256   // legacy shared-mode only, lifetime USDG 6dp

Events

VaultCreated(creator, vault, token, amount, id)
Harvested(creator, usdgGross, creatorValue, protocolMargin)
Withdrawn(creator, tokenReturned, quoteReturned)
InferenceCredited(creator, quoteToken, value)

Harvested and InferenceCredited report amounts in USDG with 6 decimals.

Who can call what

  • createVault: any wallet, for supported tokens (anything else reverts with UnsupportedToken)
  • withdraw: only the vault's creator, and it needs no off-chain service
  • press: Berry's operator or the vault's creator; the contract decides where the money goes