Verified contractExactMIT
BurnRecorder
Address0x2a2c4186c906d3b347c86882ad4bd1f2be05579f
- Balance
0 ETH
- Transactions
10
- Compiler
solc 0.8.30
- Same code
Only this contract
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 10,000 runs
- EVM version
- prague
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 24,694,960
- Creation transaction
- 0x9062fca5b6…34b59fe39d
lib/yield-claim-nft/src/BurnRecorder.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {IBurnRecorder} from "./interfaces/IBurnRecorder.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/// @title BurnRecorder
/// @notice A shared recorder for burn events across all burn dispatchers.
/// @dev Provides a unified event log and cumulative burn tracking per token.
/// The tokenIndex mapping simulates an array for enumeration of registered tokens.
contract BurnRecorder is IBurnRecorder, Ownable {
/// @notice Mapping of authorized burner addresses that can record burns.
mapping(address => bool) private _burners;
/// @notice Cumulative amount burned per token address.
mapping(address => uint256) private totalBurnt;
/// @notice Maps an index to a token address for enumeration.
mapping(uint256 => address) private tokenIndex;
/// @notice The number of registered tokens (next available index).
uint256 private _latestIndex;
/// @notice Emitted when a burn is recorded.
/// @param token The address of the token that was burned.
/// @param quantity The amount of tokens burned in this event.
/// @param timestamp The block timestamp when the burn was recorded.
event tokenBurnt(address indexed token, uint256 quantity, uint256 timestamp);
/// @notice Restricts function access to authorized burners.
modifier onlyBurner() {
require(_burners[msg.sender], "BurnRecorder: caller is not burner");
_;
}
/// @param initialOwner The initial owner of this contract.
constructor(address initialOwner) Ownable(initialOwner) {}
/// @notice Sets or revokes an authorized burner address.
/// @param burner_ The address of the burner contract.
/// @param approved_ Whether the address is authorized as a burner.
function setBurner(address burner_, bool approved_) external onlyOwner {
_burners[burner_] = approved_;
}
/// @notice Records a burn event for a given token and amount.
/// @dev Accumulates the total burned for the token and emits a tokenBurnt event.
/// @param token The address of the token that was burned.
/// @param amount The amount of tokens burned.
function burn(address token, uint256 amount) external onlyBurner {
totalBurnt[token] += amount;
emit tokenBurnt(token, amount, block.timestamp);
}
/// @notice Returns the cumulative amount burned for a given token.
/// @param token The address of the token to query.
/// @return The total amount burned for the token.
function getTotalBurnt(address token) public view returns (uint256) {
return totalBurnt[token];
}
/// @notice Registers a token address for enumeration.
/// @dev Only callable by the owner. Adds the token to the tokenIndex mapping.
/// @param token The address of the token to register.
function registerToken(address token) external onlyOwner {
tokenIndex[_latestIndex] = token;
_latestIndex++;
}
/// @notice Returns the number of registered tokens.
/// @return The count of registered tokens.
function getTokenCount() public view returns (uint256) {
return _latestIndex;
}
/// @notice Returns the token address at a given index.
/// @param index The index to query.
/// @return The token address at the given index.
function getTokenAtIndex(uint256 index) public view returns (address) {
return tokenIndex[index];
}
}
lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
lib/yield-claim-nft/src/interfaces/IBurnRecorder.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IBurnRecorder {
/// @notice Records a burn event for a given token and amount.
/// @param token The address of the token that was burned.
/// @param amount The amount of tokens burned.
function burn(address token, uint256 amount) external;
/// @notice Sets or revokes an authorized burner address.
/// @param burner_ The address of the burner contract.
/// @param approved_ Whether the address is authorized as a burner.
function setBurner(address burner_, bool approved_) external;
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 10000,
"enabled": true
},
"evmVersion": "prague",
"remappings": [
"@phlimbo-ea/=lib/phlimbo-ea/src/",
"@phUSD-stable-minter/=lib/phUSD-stable-minter/src/",
"@stable-yield-accumulator/=lib/stable-yield-accumulator/src/",
"@openzeppelin/contracts/=lib/phUSD-stable-minter/lib/openzeppelin-contracts/contracts/",
"@forge-std/=lib/forge-std/src/",
"@vault-interfaces/=lib/vault/src/interfaces/",
"@vault/=lib/vault/src/",
"@pauser/=lib/pauser/src/",
"pauser/=lib/pauser/src/",
"forge-std/=lib/forge-std/src/",
"lib/mutable/pauser/=lib/pauser/",
"vault/interfaces/=lib/vault/src/interfaces/",
"phlimbo-ea/=lib/phlimbo-ea/src/",
"lib/phUSD-stable-minter/lib/mutable/pauser/=lib/pauser/",
"lib/stable-yield-accumulator/lib/mutable/pauser/=lib/pauser/",
"lib/phlimbo-ea/lib/mutable/pauser/=lib/pauser/",
"lib/phUSD-stable-minter/lib/mutable/vault/=lib/vault/",
"openzeppelin-contracts/=lib/phUSD-stable-minter/lib/openzeppelin-contracts/",
"erc4626-tests/=lib/phUSD-stable-minter/lib/openzeppelin-contracts/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/phUSD-stable-minter/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"v4-core/=lib/stable-yield-accumulator/lib/v4-periphery/lib/v4-core/src/",
"v4-periphery/=lib/stable-yield-accumulator/lib/v4-periphery/",
"@uniswap/v4-core/=lib/stable-yield-accumulator/lib/v4-periphery/lib/v4-core/",
"lib/stable-yield-accumulator/lib/openzeppelin-contracts/=lib/stable-yield-accumulator/lib/openzeppelin-contracts/",
"@flax-token/=lib/flax-token-v2/src/",
"yield-claim-nft/=lib/stable-yield-accumulator/lib/mutable/yield-claim-nft/src/",
"@yield-claim-nft/=lib/yield-claim-nft/src/",
"lib/yield-claim-nft/src/interfaces/IBurnable.sol=lib/pauser/src/interfaces/IBurnable.sol"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.