Verified contractExactGPL-3.0
YieldToken
Address0xfc634ed80c3da51404048b6d7dcd9f19e6fba94e
- Balance
0 ETH
- Transactions
399
- Compiler
solc 0.8.24
- Same code
40 more contracts
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- Yes, 1 runs
- EVM version
- cancun
- License
- GPL-3.0
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 22,651,285
- Creation transaction
- 0xaa39ff9d6e…05eb25fe68
53 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/tokens/YieldToken.solmain2.74 KB
- node_modules/@openzeppelin/contracts/utils/Context.sol963 B
- node_modules/@openzeppelin/contracts/utils/Pausable.sol2.83 KB
- node_modules/solady/src/auth/Ownable.sol12.55 KB
- node_modules/solady/src/auth/OwnableRoles.sol25.85 KB
- node_modules/solady/src/tokens/ERC20.sol31.1 KB
- node_modules/solady/src/utils/DateTimeLib.sol20.77 KB
- node_modules/solady/src/utils/DynamicArrayLib.sol37.13 KB
- node_modules/solady/src/utils/ECDSA.sol20.2 KB
- node_modules/solady/src/utils/EfficientHashLib.sol30.17 KB
- node_modules/solady/src/utils/FixedPointMathLib.sol53.62 KB
- node_modules/solady/src/utils/Initializable.sol8.48 KB
- node_modules/solady/src/utils/LibBytes.sol31.31 KB
- node_modules/solady/src/utils/LibClone.sol156.44 KB
- node_modules/solady/src/utils/LibString.sol43.99 KB
- node_modules/solady/src/utils/LibTransient.sol28.56 KB
- node_modules/solady/src/utils/MetadataReaderLib.sol10.34 KB
- node_modules/solady/src/utils/Multicallable.sol5.73 KB
- node_modules/solady/src/utils/ReentrancyGuard.sol2.33 KB
- node_modules/solady/src/utils/SSTORE2.sol12.63 KB
- node_modules/solady/src/utils/SafeCastLib.sol23.8 KB
- node_modules/solady/src/utils/SafeTransferLib.sol29 KB
- node_modules/solady/src/utils/UUPSUpgradeable.sol6.71 KB
- src/Constants.sol762 B
- src/Errors.sol3.51 KB
- src/Events.sol15.68 KB
- src/Factory.sol13.06 KB
- src/Types.sol4.08 KB
- src/interfaces/EIP5095.sol7.45 KB
- src/interfaces/IHook.sol336 B
- src/interfaces/IPoolDeployer.sol286 B
- src/interfaces/IRewardProxy.sol292 B
- src/modules/AccessManager.sol6 KB
- src/modules/BaseModule.sol1.69 KB
- src/modules/FeeModule.sol4.01 KB
- src/modules/VerifierModule.sol3.91 KB
- src/modules/resolvers/VaultInfoResolver.sol562 B
- src/tokens/PrincipalToken.sol50.3 KB
- src/types/ApproxValue.sol206 B
- src/types/FeePcts.sol194 B
- src/types/ModuleIndex.sol679 B
- src/types/Token.sol1.08 KB
- src/types/TwoCrypto.sol200 B
- src/utils/CustomRevert.sol1.13 KB
- src/utils/FeePctsLib.sol2.3 KB
- src/utils/LibApproval.sol1.79 KB
- src/utils/LibBlueprint.sol6.29 KB
- src/utils/LibExpiry.sol500 B
- src/utils/LibRewardProxy.sol2.03 KB
- src/utils/ModuleAccessor.sol1.96 KB
- src/utils/RewardMathLib.sol5.59 KB
- src/utils/TokenNameLib.sol2.37 KB
- src/utils/YieldMathLib.sol10.99 KB
src/tokens/YieldToken.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.24;
import {ERC20} from "solady/src/tokens/ERC20.sol";
import {PrincipalToken} from "./PrincipalToken.sol";
import {TokenNameLib} from "../utils/TokenNameLib.sol";
import {Errors} from "../Errors.sol";
contract YieldToken is ERC20 {
PrincipalToken public immutable i_principalToken;
constructor(address _pt) {
i_principalToken = PrincipalToken(_pt);
}
function name() public view override returns (string memory) {
address underlying = _underlying();
uint256 expiry = _maturity();
return TokenNameLib.yieldTokenName(underlying, expiry);
}
function symbol() public view override returns (string memory) {
address underlying = _underlying();
uint256 expiry = _maturity();
return TokenNameLib.yieldTokenSymbol(underlying, expiry);
}
function decimals() public view override returns (uint8) {
// Same as underlying token decimals
return i_principalToken.decimals();
}
/// @dev No need to call back to PrincipalToken for updating accrued interest. PrincipalToken already does it at this point.
function mint(address to, uint256 amount) external {
if (msg.sender != address(i_principalToken)) revert Errors.YieldToken_OnlyPrincipalToken();
_mint(to, amount);
}
/// @dev No need to call back to PrincipalToken for updating accrued interest. PrincipalToken already does it at this point.
function burn(address from, uint256 amount) public {
if (msg.sender != address(i_principalToken)) revert Errors.YieldToken_OnlyPrincipalToken();
_burn(from, amount);
}
/// @dev YT holders accrue interest since the last update of `from` and `to` balances.
/// Since the last update of `from` and `to` balances, the interest may be accrued by `from` and `to`.
/// So, before updating the balances, we need to record the interest by calling `onYtTransfer`.
function transfer(address to, uint256 amount) public override returns (bool) {
i_principalToken.onYtTransfer(msg.sender, to, balanceOf(msg.sender), balanceOf(to));
return super.transfer(to, amount);
}
/// @dev See {YieldToken-transfer}. The same logic is applied here.
function transferFrom(address from, address to, uint256 amount) public override returns (bool) {
i_principalToken.onYtTransfer(from, to, balanceOf(from), balanceOf(to));
return super.transferFrom(from, to, amount);
}
function _underlying() internal view returns (address) {
return i_principalToken.underlying();
}
function _maturity() internal view returns (uint256) {
return i_principalToken.maturity();
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 1,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
":@openzeppelin/=node_modules/@openzeppelin/",
":forge-std/=node_modules/forge-std/",
":halmos-cheatcodes/=node_modules/halmos-cheatcodes/",
":solady/=node_modules/solady/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.