Skip to content
ClearClear
Docs
Protocol/CollateralAgent

CollateralAgent

Source: contracts/peripherals/CollateralAgent.sol · Upgradeable (UUPS proxy)

3 min readView source

On this page
Network
Chain id
Address
Base Sepolia
84532

Functions that change state

Function
Who can call
Also
approveChange(bytes32 changeId)
onlyAgent
approveReplacement(uint256 id)
onlyRole(TREASURY_ROLE)
cancelChange(bytes32 changeId)
onlyRole(TREASURY_ROLE)
cancelReplacement(uint256 id)
onlyRole(TREASURY_ROLE)
claimDistribution(uint256 bondId)
Anyone
confirmChange(bytes32 changeId)
onlyRole(TREASURY_ROLE)
consumeChange(bytes32 callHash)
Checked inside the function
enforce(uint8 reasonCode, bytes32 noticeHash)
onlyAgent
executeExcessWithdrawal(uint256 id)
onlyRole(TREASURY_ROLE)
executeReplacement(uint256 id)
Checked inside the function
grantRole(bytes32 role, address account)
Checked inside the function
initialize(address admin, address agentKey_, address[] treasurySigners, uint8 decimals_, (address,address,address,address,address,address,address) config)
Once, when the proxy is initialised
postCostStatement(bytes32 statementHash, uint256 amount)
onlyAgent
inEnforcement
postDistribution(uint256 amount, uint256 roundId)
onlyAgent
inEnforcement
proposeChange(address target, bytes32 callHash, bytes32 descriptionHash)
onlyRole(TREASURY_ROLE)
proposeExcessWithdrawal(uint256 amount)
onlyRole(TREASURY_ROLE)
proposeReplacement(uint8 kind, address newAddress, bytes32 instructionHash)
onlyRole(TREASURY_ROLE)
recordCostApproval(bytes32 directionHash, uint256 amount)
Anyone
inEnforcement
recordHolderBlock(uint256 id, bytes32 directionHash)
Checked inside the function
releaseEnforcement(bytes32 directionHash)
onlyAgent
inEnforcement
renounceRole(bytes32 role, address account)
Only the account renouncing its own role
revokeRole(bytes32 role, address account)
Checked inside the function
rotateAgentKey(address newKey)
onlyAgent
setBondBook(address b)
onlyRole(DEFAULT_ADMIN_ROLE)
setCostAddress(address a)
onlyRole(DEFAULT_ADMIN_ROLE)
setExcessDestination(address a)
onlyRole(DEFAULT_ADMIN_ROLE)
setHolderDirections(address d)
onlyRole(DEFAULT_ADMIN_ROLE)
setPayeeSource(address s)
onlyRole(DEFAULT_ADMIN_ROLE)
setPledgeModule(address m)
onlyRole(DEFAULT_ADMIN_ROLE)
setVault(address v)
onlyRole(DEFAULT_ADMIN_ROLE)
snapshotBonds(uint256 maxCount)
Anyone
inEnforcement
syncAgentKey()
Anyone
toCollateralAccount(uint256 amount)
onlyAgent
inEnforcement
upgradeTo(address newImplementation)
onlyRole(DEFAULT_ADMIN_ROLE) (via _authorizeUpgrade)
upgradeToAndCall(address newImplementation, bytes data)
onlyRole(DEFAULT_ADMIN_ROLE) (via _authorizeUpgrade)
payable
withdrawCosts(uint256 amount, bytes32 statementHash)
onlyAgent
inEnforcement

Read functions

Anyone can call these; they change nothing.

Function
Returns
agentKey()
address
bondBook()
address
CHANGE_DELAY()
uint64
change(bytes32 changeId)
(address,bytes32,bytes32,address,address,uint64,uint64,bool,uint8)
claimable(uint256 bondId)
uint256 owed
collateralAccount()
address
COST_APPROVAL_WAIT()
uint64
COST_CAP_BPS()
uint256
COST_FLOOR_DOLLARS()
uint256
costAddress()
address
costCap()
uint256
DEFAULT_ADMIN_ROLE()
bytes32
dueOf(uint32 periodId, uint256 bondId)
uint256 due, uint256 claimed, uint256 entitled
enforcementInForce()
bool
excessCount()
uint256
excessDestination()
address
excessWithdrawal(uint256 id)
(uint256,address,bool)
getRoleAdmin(bytes32 role)
bytes32
hasRole(bytes32 role, address account)
bool
holderDirections()
address
openChangeFor(address target, bytes32 callHash)
bytes32
paidOn(uint256)
uint256
payeeSource()
address
pendingAgentKey()
address next, uint64 effectiveAt
period(uint32 id)
(uint64,uint64,uint8,bool,bytes32,bytes32,uint256,uint256,uint256,uint256,uint256,uint256,uint256)
periodCount()
uint32
pledgeModule()
address
proxiableUUID()
bytes32
REPLACE_AGENT_KEY()
uint8
REPLACE_COLLATERAL_ACCOUNT()
uint8
REPLACEMENT_DELAY()
uint64
replacement(uint256 id)
(uint8,uint8,uint64,address,address,bytes32,bytes32)
replacementCount()
uint256
ROTATION_DELAY()
uint64
round(uint256 roundId)
(uint32,uint64,uint256)
roundCount()
uint256
roundIdAt(uint256 i)
uint256
routeDistribution(uint256 bondId, address holder, uint256 amount)
uint256 toDebt, uint256 toHolder
STATEMENT_WAIT()
uint64
statement(bytes32 statementHash)
(uint32,uint64,uint256,uint256)
supportsInterface(bytes4 interfaceId)
bool
TREASURY_ROLE()
bytes32
unclaimedDistributions()
uint256
unit()
uint256
vault()
address

