Verified contractExactMIT
CawProfileLens
Address0x42a1bb0120deaaecc165cc800db4d6ee67b231db
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.30
- Same code
1 more contract
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 1 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,389,009
- Creation transaction
- 0x945d00827f…883268e831
127 files
The source code is large: one file is shown at a time. Choose a file in the list.
- contracts/CawProfileLens.solmain5.15 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/MessageLibBase.sol528 B
- @layerzerolabs/lz-evm-messagelib-v2/contracts/SendLibBase.sol10.51 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/IExecutor.sol1.4 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/IExecutorFeeLib.sol1.66 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/ILayerZeroExecutor.sol1.35 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/ILayerZeroReadExecutor.sol878 B
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/ILayerZeroTreasury.sol442 B
- @layerzerolabs/lz-evm-messagelib-v2/contracts/interfaces/IWorker.sol985 B
- @layerzerolabs/lz-evm-messagelib-v2/contracts/libs/ExecutorOptions.sol4.33 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/libs/SafeCall.sol4.64 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/uln/libs/DVNOptions.sol7.32 KB
- @layerzerolabs/lz-evm-messagelib-v2/contracts/uln/libs/UlnOptions.sol8.48 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OApp.sol1.53 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppCore.sol3.36 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppReceiver.sol5.41 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppSender.sol5.63 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/interfaces/IOAppCore.sol1.86 KB
- @layerzerolabs/lz-evm-oapp-v2/contracts/oapp/interfaces/IOAppReceiver.sol1.08 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/EndpointV2ViewUpgradeable.sol3.44 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/MessagingContext.sol1.48 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol2.59 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol519 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLib.sol805 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLibManager.sol2.76 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingChannel.sol1.54 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingComposer.sol1.03 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingContext.sol239 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ISendLib.sol923 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/AddressCast.sol1.47 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/CalldataBytesLib.sol1.78 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/Errors.sol1.26 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/GUID.sol460 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/libs/Transfer.sol1.12 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/BitMaps.sol751 B
- @layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/ExecutorOptions.sol3.56 KB
- @layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/PacketV1Codec.sol3.67 KB
- @layerzerolabs/oapp-evm/contracts/oapp/OAppCore.sol3.36 KB
- @layerzerolabs/oapp-evm/contracts/oapp/OAppReceiver.sol5.41 KB
- @layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppCore.sol1.86 KB
- @layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppReceiver.sol1.08 KB
- @layerzerolabs/oapp-evm/contracts/oapp/libs/OptionsBuilder.sol9.28 KB
- @layerzerolabs/oft-evm/contracts/libs/OFTMsgCodec.sol2.91 KB
- @layerzerolabs/test-devtools-evm-hardhat/contracts/mocks/EndpointV2Mock.sol27.37 KB
- @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol6.64 KB
- @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol9.38 KB
- @openzeppelin/contracts/access/Ownable.sol2.62 KB
- @openzeppelin/contracts/interfaces/IERC1271.sol666 B
- @openzeppelin/contracts/interfaces/IERC5267.sol738 B
- @openzeppelin/contracts/security/ReentrancyGuard.sol3.13 KB
- @openzeppelin/contracts/token/ERC20/ERC20.sol12.85 KB
- @openzeppelin/contracts/token/ERC20/IERC20.sol2.74 KB
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol683 B
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol3.8 KB
- @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol6.94 KB
- @openzeppelin/contracts/token/ERC721/ERC721.sol17.01 KB
- @openzeppelin/contracts/token/ERC721/IERC721.sol4.88 KB
- @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol987 B
- @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol6.81 KB
- @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol1.02 KB
- @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol761 B
- @openzeppelin/contracts/utils/Address.sol9.36 KB
- @openzeppelin/contracts/utils/Base64.sol3.89 KB
- @openzeppelin/contracts/utils/Context.sol962 B
- @openzeppelin/contracts/utils/ShortStrings.sol4.29 KB
- @openzeppelin/contracts/utils/StorageSlot.sol4.11 KB
- @openzeppelin/contracts/utils/Strings.sol2.78 KB
- @openzeppelin/contracts/utils/cryptography/ECDSA.sol9.13 KB
- @openzeppelin/contracts/utils/cryptography/EIP712.sol5.66 KB
- @openzeppelin/contracts/utils/cryptography/MerkleProof.sol9.62 KB
- @openzeppelin/contracts/utils/cryptography/draft-EIP712.sol231 B
- @openzeppelin/contracts/utils/introspection/ERC165.sol987 B
- @openzeppelin/contracts/utils/introspection/IERC165.sol853 B
- @openzeppelin/contracts/utils/math/Math.sol12.79 KB
- @openzeppelin/contracts/utils/math/SafeCast.sol35.08 KB
- @openzeppelin/contracts/utils/math/SignedMath.sol1.26 KB
- @openzeppelin/contracts/utils/structs/EnumerableSet.sol12.96 KB
- contracts/CawActions.sol92.28 KB
- contracts/CawActionsArchive.sol32.39 KB
- contracts/CawActionsERC1271.sol12.86 KB
- contracts/CawBuyAndBurn.sol4.21 KB
- contracts/CawCapOracle.sol23.98 KB
- contracts/CawChallengeRelay.sol7.85 KB
- contracts/CawFontDataA.sol35.4 KB
- contracts/CawFontDataB.sol23.93 KB
- contracts/CawL1PriceReader.sol5.41 KB
- contracts/CawNetworkManager.sol31.27 KB
- contracts/CawProfile.sol51.56 KB
- contracts/CawProfileLedger.sol57.45 KB
- contracts/CawProfileMarketplace.sol31.78 KB
- contracts/CawProfileMinter.sol38.13 KB
- contracts/CawProfileQuoter.sol18.51 KB
- contracts/CawProfileURI.sol23.3 KB
- contracts/CivicKycVerifier.sol1.01 KB
- contracts/ISwapRouter.sol5.12 KB
- contracts/IZKActionsVerifier.sol565 B
- contracts/MintableCaw.sol969 B
- contracts/MockLayerZeroEndpoint.sol398 B
- contracts/OnlyOnce.sol474 B
- contracts/PathwayExpander.sol9.69 KB
- contracts/SessionMessageParser.sol9.8 KB
- contracts/SigVerification.sol3.98 KB
- contracts/SmartEOA.sol46.05 KB
- contracts/Test.sol175 B
- contracts/examples/CawActionVerifier.sol5.98 KB
- contracts/examples/CawMultisigProfile.sol6.22 KB
- contracts/examples/CawTipResponder.sol6.45 KB
- contracts/interfaces/ICawActions.sol2.08 KB
- contracts/interfaces/ICawCapOracle.sol1.06 KB
- contracts/interfaces/IMint.sol2.04 KB
- contracts/interfaces/ISmartEOA.sol1.11 KB
- contracts/interfaces/ISpend.sol578 B
- contracts/interfaces/IUniswapV2Pair.sol599 B
- contracts/mocks/FeeRecipientMock.sol497 B
- contracts/mocks/LzReceiveHelper.sol1.16 KB
- contracts/mocks/MockContractOwner.sol1.87 KB
- contracts/mocks/MockOAppOwnable.sol576 B
- contracts/mocks/MockSwapRouter.sol1.32 KB
- contracts/sp1-vendor/Groth16Verifier.sol26.77 KB
- contracts/sp1-vendor/ISP1Verifier.sol955 B
- contracts/sp1-vendor/SP1VerifierGroth16.sol3.24 KB
- contracts/test-helpers/CawActionsDigestExposer.sol3.04 KB
- contracts/test-helpers/MockCawActionsCapTarget.sol941 B
- contracts/test-helpers/MockSP1Verifier.sol1.5 KB
- contracts/test/GasMeter.sol1.49 KB
- contracts/test/RevertingBidder.sol728 B
- solidity-bytes-utils/contracts/BytesLib.sol19.44 KB
contracts/CawProfileLens.sol
// contracts/CawProfileLens.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* Minimal subset of CawProfile that the lens needs to read.
*/
interface ICawProfile {
function balanceOf(address owner) external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
function ownerOf(uint256 tokenId) external view returns (address);
function usernames(uint256 index) external view returns (string memory);
function withdrawable(uint32 tokenId) external view returns (uint256);
function authenticated(uint32 networkId, uint32 tokenId) external view returns (bool);
function withdrawFeeLocked(uint32 networkId, uint32 tokenId) external view returns (bool);
function lockedWithdrawFee(uint32 networkId, uint32 tokenId) external view returns (uint256);
function CAW() external view returns (IERC20);
}
interface ICawProfileMinter {
function idByUsername(string memory username) external view returns (uint32);
}
/**
* @title CawProfileLens
* @notice Read-only bulk-query helper for CawProfile. Pairs with CawProfileQuoter
* as the second sibling read-only view contract — `Quoter` answers
* "how much will this tx cost," `Lens` answers "what tokens exist /
* what's their current state." Both exist to keep CawProfile.sol
* under EIP-170.
*
* @dev Three views:
* - `tokens(owner)` — full profile structs for an address (replaces
* the V1 `CawProfile.tokens()` that was removed for bytecode budget)
* - `tokenByUsername(username)` — username → full profile
* - `profilesWithNetworkState(owner, networkId)` — bulk `tokens()`
* plus per-(network,tokenId) auth/lock state
*/
contract CawProfileLens {
struct Token {
uint32 tokenId;
string username;
address owner;
uint256 ownerBalance; // CAW.balanceOf(owner) — same across array
uint256 withdrawable;
}
struct TokenWithNetworkState {
uint32 tokenId;
string username;
address owner;
uint256 ownerBalance;
uint256 withdrawable;
bool authenticated;
bool withdrawFeeLocked;
uint256 lockedWithdrawFee;
}
ICawProfile public immutable cawProfile;
ICawProfileMinter public immutable cawProfileMinter;
constructor(address _cawProfile, address _cawProfileMinter) {
cawProfile = ICawProfile(_cawProfile);
cawProfileMinter = ICawProfileMinter(_cawProfileMinter);
}
/// @notice All profiles owned by `owner` with username, withdrawable, and
/// the owner's CAW balance attached. Single RPC call.
function tokens(address owner) external view returns (Token[] memory result) {
uint256 n = cawProfile.balanceOf(owner);
result = new Token[](n);
if (n == 0) return result;
uint256 ownerBalance = cawProfile.CAW().balanceOf(owner);
for (uint256 i = 0; i < n; i++) {
uint256 tokenId = cawProfile.tokenOfOwnerByIndex(owner, i);
result[i] = Token({
tokenId: uint32(tokenId),
username: cawProfile.usernames(tokenId - 1),
owner: owner,
ownerBalance: ownerBalance,
withdrawable: cawProfile.withdrawable(uint32(tokenId))
});
}
}
/// @notice Look up a profile by its lowercase username. Returns a zeroed
/// struct (tokenId == 0) when no such profile exists.
function tokenByUsername(string memory username) external view returns (Token memory result) {
uint32 tokenId = cawProfileMinter.idByUsername(username);
if (tokenId == 0) return result; // username free / not minted
address owner = cawProfile.ownerOf(tokenId);
result = Token({
tokenId: tokenId,
username: username,
owner: owner,
ownerBalance: cawProfile.CAW().balanceOf(owner),
withdrawable: cawProfile.withdrawable(tokenId)
});
}
/// @notice Same as `tokens(owner)` but also reports the per-(network,tokenId)
/// auth + withdraw-fee-lock state. Useful for any page that needs
/// to know "has this profile authed to network N yet?" without
/// a fan-out of N extra RPC calls.
function profilesWithNetworkState(
address owner,
uint32 networkId
) external view returns (TokenWithNetworkState[] memory result) {
uint256 n = cawProfile.balanceOf(owner);
result = new TokenWithNetworkState[](n);
if (n == 0) return result;
uint256 ownerBalance = cawProfile.CAW().balanceOf(owner);
for (uint256 i = 0; i < n; i++) {
uint32 tokenId = uint32(cawProfile.tokenOfOwnerByIndex(owner, i));
result[i] = TokenWithNetworkState({
tokenId: tokenId,
username: cawProfile.usernames(uint256(tokenId) - 1),
owner: owner,
ownerBalance: ownerBalance,
withdrawable: cawProfile.withdrawable(tokenId),
authenticated: cawProfile.authenticated(networkId, tokenId),
withdrawFeeLocked: cawProfile.withdrawFeeLocked(networkId, tokenId),
lockedWithdrawFee: cawProfile.lockedWithdrawFee(networkId, tokenId)
});
}
}
}
Compiler settingsShow
{
"viaIR": true,
"optimizer": {
"runs": 1,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.