Skip to content
ClearClear
Docs
Protocol/CollateralRegistry

CollateralRegistry

Source: contracts/peripherals/CollateralRegistry.sol · Guide: credit · Upgradeable (UUPS proxy)

2 min readUpdated View source

On this page
Network
Chain id
Address
Base Sepolia
84532

Functions that change state

Function
Who can call
Also
grantRole(bytes32 role, address account)
The role's admin role (DEFAULT_ADMIN_ROLE unless set otherwise)
initialize(address admin, address _networkRegistry)
Once, when the proxy is initialised
pledge(address member, bytes32 kind, uint256 amount)
onlyRole(OPERATOR_ROLE)
pledgeItem(address member, bytes32 kind, uint256 itemId)
onlyRole(OPERATOR_ROLE)
recordItemSeizure(address member, bytes32 kind, uint256 itemId)
onlyRole(OPERATOR_ROLE)
recordSeizure(address member, bytes32 kind, uint256 amount)
onlyRole(OPERATOR_ROLE)
refresh(address member)
Checked inside the function
registerCollateralType(bytes32 kind, uint8 backing, uint256 haircutBps, uint256 unitPrice)
onlyRole(OPERATOR_ROLE)
release(address member, bytes32 kind, uint256 amount)
onlyRole(OPERATOR_ROLE)
releaseItem(address member, bytes32 kind, uint256 itemId)
onlyRole(OPERATOR_ROLE)
renounceRole(bytes32 role, address account)
Only the account renouncing its own role
revokeRole(bytes32 role, address account)
The role's admin role (DEFAULT_ADMIN_ROLE unless set otherwise)
rollItem(address member, bytes32 kind, uint256 oldItemId, uint256 newItemId)
onlyRole(ITEM_ROLLER_ROLE)
setClrusdKind(bytes32 kind)
onlyRole(OPERATOR_ROLE)
setCollateralTerms(bytes32 kind, uint256 haircutBps, uint256 unitPrice)
onlyRole(OPERATOR_ROLE)
setCollateralValuer(bytes32 kind, address valuer)
onlyRole(OPERATOR_ROLE)
upgradeTo(address newImplementation)
onlyRole(DEFAULT_ADMIN_ROLE) (via _authorizeUpgrade)
upgradeToAndCall(address newImplementation, bytes data)
onlyRole(DEFAULT_ADMIN_ROLE) (via _authorizeUpgrade)
payable

Read functions

Anyone can call these; they change nothing.

Function
Returns
clrusdKind()
bytes32
collateralKinds()
bytes32[]
collateralTypes(bytes32)
uint8 backing, uint256 haircutBps, uint256 unitPrice, address valuer, bool registered
collateralValueOf(address member, bytes32 kind)
uint256
DEFAULT_ADMIN_ROLE()
bytes32
encumberedOf(address holder)
uint256
encumberedOfKind(address holder, bytes32 kind)
uint256
exposureOf(address member)
uint256 exposure
freeCollateralOf(address member, bytes32 kind)
uint256
getRoleAdmin(bytes32 role)
bytes32
hasRole(bytes32 role, address account)
bool
isItemEncumbered(address holder, bytes32 kind, uint256 itemId)
bool
ITEM_ROLLER_ROLE()
bytes32
networkRegistry()
address
OPERATOR_ROLE()
bytes32
pledgedItemsOf(address member, bytes32 kind)
uint256[]
pledgedOf(address, bytes32)
uint256
poolExposure()
uint256
PRICE_SCALE()
uint256
proxiableUUID()
bytes32
recordedExposureOf(address)
uint256
supportsInterface(bytes4 interfaceId)
bool
totalExposure()
uint256

Events

Event
AdminChanged(address previousAdmin, address newAdmin)
BeaconUpgraded(address beacon indexed)
ClrusdKindUpdated(bytes32 kind indexed)
CollateralTypeRegistered(bytes32 kind indexed, uint8 backing, uint256 haircutBps)
CollateralTypeUpdated(bytes32 kind indexed, uint256 haircutBps, uint256 unitPrice)
CollateralValuerUpdated(bytes32 kind indexed, address valuer)
ExposureRefreshed(address member indexed, uint256 previous, uint256 current)
Initialized(uint8 version)
ItemPledged(address member indexed, bytes32 kind indexed, uint256 itemId)
ItemReleased(address member indexed, bytes32 kind indexed, uint256 itemId)
ItemRolled(address member indexed, bytes32 kind indexed, uint256 oldItemId, uint256 newItemId)
ItemSeized(address member indexed, bytes32 kind indexed, uint256 itemId)
Pledged(address member indexed, bytes32 kind indexed, uint256 amount)
Released(address member indexed, bytes32 kind indexed, uint256 amount)
RoleAdminChanged(bytes32 role indexed, bytes32 previousAdminRole indexed, bytes32 newAdminRole indexed)
RoleGranted(bytes32 role indexed, address account indexed, address sender indexed)
RoleRevoked(bytes32 role indexed, address account indexed, address sender indexed)
Seized(address member indexed, bytes32 kind indexed, uint256 amount)
Upgraded(address implementation indexed)

Errors

Error
CollateralRegistryEncumbered(address member, bytes32 kind, uint256 free, uint256 amount)
CollateralRegistryHaircutTooHigh(uint256 haircutBps)
CollateralRegistryInvalidAddress()
CollateralRegistryTypeExists(bytes32 kind)
CollateralRegistryUnknownType(bytes32 kind)
InvalidHaircut(uint256 haircutBps)