Events

Event
AdminChanged(address previousAdmin, address newAdmin)
AgentKeyRotated(address previous indexed, address next indexed)
AgentKeyRotationCancelled(address current indexed, address abandoned indexed)
AgentKeyRotationStarted(address current indexed, address next indexed, uint64 effectiveAt)
BeaconUpgraded(address beacon indexed)
BondPaidInFull(uint256 bondId indexed, uint256 paid)
ChangeApproved(bytes32 changeId indexed, address agentKey)
ChangeCancelled(bytes32 changeId indexed, address by)
ChangeConfirmed(bytes32 changeId indexed, address confirmer, uint64 executableAt)
ChangeExecuted(bytes32 changeId indexed, address target indexed, bytes32 callHash)
ChangeProposed(bytes32 changeId indexed, address target indexed, bytes32 callHash, bytes32 descriptionHash, address proposer)
CollateralAccountTransfer(uint32 period indexed, address account indexed, uint256 amount)
ConfigSet(bytes32 what indexed, address value)
CostApprovalRecorded(uint32 period indexed, bytes32 directionHash indexed, uint256 amount, uint64 effectiveAt)
CostStatementPosted(uint32 period indexed, bytes32 statementHash indexed, uint256 amount, uint64 withdrawableAt)
CostsWithdrawn(uint32 period indexed, bytes32 statementHash indexed, address to indexed, uint256 amount, uint256 cap)
DistributionPaid(uint256 bondId indexed, address holder indexed, address payee indexed, uint256 toDebt, uint256 toHolder)
DistributionPosted(uint32 period indexed, uint256 roundId indexed, uint256 amount, uint256 index)
EnforcementNoticeRecorded(uint32 period indexed, uint8 reasonCode, bytes32 noticeHash, uint256 collateralAtStart)
EnforcementReleased(uint32 period indexed, bytes32 directionHash)
ExcessWithdrawalProposed(uint256 id indexed, uint256 amount, address proposer)
ExcessWithdrawn(uint256 id indexed, address to indexed, uint256 amount, address proposer, address executor)
Initialized(uint8 version)
ReplacementApproved(uint256 id indexed, address approver, uint64 effectiveAt)
ReplacementBlocked(uint256 id indexed, bytes32 directionHash, address recordedBy)
ReplacementCancelled(uint256 id indexed, address by)
ReplacementExecuted(uint256 id indexed, uint8 kind, address previous, address next)
ReplacementProposed(uint256 id indexed, uint8 kind, address newAddress, bytes32 instructionHash, address proposer)
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)
SnapshotTaken(uint32 period indexed, uint256 bonds, uint256 totalDue, bool complete)
Upgraded(address implementation indexed)

Errors

Error
CollateralAgentChange(bytes32 changeId)
CollateralAgentChangeNotReady(address target, bytes32 callHash)
CollateralAgentCostCap(uint256 withdrawn, uint256 adding, uint256 cap)
CollateralAgentExcess(uint256 id)
CollateralAgentInForce()
CollateralAgentInsufficient(uint256 available, uint256 needed)
CollateralAgentInvalidValue()
CollateralAgentNotAgent(address caller)
CollateralAgentNothingOwed(uint256 bondId)
CollateralAgentNotInForce()
CollateralAgentOverDistributed(uint256 distributed, uint256 adding, uint256 totalDue)
CollateralAgentReplacement(uint256 id)
CollateralAgentRoundExists(uint256 roundId)
CollateralAgentSameSigner(address signer)
CollateralAgentSnapshotDone()
CollateralAgentSnapshotIncomplete()
CollateralAgentStatement(bytes32 statementHash)