Verified contractExactBUSL-1.1
BorrowerPayoutLib
Address0x531655e80ee0737978f0fc52e545aa3dd54d1aa9
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.30
- Same code
2 more contracts
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 100 runs
- EVM version
- cancun
- License
- BUSL-1.1
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,459,278
- Creation transaction
- 0xe3d0861425…8b7040e086
2 files
src/libraries/BorrowerPayoutLib.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.30;
import {IComplianceRegistry} from "../interfaces/IComplianceRegistry.sol";
/// @title BorrowerPayoutLib
/// @notice One permanent borrower-payout policy shared by each enforcing proxy.
/// @dev Public functions are linked delegatecalls so ClaimBridge and ReserveManager retain
/// EIP-170 margin. `requireAllowedInternal` is used only inside ReserveCreditLib; keeping
/// that call internal avoids a library-to-library link placeholder.
library BorrowerPayoutLib {
/// @custom:storage-location erc7201:forestroad.storage.BorrowerPayout
struct PayoutStorage {
IComplianceRegistry registry;
}
// keccak256(abi.encode(uint256(keccak256("forestroad.storage.BorrowerPayout")) - 1)) &
// ~bytes32(uint256(0xff))
bytes32 private constant PAYOUT_STORAGE_LOCATION =
0xcc930b8edba69cb0a1dc2a36aaecdb484adbaed2a72b4ed757bcdf5993738500;
error BorrowerPayout_RegistryAlreadySet(address registry);
error BorrowerPayout_InvalidRegistry(address registry);
error BorrowerPayout_RecipientNotAllowed(address recipient);
event BorrowerPayoutRegistrySet(address indexed registry);
/// @notice Permanently binds a compatible registry in the caller proxy's namespace.
/// @return bound The registry address, returned so the delegatecall needs no codeless guard.
function bind(address registry_) public returns (address bound) {
PayoutStorage storage $ = _storage();
address current = address($.registry);
if (current != address(0)) revert BorrowerPayout_RegistryAlreadySet(current);
if (!_isRegistry(registry_)) revert BorrowerPayout_InvalidRegistry(registry_);
$.registry = IComplianceRegistry(registry_);
emit BorrowerPayoutRegistrySet(registry_);
return registry_;
}
/// @notice Returns the registry stored in the caller proxy's namespace.
function registry() public view returns (address) {
return address(_storage().registry);
}
/// @notice Refuses an unbound, revoked or jurisdiction-blocked recipient.
/// @return allowed Always true on success, returned to keep the linked call compact.
function requireAllowed(address recipient) public view returns (bool allowed) {
_requireAllowed(recipient);
return true;
}
/// @dev Inlined into ReserveCreditLib; do not make that library call a second public library.
function requireAllowedInternal(address recipient) internal view {
_requireAllowed(recipient);
}
function _requireAllowed(address recipient) private view {
IComplianceRegistry policy = _storage().registry;
if (address(policy) == address(0) || !policy.isFundingRecipientAllowed(recipient)) {
revert BorrowerPayout_RecipientNotAllowed(recipient);
}
}
function _isRegistry(address registry_) private view returns (bool valid) {
if (registry_.code.length == 0) return false;
(bool ok, bytes memory data) =
registry_.staticcall(abi.encodeCall(IComplianceRegistry.isFundingRecipientAllowed, (address(0))));
if (!ok || data.length != 32) return false;
uint256 word;
assembly ("memory-safe") {
word := mload(add(data, 0x20))
}
return word <= 1;
}
function _storage() private pure returns (PayoutStorage storage $) {
assembly {
$.slot := PAYOUT_STORAGE_LOCATION
}
}
}
src/interfaces/IComplianceRegistry.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.30;
/// @title IComplianceRegistry
/// @notice Compliance capability layer (ADR-0011, as amended by the 2026-07-14 directive):
/// a KYC allowlist consulted ONLY at the mint/redeem primary gate, and a narrow
/// sanctions blocklist consulted on transfers. The per-token transfer-allowlist
/// capability was removed — transfers are permissionless (sanctions-only). Policy
/// (who is eligible/sanctioned) is set by governance/counsel off this interface.
interface IComplianceRegistry {
/// @notice Emitted when an account's KYC allowlist status changes.
event AllowlistUpdated(address indexed account, bool allowed);
/// @notice Emitted when an account's sanctions/jurisdiction-block status changes.
event JurisdictionBlockUpdated(address indexed account, bool blocked);
/// @notice Timelocked governance changed an address's borrower-payout approval.
/// @dev This list is deliberately independent of the operational KYC allowlist.
event FundingRecipientApprovalUpdated(address indexed account, bool approved);
/// @notice True if `account` has passed KYC and may use the gated primary paths
/// (USDfr mint/redeem). Holding and transferring are permissionless.
function isAllowed(address account) external view returns (bool);
/// @notice True if `account` is on the sanctions/jurisdiction blocklist.
function isJurisdictionBlocked(address account) external view returns (bool);
/// @notice True only when timelocked governance approved `account` as a borrower-payout
/// destination and the account is not currently jurisdiction-blocked.
function isFundingRecipientAllowed(address account) external view returns (bool);
/// @notice True for a governance-designated internal protocol module.
function isProtocolExempt(address module) external view returns (bool);
/// @notice Transfer gate consulted by protocol tokens on every transfer. Transfers are
/// permissionless except for sanctioned (blocked) parties; burns are always
/// permitted; protocol modules are never treated as blocked.
/// @param token Retained for interface stability; no longer affects the result.
/// @param from Sender (zero on mint).
/// @param to Recipient (zero on burn).
/// @return True if the transfer may proceed.
function canTransfer(address token, address from, address to) external view returns (bool);
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 100,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"solady/=lib/solady/src/",
"forge-std/=lib/forge-std/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.