Verified contractPartial
LexScrowStorage
Address0xe06006ddcc4ff20aacff20906f56d9893124d49d
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 15 runs
- EVM version
- prague
- Via IR
- yes
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,300,440
- Creation transaction
- 0xfd968870ee…777fc1c7be
- Libraries
- src/CyberAgreementRegistry.sol:CyberAgreementJson0x7ccd…ec9e8esrc/CyberAgreementRegistry.sol:CyberAgreementBound0xe878…e93415src/storage/LexScrowStorage.sol:LexScrowStorage0xe060…24d49dsrc/creds/LeXcheXBadgeRender.sol:LeXcheXBadgeRender0xb62c…5c99a2src/storage/DealManagerStorage.sol:DealManagerStorage0x1745…aee644src/storage/RoundManagerStorage.sol:RoundManagerStorage0xfdb8…aa3813src/storage/SecondaryTradeStorage.sol:SecondaryTradeStorage0xe658…520e86src/CertificateImageContentBuilder.sol:CertificateImageContentBuilder0xf73c…eb4c1dsrc/storage/IssuanceManagerStorage.sol:IssuanceManagerStorage0xbc28…e1220csrc/storage/LedgerEntryTokenStorage.sol:LedgerEntryTokenStorage0xe720…5c4a05src/storage/extensions/ShareCertDataLayerLib.sol:ShareCertDataLayerLib0x7802…70468c
17 files
- src/storage/LexScrowStorage.solmain20.3 KB
- dependencies/openzeppelin-contracts/contracts/interfaces/IERC1363.sol4.45 KB
- dependencies/openzeppelin-contracts/contracts/interfaces/IERC165.sol192 B
- dependencies/openzeppelin-contracts/contracts/interfaces/IERC20.sol181 B
- dependencies/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol4.75 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol10.08 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol4.93 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Enumerable.sol1.04 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol792 B
- dependencies/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol870 B
- src/CyberCorpConstants.sol6.63 KB
- src/interfaces/ICondition.sol3.85 KB
- src/interfaces/ICyberAgreementRegistry.sol7.81 KB
- src/interfaces/ICyberCorp.sol5.86 KB
- src/interfaces/ILedgerEntryToken.sol15.73 KB
- src/interfaces/ILexScrowStorage.sol3.4 KB
src/storage/LexScrowStorage.sol
/* .o.
.888.
.8"888.
.8' `888.
.88ooo8888.
.8' `888.
o88o o8888o
ooo ooooo . ooooo ooooooo ooooo
`88. .888' .o8 `888' `8888 d8'
888b d'888 .ooooo. .o888oo .oooo. 888 .ooooo. Y888..8P
8 Y88. .P 888 d88' `88b 888 `P )88b 888 d88' `88b `8888'
8 `888' 888 888ooo888 888 .oP"888 888 888ooo888 .8PY888.
8 Y 888 888 .o 888 . d8( 888 888 o 888 .o d8' `888b
o8o o888o `Y8bod8P' "888" `Y888""8o o888ooooood8 `Y8bod8P' o888o o88888o
.oooooo. .o8 .oooooo.
d8P' `Y8b "888 d8P' `Y8b
888 oooo ooo 888oooo. .ooooo. oooo d8b 888 .ooooo. oooo d8b oo.ooooo.
888 `88. .8' d88' `88b d88' `88b `888""8P 888 d88' `88b `888""8P 888' `88b
888 `88..8' 888 888 888ooo888 888 888 888 888 888 888 888
`88b ooo `888' 888 888 888 .o 888 `88b ooo 888 888 888 888 888 .o.
`Y8bood8P' .8' `Y8bod8P' `Y8bod8P' d888b `Y8bood8P' `Y8bod8P' d888b 888bod8P' Y8P
.o..P' 888
`Y8P' o888o
_______________________________________________________________________________________________________
All software, documentation and other files and information in this repository (collectively, the "Software")
are copyright MetaLeX Labs, Inc., a Delaware corporation.
All rights reserved.
The Software is proprietary and shall not, in part or in whole, be used, copied, modified, merged, published,
distributed, transmitted, sublicensed, sold, or otherwise used in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage and retrieval system,
except with the express prior written permission of the copyright holder.*/
pragma solidity 0.8.28;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "../interfaces/ICyberCorp.sol";
import "../interfaces/ICyberAgreementRegistry.sol";
import "../interfaces/ILedgerEntryToken.sol";
import "../interfaces/ICondition.sol";
import {ILexScrowStorage} from "../interfaces/ILexScrowStorage.sol";
enum TokenType {
ERC20,
ERC721,
ERC1155
}
enum EscrowStatus {
PENDING,
PAID,
FINALIZED,
VOIDED
}
struct Token {
TokenType tokenType;
address tokenAddress;
uint256 tokenId;
uint256 amount;
bool isFee;
}
struct Escrow {
bytes32 agreementId;
address counterParty;
Token[] corpAssets;
Token[] buyerAssets;
bytes signature;
uint256 expiry;
EscrowStatus status;
}
/// @notice Escrow subsystem: storage layout plus the shared escrow logic, deployed once and linked
/// into managers (DealManager / RoundManager) that DELEGATECALL into it (msg.sender / storage /
/// address(this) preserved). Internal storage helpers are inlined; the shared escrow ops are `public`
/// so they are linked + delegatecalled (on-chain dedup). Fee resolution is delegated back to the
/// calling manager via `ILexScrowStorage(address(this))` so each manager keeps its own fee logic.
library LexScrowStorage {
using SafeERC20 for IERC20;
error DealExpired();
error EscrowNotPending();
error EscrowNotPaid();
error CounterPartyNotSet();
error DealNotFullySigned();
error DealNotFinalized();
error DealAlreadyFinalized();
error DealNotVoided();
error DealNotPaid();
error DealVoided();
error DealDoesNotExist();
error TokenTransferMismatch(address token, uint256 expected, uint256 received);
event DealVoidedAt(bytes32 indexed agreementId, address agreementRegistry, uint256 timestamp);
event DealPaidAt(bytes32 indexed agreementId, address agreementRegistry, uint256 timestamp);
event DealFinalizedAt(bytes32 indexed agreementId, address agreementRegistry, uint256 timestamp);
event FeeDistributed(bytes32 indexed agreementId, address indexed feeToken, uint256 totalFe);
// Storage slot for our struct
bytes32 constant STORAGE_POSITION = keccak256("cybercorp.lexscrow.storage.v1");
// Main storage layout struct
struct LexScrowData {
address CORP;
address DEAL_REGISTRY;
mapping(bytes32 => Escrow) escrows;
mapping(bytes32 => ICondition[]) conditionsByEscrow;
}
// Returns the storage layout
function lexScrowStorage() internal pure returns (LexScrowData storage ds) {
bytes32 position = STORAGE_POSITION;
assembly {
ds.slot := position
}
}
// Getters
function getCorp() internal view returns (address) {
return lexScrowStorage().CORP;
}
function getDealRegistry() internal view returns (address) {
return lexScrowStorage().DEAL_REGISTRY;
}
function getEscrow(bytes32 agreementId) internal view returns (Escrow storage) {
return lexScrowStorage().escrows[agreementId];
}
function hasPrimaryEscrow(bytes32 agreementId) internal view returns (bool) {
return lexScrowStorage().escrows[agreementId].agreementId != bytes32(0);
}
function getConditionsByEscrow(bytes32 agreementId) internal view returns (ICondition[] storage) {
return lexScrowStorage().conditionsByEscrow[agreementId];
}
// Setters
function setCorp(address _corp) internal {
lexScrowStorage().CORP = _corp;
}
function setDealRegistry(address _dealRegistry) internal {
lexScrowStorage().DEAL_REGISTRY = _dealRegistry;
}
function setEscrow(bytes32 agreementId, Escrow memory escrow) internal {
lexScrowStorage().escrows[agreementId] = escrow;
}
function addConditionToEscrow(bytes32 agreementId, ICondition condition) internal {
lexScrowStorage().conditionsByEscrow[agreementId].push(condition);
}
function removeConditionFromEscrow(bytes32 agreementId, uint256 index) internal {
ICondition[] storage conditions = lexScrowStorage().conditionsByEscrow[agreementId];
require(index < conditions.length, "Index out of bounds");
for (uint i = index; i < conditions.length - 1; i++) {
conditions[i] = conditions[i + 1];
}
conditions.pop();
}
/// @notice Create a new escrow record for an agreement
/// @param agreementId Unique identifier of the agreement
/// @param counterParty Counterparty/buyer address
/// @param corpAssets Assets the company will deliver upon finalization
/// @param buyerAssets Assets the counterparty will deliver into escrow
/// @param expiry Unix timestamp after which the deal is considered expired (0 = no deadline)
function createEscrow(bytes32 agreementId, address counterParty, Token[] memory corpAssets, Token[] memory buyerAssets, uint256 expiry) public {
bytes memory blankSignature = abi.encodePacked(bytes32(0));
Escrow memory newEscrow = Escrow({
agreementId: agreementId,
counterParty: counterParty,
corpAssets: corpAssets,
buyerAssets: buyerAssets,
signature: blankSignature,
expiry: expiry,
status: EscrowStatus.PENDING
});
setEscrow(agreementId, newEscrow);
}
/// @notice Update escrow counterparty and add endorsement to corp ERC721 certificates
/// @param agreementId Unique identifier of the agreement
/// @param counterParty Counterparty/buyer address to set
/// @param buyerName Human-readable buyer name stored in endorsements
function updateEscrow(bytes32 agreementId, address counterParty, string memory buyerName) public {
Escrow storage escrow = getEscrow(agreementId);
escrow.counterParty = counterParty;
Endorsement memory newEndorsement = Endorsement(
address(this),
block.timestamp,
escrow.signature,
getDealRegistry(),
agreementId,
escrow.counterParty,
buyerName
);
for(uint256 i = 0; i < escrow.corpAssets.length; i++) {
if(escrow.corpAssets[i].tokenType == TokenType.ERC721) {
ILedgerEntryToken(escrow.corpAssets[i].tokenAddress).addEndorsement(escrow.corpAssets[i].tokenId, newEndorsement);
// check if there is an escrowed officer signature in cybercorp
bytes memory officerSignature = "";
address corp = getCorp();
try ICyberCorp(corp).getEscrowedOfficerSignatureCount() returns (
uint256 count
) {
if (count > 0) {
try ICyberCorp(corp).getEscrowedOfficerSignature(0) returns (bytes memory sig) {
officerSignature = sig;
} catch {}
}
} catch {}
if (officerSignature.length > 0) {
ILedgerEntryToken(escrow.corpAssets[i].tokenAddress).addIssuerSignature(
escrow.corpAssets[i].tokenId,
officerSignature
);
}
}
}
}
/// @notice Pull `amount` of `token` into custody, requiring the full amount to land
/// @dev Custody is pooled across every escrow in a manager and payouts pay recorded amounts, so a token
/// whose delivered amount differs from the requested one (fee-on-transfer, rebasing) would desync custody
/// from the books — funding a shortfall out of co-depositors' balances, or wedging refunds that can no
/// longer be covered. Requiring an exact match keeps the recorded amount and the received amount identical
/// everywhere downstream.
/// @param token ERC20 being pulled
/// @param from Address the tokens are pulled from
/// @param amount Exact amount that must land in custody
function pullExact(address token, address from, uint256 amount) internal {
uint256 balanceBefore = IERC20(token).balanceOf(address(this));
IERC20(token).safeTransferFrom(from, address(this), amount);
uint256 received = IERC20(token).balanceOf(address(this)) - balanceBefore;
if (received != amount) revert TokenTransferMismatch(token, amount, received);
}
/// @notice Pull buyer assets into escrow and mark the escrow as PAID
/// @param agreementId Unique identifier of the agreement
function handleCounterPartyPayment(bytes32 agreementId) public {
Escrow storage escrow = getEscrow(agreementId);
if(escrow.status != EscrowStatus.PENDING) revert EscrowNotPending();
if(escrow.counterParty == address(0)) revert CounterPartyNotSet();
for(uint256 i = 0; i < escrow.buyerAssets.length; i++) {
if(escrow.buyerAssets[i].tokenType == TokenType.ERC20) {
pullExact(escrow.buyerAssets[i].tokenAddress, escrow.counterParty, escrow.buyerAssets[i].amount);
}
else if(escrow.buyerAssets[i].tokenType == TokenType.ERC721) {
IERC721(escrow.buyerAssets[i].tokenAddress).safeTransferFrom(escrow.counterParty, address(this), escrow.buyerAssets[i].tokenId);
}
else if(escrow.buyerAssets[i].tokenType == TokenType.ERC1155) {
IERC1155(escrow.buyerAssets[i].tokenAddress).safeTransferFrom(escrow.counterParty, address(this), escrow.buyerAssets[i].tokenId, escrow.buyerAssets[i].amount, "");
}
}
emit DealPaidAt(agreementId, getDealRegistry(), block.timestamp);
escrow.status = EscrowStatus.PAID;
}
/// @notice Void a PAID escrow and refund all buyer assets
/// @dev External callers should implement reentrancy guards
/// @param agreementId Unique identifier of the agreement
function voidAndRefund(bytes32 agreementId) public {
// Check: check status
Escrow storage escrow = getEscrow(agreementId);
if(escrow.status != EscrowStatus.PAID) revert EscrowNotPaid();
if(!ICyberAgreementRegistry(getDealRegistry()).isVoided(agreementId)) revert DealNotVoided();
// Effect: update status
voidEscrow(agreementId);
// Interaction: Refund buyer assets
for(uint256 i = 0; i < escrow.buyerAssets.length; i++) {
if(escrow.buyerAssets[i].tokenType == TokenType.ERC20) {
IERC20(escrow.buyerAssets[i].tokenAddress).safeTransfer(escrow.counterParty, escrow.buyerAssets[i].amount);
}
else if(escrow.buyerAssets[i].tokenType == TokenType.ERC721) {
IERC721(escrow.buyerAssets[i].tokenAddress).safeTransferFrom(address(this), escrow.counterParty, escrow.buyerAssets[i].tokenId);
}
else if(escrow.buyerAssets[i].tokenType == TokenType.ERC1155) {
IERC1155(escrow.buyerAssets[i].tokenAddress).safeTransferFrom(address(this), escrow.counterParty, escrow.buyerAssets[i].tokenId, escrow.buyerAssets[i].amount, "");
}
}
}
/// @notice Finalize a PAID escrow, transferring assets and distributing any fees
/// @dev External callers should implement reentrancy guards
/// @param agreementId Unique identifier of the agreement
function finalizeEscrow(bytes32 agreementId) public {
Escrow storage escrow = getEscrow(agreementId);
// Check: Check all conditions before proceeding
// expiry == 0 means no deadline (same rule as the registry and voidExpiredDeal)
if(escrow.expiry > 0 && block.timestamp > escrow.expiry) revert DealExpired();
if(escrow.status != EscrowStatus.PAID) revert EscrowNotPaid();
// Effect: Update state before external calls
escrow.status = EscrowStatus.FINALIZED;
emit DealFinalizedAt(agreementId, getDealRegistry(), block.timestamp);
// Interaction: Transfer buyer assets to company and collect fees
for(uint256 i = 0; i < escrow.buyerAssets.length; i++) {
if(escrow.buyerAssets[i].tokenType == TokenType.ERC20) {
uint256 amountToCompany = escrow.buyerAssets[i].amount;
uint256 fee = 0;
// Check: if the asset is fee token
if (escrow.buyerAssets[i].isFee) {
// Effect: Calculate fees. Fee logic lives on the calling manager (DealManager /
// RoundManager) — call it back via ILexScrowStorage(address(this)) under delegatecall.
fee = ILexScrowStorage(address(this)).computeFee(escrow.buyerAssets[i].amount);
amountToCompany -= fee;
emit FeeDistributed(agreementId, escrow.buyerAssets[i].tokenAddress, fee);
}
// Interaction: Distribute payment and fees
if (amountToCompany > 0) {
IERC20(escrow.buyerAssets[i].tokenAddress).safeTransfer(ICyberCorp(getCorp()).companyPayable(), amountToCompany);
}
if (fee > 0) {
IERC20(escrow.buyerAssets[i].tokenAddress).safeTransfer(ILexScrowStorage(address(this)).getPlatformPayable(), fee);
}
}
else if(escrow.buyerAssets[i].tokenType == TokenType.ERC721) {
IERC721(escrow.buyerAssets[i].tokenAddress).safeTransferFrom(address(this), ICyberCorp(getCorp()).companyPayable(), escrow.buyerAssets[i].tokenId);
}
else if(escrow.buyerAssets[i].tokenType == TokenType.ERC1155) {
IERC1155(escrow.buyerAssets[i].tokenAddress).safeTransferFrom(address(this), ICyberCorp(getCorp()).companyPayable(), escrow.buyerAssets[i].tokenId, escrow.buyerAssets[i].amount, "");
}
}
// Interaction: Transfer corp assets to counter party
for(uint256 i = 0; i < escrow.corpAssets.length; i++) {
if(escrow.corpAssets[i].tokenType == TokenType.ERC20) {
IERC20(escrow.corpAssets[i].tokenAddress).safeTransfer(escrow.counterParty, escrow.corpAssets[i].amount);
}
else if(escrow.corpAssets[i].tokenType == TokenType.ERC721) {
IERC721(escrow.corpAssets[i].tokenAddress).safeTransferFrom(address(this), escrow.counterParty, escrow.corpAssets[i].tokenId);
}
else if(escrow.corpAssets[i].tokenType == TokenType.ERC1155) {
IERC1155(escrow.corpAssets[i].tokenAddress).safeTransferFrom(address(this), escrow.counterParty, escrow.corpAssets[i].tokenId, escrow.corpAssets[i].amount, "");
}
}
}
/// @notice Check all conditions attached to the escrow for the given agreement
/// @param agreementId Unique identifier of the agreement
/// @return True if all conditions pass, false otherwise
function conditionCheck(bytes32 agreementId) public view returns (bool) {
ICondition[] storage conditions = getConditionsByEscrow(agreementId);
//convert bytes32 to bytes
bytes memory agreementIdBytes = abi.encodePacked(agreementId);
for(uint256 i = 0; i < conditions.length; i++) {
if(!ICondition(conditions[i]).checkCondition(address(this), msg.sig, agreementIdBytes))
return false;
}
return true;
}
/// @notice Mark an escrow as VOIDED and emit an event
/// @param agreementId Unique identifier of the agreement
function voidEscrow(bytes32 agreementId) public {
Escrow storage escrow = getEscrow(agreementId);
escrow.status = EscrowStatus.VOIDED;
emit DealVoidedAt(agreementId, getDealRegistry(), block.timestamp);
}
/// @notice Get escrow details for a given agreement id
/// @param agreementId Unique identifier of the agreement
/// @return Escrow struct containing current state
function getEscrowDetails(bytes32 agreementId) public view returns (Escrow memory) {
return getEscrow(agreementId);
}
// NOTE: fee resolution (computeFee / getPlatformPayable) is not declared here. As a library it
// cannot have overridable virtuals, so finalizeEscrow calls back into the manager via
// ILexScrowStorage(address(this)). The ERC721/ERC1155 receiver hooks live on the managers, since a
// library cannot expose externally-callable contract functions.
}dependencies/openzeppelin-contracts/contracts/interfaces/IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
dependencies/openzeppelin-contracts/contracts/interfaces/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
dependencies/openzeppelin-contracts/contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";
dependencies/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC-1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[ERC].
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the value of tokens of token type `id` owned by `account`.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the zero address.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155Received} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155BatchReceived} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}
dependencies/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
dependencies/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}
dependencies/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC-721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC-721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
* {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
dependencies/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.20;
import {IERC721} from "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
dependencies/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.20;
import {IERC721} from "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
dependencies/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
src/CyberCorpConstants.sol
/* .o.
.888.
.8"888.
.8' `888.
.88ooo8888.
.8' `888.
o88o o8888o
ooo ooooo . ooooo ooooooo ooooo
`88. .888' .o8 `888' `8888 d8'
888b d'888 .ooooo. .o888oo .oooo. 888 .ooooo. Y888..8P
8 Y88. .P 888 d88' `88b 888 `P )88b 888 d88' `88b `8888'
8 `888' 888 888ooo888 888 .oP"888 888 888ooo888 .8PY888.
8 Y 888 888 .o 888 . d8( 888 888 o 888 .o d8' `888b
o8o o888o `Y8bod8P' "888" `Y888""8o o888ooooood8 `Y8bod8P' o888o o88888o
.oooooo. .o8 .oooooo.
d8P' `Y8b "888 d8P' `Y8b
888 oooo ooo 888oooo. .ooooo. oooo d8b 888 .ooooo. oooo d8b oo.ooooo.
888 `88. .8' d88' `88b d88' `88b `888""8P 888 d88' `88b `888""8P 888' `88b
888 `88..8' 888 888 888ooo888 888 888 888 888 888 888 888
`88b ooo `888' 888 888 888 .o 888 `88b ooo 888 888 888 888 888 .o.
`Y8bood8P' .8' `Y8bod8P' `Y8bod8P' d888b `Y8bood8P' `Y8bod8P' d888b 888bod8P' Y8P
.o..P' 888
`Y8P' o888o
_______________________________________________________________________________________________________
All software, documentation and other files and information in this repository (collectively, the "Software")
are copyright MetaLeX Labs, Inc., a Delaware corporation.
All rights reserved.
The Software is proprietary and shall not, in part or in whole, be used, copied, modified, merged, published,
distributed, transmitted, sublicensed, sold, or otherwise used in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage and retrieval system,
except with the express prior written permission of the copyright holder.*/
pragma solidity 0.8.28;
enum SecurityClass {
SAFE,
SAFT,
SAFTE,
TokenPurchaseAgreement,
TokenWarrant,
ConvertibleNote,
CommonStock,
StockOption,
PreferredStock,
RestrictedStockPurchaseAgreement,
RestrictedStockUnit,
RestrictedTokenPurchaseAgreement,
RestrictedTokenUnit,
MembershipInterest,
SAFO
}
enum SecuritySeries {
SeriesPreSeed,
SeriesSeed,
SeriesA,
SeriesB,
SeriesC,
SeriesD,
SeriesE,
SeriesF,
NA,
ACE
}
enum SecurityStatus {
Unassigned,
Assigned,
Void
}
/// @notice Class-level designation for Ledger Entry Tokens (LETs), registered on the IssuanceManager.
/// Each certificate printer (the series scope) may be assigned to one class by classId; multiple printers
/// (series) can share a class. `classData` follows the extensionData pattern: an opaque abi-encoded payload
/// with an optional ICertificateExtension-style `dataExtension` that knows how to decode/render it.
struct SecurityClassInfo {
SecurityClass classType;
string documentURI; // class-level governing document (e.g. certificate of designation, class terms)
address dataExtension; // optional decoder/renderer for classData (ICertificateExtension-compatible)
bytes classData; // extensionData-style opaque payload
}
/// @notice Input that describes one certificate printer to create. The round path, the deal path
/// and the corporate factories all take this shape, so it is defined once here.
struct CyberCertData {
string name;
string symbol;
string uri;
SecurityClass securityClass;
SecuritySeries securitySeries;
address extension;
/// @notice Series-scope payload encoded by `extension` (ICertificateExtensionV3-compatible).
bytes seriesData;
string[] defaultLegend;
}
struct CompanyOfficer {
address eoa;
string name;
string contact;
string title;
}
enum ExercisePriceMethod {
perToken,
perWarrant
}
enum TokenCalculationMethod {
equityProRataToCompanyReserve,
equityProRataToTokenSupply,
dollarProRataToProtocolVal
}
enum UnlockStartTimeType {
tokenWarrantTime,
tgeTime,
setTime
}
enum UnlockingIntervalType {
blockly,
secondly,
hourly,
daily,
monthly
}
/// @dev The input of `buildCertificateSVG`.
struct CertificateSVGParams {
string corpName;
SecurityClass securityType;
SecuritySeries securitySeries;
string officerName;
string officerTitle;
uint256 units;
uint256 valuation;
string jurisdiction;
string ownerName;
uint256 tokenId;
string certificateUri;
address issuerAddress;
address ownerAddress;
uint256 consideration;
bool considerationKnown;
string[] transferRestrictions;
bool isVoided;
bool statusKnown;
/// @dev The series name from the extension. The image shows the series enum when it is "".
string seriesName;
}
src/interfaces/ICondition.sol
/* .o.
.888.
.8"888.
.8' `888.
.88ooo8888.
.8' `888.
o88o o8888o
ooo ooooo . ooooo ooooooo ooooo
`88. .888' .o8 `888' `8888 d8'
888b d'888 .ooooo. .o888oo .oooo. 888 .ooooo. Y888..8P
8 Y88. .P 888 d88' `88b 888 `P )88b 888 d88' `88b `8888'
8 `888' 888 888ooo888 888 .oP"888 888 888ooo888 .8PY888.
8 Y 888 888 .o 888 . d8( 888 888 o 888 .o d8' `888b
o8o o888o `Y8bod8P' "888" `Y888""8o o888ooooood8 `Y8bod8P' o888o o88888o
.oooooo. .o8 .oooooo.
d8P' `Y8b "888 d8P' `Y8b
888 oooo ooo 888oooo. .ooooo. oooo d8b 888 .ooooo. oooo d8b oo.ooooo.
888 `88. .8' d88' `88b d88' `88b `888""8P 888 d88' `88b `888""8P 888' `88b
888 `88..8' 888 888 888ooo888 888 888 888 888 888 888 888
`88b ooo `888' 888 888 888 .o 888 `88b ooo 888 888 888 888 888 .o.
`Y8bood8P' .8' `Y8bod8P' `Y8bod8P' d888b `Y8bood8P' `Y8bod8P' d888b 888bod8P' Y8P
.o..P' 888
`Y8P' o888o
_______________________________________________________________________________________________________
All software, documentation and other files and information in this repository (collectively, the "Software")
are copyright MetaLeX Labs, Inc., a Delaware corporation.
All rights reserved.
The Software is proprietary and shall not, in part or in whole, be used, copied, modified, merged, published,
distributed, transmitted, sublicensed, sold, or otherwise used in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage and retrieval system,
except with the express prior written permission of the copyright holder.*/
pragma solidity ^0.8.20;
interface ICondition {
function checkCondition(address _contract, bytes4 _functionSignature, bytes memory data) external view returns (bool);
}src/interfaces/ICyberAgreementRegistry.sol
/* .o.
.888.
.8"888.
.8' `888.
.88ooo8888.
.8' `888.
o88o o8888o
ooo ooooo . ooooo ooooooo ooooo
`88. .888' .o8 `888' `8888 d8'
888b d'888 .ooooo. .o888oo .oooo. 888 .ooooo. Y888..8P
8 Y88. .P 888 d88' `88b 888 `P )88b 888 d88' `88b `8888'
8 `888' 888 888ooo888 888 .oP"888 888 888ooo888 .8PY888.
8 Y 888 888 .o 888 . d8( 888 888 o 888 .o d8' `888b
o8o o888o `Y8bod8P' "888" `Y888""8o o888ooooood8 `Y8bod8P' o888o o88888o
.oooooo. .o8 .oooooo.
d8P' `Y8b "888 d8P' `Y8b
888 oooo ooo 888oooo. .ooooo. oooo d8b 888 .ooooo. oooo d8b oo.ooooo.
888 `88. .8' d88' `88b d88' `88b `888""8P 888 d88' `88b `888""8P 888' `88b
888 `88..8' 888 888 888ooo888 888 888 888 888 888 888 888
`88b ooo `888' 888 888 888 .o 888 `88b ooo 888 888 888 888 888 .o.
`Y8bood8P' .8' `Y8bod8P' `Y8bod8P' d888b `Y8bood8P' `Y8bod8P' d888b 888bod8P' Y8P
.o..P' 888
`Y8P' o888o
_______________________________________________________________________________________________________
All software, documentation and other files and information in this repository (collectively, the "Software")
are copyright MetaLeX Labs, Inc., a Delaware corporation.
All rights reserved.
The Software is proprietary and shall not, in part or in whole, be used, copied, modified, merged, published,
distributed, transmitted, sublicensed, sold, or otherwise used in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage and retrieval system,
except with the express prior written permission of the copyright holder.*/
pragma solidity ^0.8.0;
interface ICyberAgreementRegistry {
struct Template {
string legalContractUri;
string title;
string[] globalFields;
string[] partyFields;
}
struct ContractData {
bytes32 templateId;
string[] globalValues;
address[] parties;
uint256 numSignatures;
bytes32 transactionHash;
}
event TemplateCreated(
bytes32 indexed templateId,
string indexed title,
string legalContractUri,
string[] globalFields,
string[] signerFields
);
event ContractCreated(
bytes32 indexed contractId,
bytes32 indexed templateId,
address[] parties
);
event AgreementSigned(
bytes32 indexed contractId,
address indexed party,
uint256 timestamp
);
event ContractFullySigned(bytes32 indexed contractId, uint256 timestamp);
function createTemplate(
bytes32 templateId,
string memory title,
string memory legalContractUri,
string[] memory globalFields,
string[] memory partyFields
) external;
function createContract(
bytes32 templateId,
uint256 salt,
string[] memory globalValues,
address[] memory parties,
string[][] memory partyValues,
bytes32 secretHash,
address finalizer,
uint256 expiry
) external returns (bytes32);
function signContract(
bytes32 contractId,
string[] memory partyValues,
bytes calldata signature,
bool fillUnallocated, // to fill a 0 address or not
string memory secret
) external;
function signContractFor(
address signer,
bytes32 contractId,
string[] memory partyValues,
bytes calldata signature,
bool fillUnallocated, // to fill a 0 address or not
string memory secret
) external;
function signContractWithEscrow(
address escrowSigner,
bytes32 contractId,
string[] memory partyValues,
bytes calldata signature,
bool fillUnallocated, // to fill a 0 address or not
string memory secret
) external;
//function voidContractFor(bytes32 contractId, address party, bytes calldata signature) public {
function voidContractFor(
bytes32 contractId,
address party,
bytes calldata signature
) external;
function finalizeContract(bytes32 contractId) external;
function getParties(bytes32 contractId) external view returns (address[] memory);
function hasSigned(bytes32 contractId, address signer) external view returns (bool);
function getSignatureTimestamp(bytes32 contractId, address signer) external view returns (uint256);
function allPartiesSigned(bytes32 contractId) external view returns (bool);
function getContractDetails(
bytes32 contractId
)
external
view
returns (
bytes32 templateId,
string memory legalContractUri,
string[] memory globalFields,
string[] memory partyFields,
string[] memory globalValues,
address[] memory parties,
string[][] memory partyValues,
uint256[] memory signedAt,
uint256 numSignatures,
bool isComplete
);
function getTemplateDetails(
bytes32 templateId
)
external
view
returns (
string memory legalContractUri,
string memory title,
string[] memory globalFields,
string[] memory signerFields
);
function getSignerValues(
bytes32 contractId,
address signer
) external view returns (string[] memory signerValues);
function isVoided(bytes32 contractId) external view returns (bool);
function getAgreementsForParty(address party) external view returns (bytes32[] memory);
function getContractJson(bytes32 contractId) external view returns (string memory);
function isFinalized(bytes32 contractId) external view returns (bool);
}
src/interfaces/ICyberCorp.sol
/* .o.
.888.
.8"888.
.8' `888.
.88ooo8888.
.8' `888.
o88o o8888o
ooo ooooo . ooooo ooooooo ooooo
`88. .888' .o8 `888' `8888 d8'
888b d'888 .ooooo. .o888oo .oooo. 888 .ooooo. Y888..8P
8 Y88. .P 888 d88' `88b 888 `P )88b 888 d88' `88b `8888'
8 `888' 888 888ooo888 888 .oP"888 888 888ooo888 .8PY888.
8 Y 888 888 .o 888 . d8( 888 888 o 888 .o d8' `888b
o8o o888o `Y8bod8P' "888" `Y888""8o o888ooooood8 `Y8bod8P' o888o o88888o
.oooooo. .o8 .oooooo.
d8P' `Y8b "888 d8P' `Y8b
888 oooo ooo 888oooo. .ooooo. oooo d8b 888 .ooooo. oooo d8b oo.ooooo.
888 `88. .8' d88' `88b d88' `88b `888""8P 888 d88' `88b `888""8P 888' `88b
888 `88..8' 888 888 888ooo888 888 888 888 888 888 888 888
`88b ooo `888' 888 888 888 .o 888 `88b ooo 888 888 888 888 888 .o.
`Y8bood8P' .8' `Y8bod8P' `Y8bod8P' d888b `Y8bood8P' `Y8bod8P' d888b 888bod8P' Y8P
.o..P' 888
`Y8P' o888o
_______________________________________________________________________________________________________
All software, documentation and other files and information in this repository (collectively, the "Software")
are copyright MetaLeX Labs, Inc., a Delaware corporation.
All rights reserved.
The Software is proprietary and shall not, in part or in whole, be used, copied, modified, merged, published,
distributed, transmitted, sublicensed, sold, or otherwise used in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage and retrieval system,
except with the express prior written permission of the copyright holder.*/
import {CompanyOfficer} from "../CyberCorpConstants.sol";
pragma solidity 0.8.28;
interface ICyberCorp {
function initialize(
address _auth,
string memory _cyberCORPName,
string memory _cyberCORPType,
string memory _cyberCORPJurisdiction,
string memory _cyberCORPContactDetails,
string memory _defaultDisputeResolution,
address _issuanceManager,
address _companyPayable,
CompanyOfficer memory _officer,
address _upgradeFactory,
address _roundManager
) external;
function cyberCORPName() external view returns (string memory);
function cyberCORPJurisdiction() external view returns (string memory);
function cyberCORPContactDetails() external view returns (string memory);
function defaultDisputeResolution() external view returns (string memory);
function companyPayable() external view returns (address);
function cyberCORPType() external view returns (string memory);
function dealManager() external view returns (address);
function setDealManager(address _dealManager) external;
function setRoundManager(address _roundManager) external;
function roundManager() external view returns (address);
function addOfficer(CompanyOfficer memory _officer) external;
function updateOfficer(uint256 _index, CompanyOfficer memory _officer) external;
function addEscrowedOfficerSignature(bytes calldata signature) external;
function setEscrowedOfficerSignature(uint256 index, bytes calldata signature) external;
function getEscrowedOfficerSignature(uint256 index) external view returns (bytes memory);
function getEscrowedOfficerSignatureCount() external view returns (uint256);
function extension() external view returns (address);
function extensionType() external view returns (bytes32);
function extensionData() external view returns (bytes memory);
function setExtension(address _extension, bytes32 _extensionType) external;
function setExtensionData(bytes calldata _extensionData) external;
function clearExtension() external;
function getExtensionURI() external view returns (string memory);
}
src/interfaces/ILedgerEntryToken.sol
/* .o.
.888.
.8"888.
.8' `888.
.88ooo8888.
.8' `888.
o88o o8888o
ooo ooooo . ooooo ooooooo ooooo
`88. .888' .o8 `888' `8888 d8'
888b d'888 .ooooo. .o888oo .oooo. 888 .ooooo. Y888..8P
8 Y88. .P 888 d88' `88b 888 `P )88b 888 d88' `88b `8888'
8 `888' 888 888ooo888 888 .oP"888 888 888ooo888 .8PY888.
8 Y 888 888 .o 888 . d8( 888 888 o 888 .o d8' `888b
o8o o888o `Y8bod8P' "888" `Y888""8o o888ooooood8 `Y8bod8P' o888o o88888o
.oooooo. .o8 .oooooo.
d8P' `Y8b "888 d8P' `Y8b
888 oooo ooo 888oooo. .ooooo. oooo d8b 888 .ooooo. oooo d8b oo.ooooo.
888 `88. .8' d88' `88b d88' `88b `888""8P 888 d88' `88b `888""8P 888' `88b
888 `88..8' 888 888 888ooo888 888 888 888 888 888 888 888
`88b ooo `888' 888 888 888 .o 888 `88b ooo 888 888 888 888 888 .o.
`Y8bood8P' .8' `Y8bod8P' `Y8bod8P' d888b `Y8bood8P' `Y8bod8P' d888b 888bod8P' Y8P
.o..P' 888
`Y8P' o888o
_______________________________________________________________________________________________________
All software, documentation and other files and information in this repository (collectively, the "Software")
are copyright MetaLeX Labs, Inc., a Delaware corporation.
All rights reserved.
The Software is proprietary and shall not, in part or in whole, be used, copied, modified, merged, published,
distributed, transmitted, sublicensed, sold, or otherwise used in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage and retrieval system,
except with the express prior written permission of the copyright holder.*/
pragma solidity 0.8.28;
import "../CyberCorpConstants.sol";
import "openzeppelin-contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "openzeppelin-contracts/token/ERC721/extensions/IERC721Enumerable.sol";
struct CertificateDetails {
string signingOfficerName;
string signingOfficerTitle;
uint256 investmentAmountUSD;
uint256 issuerUSDValuationAtTimeOfInvestment;
uint256 unitsRepresented;
string legalDetails;
bytes extensionData;
}
struct Endorsement {
address endorser;
uint256 timestamp;
bytes signatureHash;
address registry; //optional
bytes32 agreementId; //optional
address endorsee;
string endorseeName;
}
struct OwnerDetails {
string name;
address ownerAddress;
}
enum RestrictionType {
Unspecified,
TransferConsentRequired,
RestrictedSecurityRule144,
UnregisteredSecurities,
RegulationS,
ContentiousHardfork,
Custom
}
struct RestrictiveLegend {
RestrictionType restrictionType;
string title;
string text;
string jurisdiction;
bytes32 referenceId;
uint64 effectiveTimestamp;
uint64 expirationTimestamp;
bool active;
bytes data;
}
interface ILedgerEntryToken is IERC721Metadata, IERC721Enumerable {
// Shared errors — declared once here so LedgerEntryToken and its storage library (via delegatecall) revert
// with identical selectors.
error NotIssuanceManager();
error HolderCountAlreadyInitialized();
error TokenNotTransferable();
/// @notice The lot is void. A void lot keeps its owner and its units, so the ownership and unit checks
/// alone do not stop one. It must not be registered to a new holder.
error VoidCertificate();
/// @notice The holder of record may not change: the printer's stop-transfer on the books is on.
/// Separate from TokenNotTransferable, which governs possession.
error LegalOwnerNotTransferable();
error TokenDoesNotExist();
error InvalidTokenId();
error URIQueryForNonexistentToken();
error URISetForNonexistentToken();
error ConversionNotImplemented();
error TransferRestricted(string reason);
error EndorsementNotSignedOrInvalid();
error InvalidEndorsement();
error InvalidLegendIndex();
error SignatureRequired();
error LegalOwnerIndexOutOfBounds();
error CertificateReserved();
error ExceedsAvailableUnits();
error ExceedsReservedUnits();
error ExtensionTypeNotSupported();
// Shared events — declared once here so LedgerEntryToken and its storage library (via delegatecall) emit
// with identical topics.
event CertificateCreated(uint256 indexed tokenId, address indexed investor, uint256 amount, uint256 cap);
event Converted(uint256 indexed oldTokenId, uint256 indexed newTokenId);
event CertificateSigned(uint256 indexed tokenId, bytes signature);
event CertificateEndorsed(
uint256 indexed tokenId,
address indexed endorser,
address indexed endorsee,
string endorseeName,
address registry,
bytes32 agreementId,
uint256 index,
uint256 timestamp
);
event HookStatusChanged(bool enabled);
event HolderCountInitialized(address indexed holder, uint256 balance);
/// @notice Seed a zero custody counter from the holder's current ERC-721 balance.
function initializeHolderCount(address holder) external;
event WhitelistUpdated(address indexed account, bool whitelisted);
event CyberCertPrinter_CertificateCreated(uint256 indexed tokenId);
event CyberCertTransfer(address indexed from, address indexed to, uint256 indexed tokenId);
event CertificateAssigned(uint256 indexed tokenId, address indexed newOwner, string newOwnerName, string issuerName);
event CertificateVoided(uint256 indexed tokenId, uint256 timestamp);
event CertificateUnvoided(uint256 indexed tokenId, uint256 timestamp);
event RestrictionHookSet(uint256 indexed id, address indexed hookAddress);
event GlobalRestrictionHookSet(address indexed hookAddress);
event GlobalTransferableSet(bool indexed transferable);
event GlobalLegalTransferableSet(bool indexed legalTransferable);
event TokenLegalTransferableSet(uint256 indexed tokenId, bool legalTransferable);
event TokenTransferableSet(uint256 indexed tokenId, bool transferable);
event LookThroughBadgeSet(address indexed badge);
event UnitsReservedUpdated(uint256 indexed tokenId, uint256 unitsReserved);
event IssueTimestampSet(uint256 indexed tokenId, uint64 issueTimestamp);
event AcquisitionTimestampSet(uint256 indexed tokenId, uint64 acquisitionTimestamp);
event LegalOwnerChanged(
uint256 indexed tokenId,
address indexed previousOwner,
address indexed newOwner,
string newOwnerName,
uint64 acquisitionTimestamp
);
event SeriesDataSet(address indexed extension);
event SeriesExtensionSet(address indexed extension);
event IssuanceManagerUpdated(address indexed issuanceManager, address indexed previousIssuanceManager);
event CertificateDetailsUpdated(uint256 indexed tokenId);
event CertLegendsChanged(uint256 indexed tokenId);
event DefaultLegendsChanged();
function initialize(
string[] memory defaultLegend,
string memory name,
string memory ticker,
string memory _certificateUri,
address _issuanceManager,
SecurityClass _securityType,
SecuritySeries _securitySeries,
address _extension,
bytes memory _seriesData
) external;
function updateIssuanceManager(address _issuanceManager) external;
function defaultLegend() external view returns (string[] memory);
function defaultRestrictiveLegends() external view returns (RestrictiveLegend[] memory);
function setRestrictionHook(uint256 _id, address _hookAddress) external;
function setGlobalRestrictionHook(address hookAddress) external;
function safeMint(
uint256 tokenId,
address to,
CertificateDetails memory details
) external returns (uint256);
function setGlobalTransferable(bool _transferable) external;
function setGlobalLegalTransferable(bool value) external;
function legalTransferable() external view returns (bool);
function isTokenLegalTransferable(uint256 tokenId) external view returns (bool);
function safeMintAndAssign(
address to,
uint256 tokenId,
CertificateDetails memory details,
string memory investorName
) external returns (uint256);
function safeMintAndAssign(
address to, // custodian
address owner, // legal owner
uint256 tokenId,
CertificateDetails memory details,
string memory ownerName
) external returns (uint256);
function safeMintFromAndAssign(
uint256 sourceTokenId,
address to,
address owner,
uint256 tokenId,
CertificateDetails memory details,
string memory ownerName
) external returns (uint256);
function assignCert(
address from,
uint256 tokenId,
address to,
CertificateDetails memory details,
string memory name
) external returns (uint256);
function addIssuerSignature(
uint256 tokenId,
bytes calldata signature
) external;
function addEndorsement(
uint256 tokenId,
Endorsement memory newEndorsement
) external;
function endorseCertificate(
uint256 tokenId,
address endorser,
bytes memory signature,
bytes32 agreementId
) external;
function updateCertificateTackedFromAcquisitionDate(
uint256 tokenId,
uint64 ts
) external;
function endorseAndTransfer(
uint256 tokenId,
Endorsement memory newEndorsement,
address from,
address to
) external;
function updateCertificateDetails(
uint256 tokenId,
CertificateDetails calldata details
) external;
function voidCert(uint256 tokenId) external;
function unvoidCert(uint256 tokenId) external;
function isVoided(uint256 tokenId) external view returns (bool);
function getCertificateDetails(
uint256 tokenId
) external view returns (CertificateDetails memory);
function getActiveCertificateDetails(
uint256 tokenId
) external view returns (CertificateDetails memory);
function getExtension(uint256 tokenId) external view returns (address);
function setSeriesData(bytes memory _seriesData) external;
function getSeriesInfo()
external
view
returns (address extension, bytes memory seriesData);
function getIssuerSignatureCount(uint256 tokenId) external view returns (uint256);
function getIssuerSignatureAt(uint256 tokenId, uint256 index) external view returns (bytes memory);
function addCertLegend(uint256 tokenId, string memory newLegend) external;
function removeCertLegendAt(uint256 tokenId, uint256 index) external;
function addDefaultLegend(string memory newLegend) external;
function removeDefaultLegendAt(uint256 index) external;
function addDefaultRestrictiveLegend(RestrictiveLegend memory newLegend) external;
function removeDefaultRestrictiveLegendAt(uint256 index) external;
function getDefaultRestrictiveLegendAt(uint256 index) external view returns (RestrictiveLegend memory);
function getDefaultRestrictiveLegendCount() external view returns (uint256);
function addCertRestrictiveLegend(uint256 tokenId, RestrictiveLegend memory newLegend) external;
function removeCertRestrictiveLegendAt(uint256 tokenId, uint256 index) external;
function getCertRestrictiveLegendAt(uint256 tokenId, uint256 index) external view returns (RestrictiveLegend memory);
function getCertRestrictiveLegendCount(uint256 tokenId) external view returns (uint256);
function getEndorsementHistory(uint256 tokenId, uint256 index) external view returns (Endorsement memory);
function certificateUri() external view returns (string memory);
function issuanceManager() external view returns (address);
function holderCount() external view returns (uint256);
// ERC721-like APIs for legal owner
function legalOwnerOf(uint256 tokenId) external view returns (address);
function balanceOfLegalOwner(address owner) external view returns (uint256);
function tokenOfLegalOwnerByIndex(address owner, uint256 index) external view returns (uint256);
// §3(c)(1)(A) look-through holder tally (maintained incrementally; read O(1))
function lookThroughHolderCount() external view returns (uint256);
function usLookThroughHolderCount() external view returns (uint256);
function usTallyExpiry() external view returns (uint64);
function isLegalHolder(address owner) external view returns (bool); // note the distinction vs legal owner: a legal holder must have live lots
function lookThroughBadge() external view returns (address);
function setLookThroughBadge(address badge) external;
function resyncHolder(address owner) external;
function resyncHolders(address[] calldata owners) external;
function backfillLookThroughTally(uint256 startIndex, uint256 count) external;
function setTokenTransferable(uint256 tokenId, bool value) external;
function setTokenLegalTransferable(uint256 tokenId, bool value) external;
function increaseUnitsReserved(uint256 tokenId, uint256 amount) external;
function decreaseUnitsReserved(uint256 tokenId, uint256 amount) external;
function unitsReserved(uint256 tokenId) external view returns (uint256);
function issueTimestamp(uint256 tokenId) external view returns (uint64);
function setIssueTimestamp(uint256 tokenId, uint64 ts) external;
function acquisitionTimestamp(uint256 tokenId) external view returns (uint64);
function setAcquisitionTimestamp(uint256 tokenId, uint64 ts) external;
function backfillAcquisitionTimestamps(uint256 startIndex, uint256 count) external;
}
src/interfaces/ILexScrowStorage.sol
/* .o.
.888.
.8"888.
.8' `888.
.88ooo8888.
.8' `888.
o88o o8888o
ooo ooooo . ooooo ooooooo ooooo
`88. .888' .o8 `888' `8888 d8'
888b d'888 .ooooo. .o888oo .oooo. 888 .ooooo. Y888..8P
8 Y88. .P 888 d88' `88b 888 `P )88b 888 d88' `88b `8888'
8 `888' 888 888ooo888 888 .oP"888 888 888ooo888 .8PY888.
8 Y 888 888 .o 888 . d8( 888 888 o 888 .o d8' `888b
o8o o888o `Y8bod8P' "888" `Y888""8o o888ooooood8 `Y8bod8P' o888o o88888o
.oooooo. .o8 .oooooo.
d8P' `Y8b "888 d8P' `Y8b
888 oooo ooo 888oooo. .ooooo. oooo d8b 888 .ooooo. oooo d8b oo.ooooo.
888 `88. .8' d88' `88b d88' `88b `888""8P 888 d88' `88b `888""8P 888' `88b
888 `88..8' 888 888 888ooo888 888 888 888 888 888 888 888
`88b ooo `888' 888 888 888 .o 888 `88b ooo 888 888 888 888 888 .o.
`Y8bood8P' .8' `Y8bod8P' `Y8bod8P' d888b `Y8bood8P' `Y8bod8P' d888b 888bod8P' Y8P
.o..P' 888
`Y8P' o888o
_______________________________________________________________________________________________________
All software, documentation and other files and information in this repository (collectively, the "Software")
are copyright MetaLeX Labs, Inc., a Delaware corporation.
All rights reserved.
The Software is proprietary and shall not, in part or in whole, be used, copied, modified, merged, published,
distributed, transmitted, sublicensed, sold, or otherwise used in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage and retrieval system,
except with the express prior written permission of the copyright holder.*/
pragma solidity 0.8.28;
import {Escrow} from "../storage/LexScrowStorage.sol";
/// @title ILexScrowStorage
/// @notice In addition to the common interfaces,
/// managers who use LexScrowStorage are expected to provide their own fee logic through the fee hooks below.
/// Any manager that links the library (e.g. DealManager) inherits this interface so the selectors/topics appear in its ABI for off-chain decoding.
interface ILexScrowStorage {
/// @notice Attached escrow conditions were not all satisfied. Shared across managers that link
/// LexScrowStorage (e.g. DealManager, RoundManager) so they expose the same selector.
error AgreementConditionsNotMet();
/// @notice Get escrow details for a given agreement id
function getEscrowDetails(bytes32 agreementId) external view returns (Escrow memory);
/// @notice Check all conditions attached to the escrow for the given agreement
function conditionCheck(bytes32 agreementId) external view returns (bool);
/// @notice Compute fee based on ticket size
function computeFee(uint256 size) external view returns (uint256);
/// @notice Get the payable address for the fees
function getPlatformPayable() external view returns (address);
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {
"src/CyberAgreementRegistry.sol": {
"CyberAgreementJson": "0x7ccD9CF37B17b1433df67724B18C5c3dF7ec9e8E",
"CyberAgreementBound": "0xe8788a560F68a497C23cddCAFA4728B175e93415"
},
"src/storage/LexScrowStorage.sol": {
"LexScrowStorage": "0xe06006dDcC4ff20aacff20906F56d9893124d49D"
},
"src/creds/LeXcheXBadgeRender.sol": {
"LeXcheXBadgeRender": "0xB62cEBD990aAD2114Ef5120536b38Ce7ef5C99a2"
},
"src/storage/DealManagerStorage.sol": {
"DealManagerStorage": "0x17454BE928Bf061678A2E1D7909A94E6AbAEE644"
},
"src/storage/RoundManagerStorage.sol": {
"RoundManagerStorage": "0xFDb8ED7631Ed803E6110c07f2926AbA088AA3813"
},
"src/storage/SecondaryTradeStorage.sol": {
"SecondaryTradeStorage": "0xE65839Cf4d81aF8D8aB30a59558bF249E3520e86"
},
"src/CertificateImageContentBuilder.sol": {
"CertificateImageContentBuilder": "0xf73cF11Dc03473e53582137fB336A06C22eb4c1D"
},
"src/storage/IssuanceManagerStorage.sol": {
"IssuanceManagerStorage": "0xbC2878B5777B33B951260A6ff866933063e1220c"
},
"src/storage/LedgerEntryTokenStorage.sol": {
"LedgerEntryTokenStorage": "0xe720A5d00732830df878629cEdE70B2bF95c4a05"
},
"src/storage/extensions/ShareCertDataLayerLib.sol": {
"ShareCertDataLayerLib": "0x780211CDcf92273C00a29bE6cD367c4abc70468c"
}
},
"optimizer": {
"runs": 15,
"enabled": true
},
"evmVersion": "prague",
"remappings": [
"openzeppelin-contracts/=dependencies/openzeppelin-contracts/contracts/",
"openzeppelin-contracts-upgradeable/=dependencies/openzeppelin-contracts-upgradeable/contracts/",
"erc721a/=dependencies/erc721a-4.3.0/",
"forge-std/=dependencies/forge-std/src/",
"ConditionManager/=dependencies/ConditionManager/src/",
"dependencies/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=dependencies/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"dependencies/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=dependencies/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"dependencies/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=dependencies/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"dependencies/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=dependencies/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"dependencies/openzeppelin-contracts-upgradeable/:erc4626-tests/=dependencies/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"dependencies/openzeppelin-contracts-upgradeable/:erc4626-tests/=dependencies/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"dependencies/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=dependencies/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"dependencies/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=dependencies/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"dependencies/openzeppelin-contracts/:erc4626-tests/=dependencies/openzeppelin-contracts/lib/erc4626-tests/",
"dependencies/openzeppelin-contracts/:erc4626-tests/=dependencies/openzeppelin-contracts/lib/erc4626-tests/",
"dependencies/openzeppelin-contracts/:halmos-cheatcodes/=dependencies/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"dependencies/openzeppelin-contracts/:halmos-cheatcodes/=dependencies/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"@openzeppelin/contracts-upgradeable/=dependencies/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=dependencies/openzeppelin-contracts/contracts/",
"erc4626-tests/=dependencies/openzeppelin-contracts/lib/erc4626-tests/",
"halmos-cheatcodes/=dependencies/openzeppelin-contracts/lib/halmos-cheatcodes/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.