Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x5Ebf7D63...2Fb626118 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
RoyaltyPolicyLS
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 20000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
// external
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ERC1155Holder } from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
// contracts
import { LSClaimer } from "contracts/modules/royalty-module/policies/LSClaimer.sol";
import { ILiquidSplitClone } from "contracts/interfaces/modules/royalty/policies/ILiquidSplitClone.sol";
import { ILiquidSplitFactory } from "contracts/interfaces/modules/royalty/policies/ILiquidSplitFactory.sol";
import { ILiquidSplitMain } from "contracts/interfaces/modules/royalty/policies/ILiquidSplitMain.sol";
import { IRoyaltyPolicyLS } from "contracts/interfaces/modules/royalty/policies/IRoyaltyPolicyLS.sol";
import { Errors } from "contracts/lib/Errors.sol";
/// @title Liquid Split Royalty Policy
/// @notice The LiquidSplit royalty policy splits royalties in accordance with
/// the percentage of royalty NFTs owned by each account.
contract RoyaltyPolicyLS is IRoyaltyPolicyLS, ERC1155Holder {
using SafeERC20 for IERC20;
struct LSRoyaltyData {
address splitClone; // address of the liquid split clone contract for a given ipId
address claimer; // address of the claimer contract for a given ipId
uint32 royaltyStack; // royalty stack for a given ipId is the sum of the minRoyalty of all its parents (number between 0 and 1000)
uint32 minRoyalty; // minimum royalty the ipId will receive from its children and grandchildren (number between 0 and 1000)
}
/// @notice Percentage scale - 1000 rnfts represents 100%
uint32 public constant TOTAL_RNFT_SUPPLY = 1000;
/// @notice RoyaltyModule address
address public immutable ROYALTY_MODULE;
/// @notice License registry address
address public immutable LICENSE_REGISTRY;
/// @notice LiquidSplitFactory address
address public immutable LIQUID_SPLIT_FACTORY;
/// @notice LiquidSplitMain address
address public immutable LIQUID_SPLIT_MAIN;
/// @notice Links the ipId to its royalty data
mapping(address ipId => LSRoyaltyData) public royaltyData;
/// @notice Restricts the calls to the royalty module
modifier onlyRoyaltyModule() {
if (msg.sender != ROYALTY_MODULE) revert Errors.RoyaltyPolicyLS__NotRoyaltyModule();
_;
}
/// @notice Constructor
/// @param _royaltyModule Address of the RoyaltyModule contract
/// @param _licenseRegistry Address of the LicenseRegistry contract
/// @param _liquidSplitFactory Address of the LiquidSplitFactory contract
/// @param _liquidSplitMain Address of the LiquidSplitMain contract
constructor(address _royaltyModule, address _licenseRegistry, address _liquidSplitFactory, address _liquidSplitMain) {
if (_royaltyModule == address(0)) revert Errors.RoyaltyPolicyLS__ZeroRoyaltyModule();
if (_licenseRegistry == address(0)) revert Errors.RoyaltyPolicyLS__ZeroLicenseRegistry();
if (_liquidSplitFactory == address(0)) revert Errors.RoyaltyPolicyLS__ZeroLiquidSplitFactory();
if (_liquidSplitMain == address(0)) revert Errors.RoyaltyPolicyLS__ZeroLiquidSplitMain();
ROYALTY_MODULE = _royaltyModule;
LICENSE_REGISTRY = _licenseRegistry;
LIQUID_SPLIT_FACTORY = _liquidSplitFactory;
LIQUID_SPLIT_MAIN = _liquidSplitMain;
}
// TODO: Ensure that parentsIds should be correctly passed in through the licensing contract, otherwise we must call parents() on licenseRegistry directly
// TODO: setApprovalForAll for splitClone to this contract to allow it to transfer RNFTs? Useful for the corner case where someone holds all rnfts
/// @notice Initializes the royalty policy
/// @param _ipId The ipId
/// @param _parentIpIds The parent ipIds
/// @param _data The data to initialize the policy
function initPolicy(address _ipId, address[] calldata _parentIpIds, bytes calldata _data) external onlyRoyaltyModule {
(uint32 minRoyalty) = abi.decode(_data, (uint32));
// root you can choose 0% but children have to choose at least 1%
if (minRoyalty == 0 && _parentIpIds.length > 0) revert Errors.RoyaltyPolicyLS__ZeroMinRoyalty();
// minRoyalty has to be a multiple of 1% and given that there are 1000 royalty nfts
// then minRoyalty has to be a multiple of 10
if (minRoyalty % 10 != 0) revert Errors.RoyaltyPolicyLS__InvalidMinRoyalty();
// calculates the new royalty stack and checks if it is valid
(uint32 royaltyStack, uint32 newRoyaltyStack) = _checkRoyaltyStackIsValid(_parentIpIds, minRoyalty);
// deploy claimer if not root ip
address claimer = address(this); // 0xSplit requires two addresses to allow a split so for root ip address(this) as the second address
if (_parentIpIds.length > 0) claimer = address(new LSClaimer(_ipId, LICENSE_REGISTRY, address(this)));
// deploy split clone
address splitClone = _deploySplitClone(_ipId, claimer, royaltyStack);
royaltyData[_ipId] = LSRoyaltyData({
splitClone: splitClone,
claimer: claimer,
royaltyStack: newRoyaltyStack,
minRoyalty: minRoyalty
});
}
/// @notice Allows to pay a royalty
/// @param _caller The caller
/// @param _ipId The ipId
/// @param _token The token to pay
/// @param _amount The amount to pay
function onRoyaltyPayment(
address _caller,
address _ipId,
address _token,
uint256 _amount
) external onlyRoyaltyModule {
address destination = royaltyData[_ipId].splitClone;
IERC20(_token).safeTransferFrom(_caller, destination, _amount);
}
/// @notice Distributes funds to the accounts in the LiquidSplitClone contract
/// @param _ipId The ipId
/// @param _token The token to distribute
/// @param _accounts The accounts to distribute to
/// @param _distributorAddress The distributor address
function distributeFunds(
address _ipId,
address _token,
address[] calldata _accounts,
address _distributorAddress
) external {
ILiquidSplitClone(royaltyData[_ipId].splitClone).distributeFunds(_token, _accounts, _distributorAddress);
}
/// @notice Claims the available royalties for a given account
/// @param _account The account to claim for
/// @param _withdrawETH The amount of ETH to withdraw
/// @param _tokens The tokens to withdraw
function claimRoyalties(address _account, uint256 _withdrawETH, ERC20[] calldata _tokens) external {
ILiquidSplitMain(LIQUID_SPLIT_MAIN).withdraw(_account, _withdrawETH, _tokens);
}
/// @notice Checks if the royalty stack is valid
/// @param _parentIpIds The parent ipIds
/// @param _minRoyalty The minimum royalty
/// @return royaltyStack The royalty stack
/// newRoyaltyStack The new royalty stack
function _checkRoyaltyStackIsValid(address[] calldata _parentIpIds, uint32 _minRoyalty) internal view returns (uint32, uint32) {
// the loop below is limited to a length of 100 parents
// given the minimum royalty step of 1% and a cap of 100%
uint32 royaltyStack;
for (uint32 i = 0; i < _parentIpIds.length; i++) {
royaltyStack += royaltyData[_parentIpIds[i]].royaltyStack;
}
uint32 newRoyaltyStack = royaltyStack + _minRoyalty;
if (newRoyaltyStack > TOTAL_RNFT_SUPPLY) revert Errors.RoyaltyPolicyLS__InvalidRoyaltyStack();
return (royaltyStack, newRoyaltyStack);
}
/// @notice Deploys a liquid split clone contract
/// @param _ipId The ipId
/// @param _claimer The claimer address
/// @param royaltyStack The number of rnfts that the ipId has to give to its parents and/or grandparents
/// @return The address of the deployed liquid split clone contract
function _deploySplitClone(address _ipId, address _claimer, uint32 royaltyStack) internal returns (address) {
address[] memory accounts = new address[](2);
accounts[0] = _ipId;
accounts[1] = _claimer;
uint32[] memory initAllocations = new uint32[](2);
initAllocations[0] = TOTAL_RNFT_SUPPLY - royaltyStack;
initAllocations[1] = royaltyStack;
address splitClone = ILiquidSplitFactory(LIQUID_SPLIT_FACTORY).createLiquidSplitClone(
accounts,
initAllocations,
0, // distributorFee
address(0) // splitOwner
);
return splitClone;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 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 {
using Address for address;
/**
* @dev An operation with an ERC20 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 Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
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.
*/
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.
*/
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 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).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
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 silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/utils/ERC1155Holder.sol)
pragma solidity ^0.8.20;
import {IERC165, ERC165} from "../../../utils/introspection/ERC165.sol";
import {IERC1155Receiver} from "../IERC1155Receiver.sol";
/**
* @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
*
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
* stuck.
*/
abstract contract ERC1155Holder is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
// external
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import { ERC1155Holder } from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
// contracts
import { ILicenseRegistry } from "contracts/interfaces/registries/ILicenseRegistry.sol";
import { ILiquidSplitClone } from "contracts/interfaces/modules/royalty/policies/ILiquidSplitClone.sol";
import { IRoyaltyPolicyLS } from "contracts/interfaces/modules/royalty/policies/IRoyaltyPolicyLS.sol";
import { ILiquidSplitMain } from "contracts/interfaces/modules/royalty/policies/ILiquidSplitMain.sol";
import { ILSClaimer } from "contracts/interfaces/modules/royalty/policies/ILSClaimer.sol";
import { Errors } from "contracts/lib/Errors.sol";
/// @title Liquid Split Claimer
/// @notice The liquid split claimer allows parents and grandparents to claim their share
/// the rnfts of their children and grandchildren along with any accrued royalties.
contract LSClaimer is ILSClaimer, ERC1155Holder, ReentrancyGuard {
using SafeERC20 for IERC20;
/// @notice The license registry interface
ILicenseRegistry public immutable ILICENSE_REGISTRY;
/// @notice The liquid split royalty policy interface
IRoyaltyPolicyLS public immutable IROYALTY_POLICY_LS;
/// @notice The ipId of the IP that this contract is associated with
address public immutable IP_ID;
/// @notice The paths between parent and children that have already been claimed
mapping(bytes32 pathHash => bool) public claimedPaths;
/// @notice Constructor
/// @param _ipId The ipId of the IP that this contract is associated with
/// @param _licenseRegistry The license registry address
/// @param _royaltyPolicyLS The liquid split royalty policy address
constructor(address _ipId, address _licenseRegistry, address _royaltyPolicyLS) {
if (_ipId == address(0)) revert Errors.LSClaimer__ZeroIpId();
if (_licenseRegistry == address(0)) revert Errors.LSClaimer__ZeroLicenseRegistry();
if (_royaltyPolicyLS == address(0)) revert Errors.LSClaimer__ZeroRoyaltyPolicyLS();
IP_ID = _ipId;
ILICENSE_REGISTRY = ILicenseRegistry(_licenseRegistry);
IROYALTY_POLICY_LS = IRoyaltyPolicyLS(_royaltyPolicyLS);
}
/// @notice Allows an parent or grandparent ipId to claim their rnfts and accrued royalties
/// @param _path The path between the IP_ID and the parent or grandparent ipId
/// @param _claimerIpId The ipId of the claimer
/// @param _withdrawETH Indicates if the claimer wants to withdraw ETH
/// @param _tokens The ERC20 tokens to withdraw
function claim(address[] calldata _path, address _claimerIpId, bool _withdrawETH, ERC20[] calldata _tokens) external nonReentrant {
bytes32 pathHash = keccak256(abi.encodePacked(_path));
if (claimedPaths[pathHash]) revert Errors.LSClaimer__AlreadyClaimed();
// check if path is valid
if (_path[0] != _claimerIpId) revert Errors.LSClaimer__InvalidPathFirstPosition();
if (_path[_path.length - 1] != IP_ID) revert Errors.LSClaimer__InvalidPathLastPosition();
_checkIfPathIsValid(_path);
// claim rnfts
(address rnftAddr,,,) = IROYALTY_POLICY_LS.royaltyData(IP_ID);
ILiquidSplitClone rnft = ILiquidSplitClone(rnftAddr);
uint256 totalUnclaimedRnfts = rnft.balanceOf(address(this), 0);
(address claimerSplitClone,,,uint32 rnftClaimAmount) = IROYALTY_POLICY_LS.royaltyData(_claimerIpId);
rnft.safeTransferFrom(address(this), claimerSplitClone, 0, rnftClaimAmount, "");
// claim accrued tokens (if any)
_claimAccruedTokens(rnftClaimAmount, totalUnclaimedRnfts, claimerSplitClone, _withdrawETH, _tokens);
claimedPaths[pathHash] = true;
emit Claimed(_path, _claimerIpId, _withdrawETH, _tokens);
}
/// @notice Checks if a claiming path is valid
/// @param _path The path between the IP_ID and the parent or grandparent ipId
function _checkIfPathIsValid(address[] calldata _path) internal view {
// the loop below is limited to no more than 100 parents
// given the minimum royalty step of 1% and there is a cap of 100%
for (uint256 i = 0; i < _path.length - 1; i++) {
if(!ILICENSE_REGISTRY.isParent(_path[i], _path[i+1])) revert Errors.LSClaimer__InvalidPath();
}
}
/// @notice Claims the accrued tokens (if any)
/// @param _rnftClaimAmount The amount of rnfts to claim
/// @param _totalUnclaimedRnfts The total unclaimed rnfts
/// @param _claimerSplitClone The claimer's split clone
/// @param _withdrawETH Indicates if the claimer wants to withdraw ETH
/// @param _tokens The ERC20 tokens to withdraw
function _claimAccruedTokens(uint256 _rnftClaimAmount, uint256 _totalUnclaimedRnfts, address _claimerSplitClone, bool _withdrawETH, ERC20[] calldata _tokens) internal {
ILiquidSplitMain splitMain = ILiquidSplitMain(IROYALTY_POLICY_LS.LIQUID_SPLIT_MAIN());
if (_withdrawETH) {
if (splitMain.getETHBalance(address(this)) != 0) revert Errors.LSClaimer__ETHBalanceNotZero();
uint256 ethBalance = address(this).balance;
uint256 ethClaimAmount = ethBalance * _rnftClaimAmount / _totalUnclaimedRnfts;
_safeTransferETH(_claimerSplitClone, ethClaimAmount);
}
for (uint256 i = 0; i < _tokens.length; ++i) {
// When withdrawing ERC20, 0xSplits sets the value to 1 to have warm storage access.
// But this still means 0 amount left. So, in the check below, we use `> 1`.
if (splitMain.getERC20Balance(address(this), _tokens[i]) > 1) revert Errors.LSClaimer__ERC20BalanceNotZero();
IERC20 IToken = IERC20(_tokens[i]);
uint256 tokenBalance = IToken.balanceOf(address(this));
uint256 tokenClaimAmount = tokenBalance * _rnftClaimAmount / _totalUnclaimedRnfts;
IToken.safeTransfer(_claimerSplitClone, tokenClaimAmount);
}
}
/// @notice Allows to transfers ETH
/// @param _to The address to transfer to
/// @param _amount The amount to transfer
function _safeTransferETH(address _to, uint256 _amount) internal {
bool callStatus;
assembly {
// Transfer the ETH and store if it succeeded or not.
callStatus := call(gas(), _to, _amount, 0, 0, 0, 0)
}
if (!callStatus) revert Errors.RoyaltyPolicyLS__TransferFailed();
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
/// @title LiquidSplitClone interface
interface ILiquidSplitClone {
/// @notice Distributes funds to the accounts in the LiquidSplitClone contract
/// @param token The token to distribute
/// @param accounts The accounts to distribute to
/// @param distributorAddress The distributor address
function distributeFunds(address token, address[] calldata accounts, address distributorAddress) external;
/// @notice Transfers rnft tokens
/// @param from The address to transfer from
/// @param to The address to transfer to
/// @param id The token id
/// @param amount The amount to transfer
/// @param data Custom data
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
function balanceOf(address account, uint256 id) external view returns (uint256);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
/// @title LiquidSplitFactory interface
interface ILiquidSplitFactory {
/// @notice Creates a new LiquidSplitClone contract
/// @param accounts The accounts to initialize the LiquidSplitClone contract with
/// @param initAllocations The initial allocations
/// @param _distributorFee The distributor fee
/// @param owner The owner of the LiquidSplitClone contract
function createLiquidSplitClone(
address[] calldata accounts,
uint32[] calldata initAllocations,
uint32 _distributorFee,
address owner
) external returns (address);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/// @title LiquidSplitMain interface
interface ILiquidSplitMain {
/// @notice Allows an account to withdraw their accrued and distributed pending amount
/// @param account The account to withdraw from
/// @param withdrawETH The amount of ETH to withdraw
/// @param tokens The tokens to withdraw
function withdraw(
address account,
uint256 withdrawETH,
ERC20[] calldata tokens
) external;
/// @notice Gets the ETH balance of an account
/// @param account The account to get the ETH balance of
function getETHBalance(address account) external view returns (uint256);
/// @notice Gets the ERC20 balance of an account
/// @param account The account to get the ERC20 balance of
/// @param token The token to get the balance of
function getERC20Balance(address account, ERC20 token) external view returns (uint256);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IRoyaltyPolicy } from "contracts/interfaces/modules/royalty/policies/IRoyaltyPolicy.sol";
/// @title RoyaltyPolicy interface
interface IRoyaltyPolicyLS is IRoyaltyPolicy {
/// @notice Gets the royalty data
/// @param ipId The ipId
/// @return splitClone The split clone address
/// claimer The claimer address
/// royaltyStack The royalty stack
/// minRoyalty The min royalty
function royaltyData(address ipId) external view returns (address splitClone, address claimer, uint32 royaltyStack, uint32 minRoyalty);
/// @notice Distributes funds to the accounts in the LiquidSplitClone contract
/// @param ipId The ipId
/// @param token The token to distribute
/// @param accounts The accounts to distribute to
/// @param distributorAddress The distributor address
function distributeFunds(
address ipId,
address token,
address[] calldata accounts,
address distributorAddress
) external;
/// @notice Claims the available royalties for a given account
/// @param account The account to claim for
/// @param withdrawETH The amount of ETH to withdraw
/// @param tokens The tokens to withdraw
function claimRoyalties(address account, uint256 withdrawETH, ERC20[] calldata tokens) external;
/// @notice Gets liquid split main address
function LIQUID_SPLIT_MAIN() external view returns (address);
}// SPDX-License-Identifier: UNLICENSED
// See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf
pragma solidity ^0.8.19;
/// @title Errors Library
/// @notice Library for all Story Protocol contract errors.
library Errors {
////////////////////////////////////////////////////////////////////////////
// Governance //
////////////////////////////////////////////////////////////////////////////
error Governance__OnlyProtocolAdmin();
error Governance__ZeroAddress();
error Governance__ProtocolPaused();
error Governance__InconsistentState();
error Governance__NewStateIsTheSameWithOldState();
error Governance__UnsupportedInterface(string interfaceName);
////////////////////////////////////////////////////////////////////////////
// IPAccount //
////////////////////////////////////////////////////////////////////////////
error IPAccount__InvalidSigner();
error IPAccount__InvalidSignature();
error IPAccount__ExpiredSignature();
////////////////////////////////////////////////////////////////////////////
// Module //
////////////////////////////////////////////////////////////////////////////
/// @notice The caller is not allowed to call the provided module.
error Module_Unauthorized();
////////////////////////////////////////////////////////////////////////////
// IPAccountRegistry //
////////////////////////////////////////////////////////////////////////////
error IPAccountRegistry_InvalidIpAccountImpl();
////////////////////////////////////////////////////////////////////////////
// IPAssetRegistry //
////////////////////////////////////////////////////////////////////////////
/// @notice The IP asset has already been registered.
error IPAssetRegistry__AlreadyRegistered();
/// @notice The IP account has already been created.
error IPAssetRegistry__IPAccountAlreadyCreated();
/// @notice The IP asset has not yet been registered.
error IPAssetRegistry__NotYetRegistered();
/// @notice The specified IP resolver is not valid.
error IPAssetRegistry__ResolverInvalid();
/// @notice Caller not authorized to perform the IP registry function call.
error IPAssetRegistry__Unauthorized();
/// @notice The deployed address of account doesn't match with IP ID.
error IPAssetRegistry__InvalidAccount();
/// @notice The metadata provider is not valid.
error IPAssetRegistry__InvalidMetadataProvider();
////////////////////////////////////////////////////////////////////////////
// IPResolver ///
////////////////////////////////////////////////////////////////////////////
/// @notice The targeted IP does not yet have an IP account.
error IPResolver_InvalidIP();
/// @notice Caller not authorized to perform the IP resolver function call.
error IPResolver_Unauthorized();
////////////////////////////////////////////////////////////////////////////
// Metadata Provider ///
////////////////////////////////////////////////////////////////////////////
/// @notice Provided hash metadata is not valid.
error MetadataProvider__HashInvalid();
/// @notice The caller is not the authorized IP asset owner.
error MetadataProvider__IPAssetOwnerInvalid();
/// @notice Provided hash metadata is not valid.
error MetadataProvider__NameInvalid();
/// @notice The new metadata provider is not compatible with the old provider.
error MetadataProvider__MetadataNotCompatible();
/// @notice Provided registrant metadata is not valid.
error MetadataProvider__RegistrantInvalid();
/// @notice Provided registration date is not valid.
error MetadataProvider__RegistrationDateInvalid();
/// @notice Caller does not access to set metadata storage for the provider.
error MetadataProvider__Unauthorized();
/// @notice A metadata provider upgrade is not currently available.
error MetadataProvider__UpgradeUnavailable();
/// @notice The upgrade provider is not valid.
error MetadataProvider__UpgradeProviderInvalid();
/// @notice Provided metadata URI is not valid.
error MetadataProvider__URIInvalid();
////////////////////////////////////////////////////////////////////////////
// LicenseRegistry //
////////////////////////////////////////////////////////////////////////////
error LicenseRegistry__PolicyAlreadySetForIpId();
error LicenseRegistry__FrameworkNotFound();
error LicenseRegistry__EmptyLicenseUrl();
error LicenseRegistry__InvalidPolicyFramework();
error LicenseRegistry__PolicyAlreadyAdded();
error LicenseRegistry__ParamVerifierLengthMismatch();
error LicenseRegistry__PolicyNotFound();
error LicenseRegistry__NotLicensee();
error LicenseRegistry__ParentIdEqualThanChild();
error LicenseRegistry__LicensorDoesntHaveThisPolicy();
error LicenseRegistry__MintLicenseParamFailed();
error LicenseRegistry__LinkParentParamFailed();
error LicenseRegistry__TransferParamFailed();
error LicenseRegistry__InvalidLicensor();
error LicenseRegistry__ParamVerifierAlreadySet();
error LicenseRegistry__CommercialTermInNonCommercialPolicy();
error LicenseRegistry__EmptyParamName();
error LicenseRegistry__UnregisteredFrameworkAddingPolicy();
error LicenseRegistry__UnauthorizedAccess();
error LicenseRegistry__LicensorNotRegistered();
error LicenseRegistry__CallerNotLicensorAndPolicyNotSet();
////////////////////////////////////////////////////////////////////////////
// LicenseRegistryAware //
////////////////////////////////////////////////////////////////////////////
error LicenseRegistryAware__CallerNotLicenseRegistry();
////////////////////////////////////////////////////////////////////////////
// PolicyFrameworkManager //
////////////////////////////////////////////////////////////////////////////
error PolicyFrameworkManager__GettingPolicyWrongFramework();
////////////////////////////////////////////////////////////////////////////
// LicensorApprovalChecker //
////////////////////////////////////////////////////////////////////////////
error LicensorApprovalChecker__Unauthorized();
////////////////////////////////////////////////////////////////////////////
// Dispute Module //
////////////////////////////////////////////////////////////////////////////
error DisputeModule__ZeroArbitrationPolicy();
error DisputeModule__ZeroArbitrationRelayer();
error DisputeModule__ZeroDisputeTag();
error DisputeModule__ZeroLinkToDisputeEvidence();
error DisputeModule__NotWhitelistedArbitrationPolicy();
error DisputeModule__NotWhitelistedDisputeTag();
error DisputeModule__NotWhitelistedArbitrationRelayer();
error DisputeModule__NotDisputeInitiator();
error DisputeModule__NotInDisputeState();
error DisputeModule__NotAbleToResolve();
error ArbitrationPolicySP__ZeroDisputeModule();
error ArbitrationPolicySP__ZeroPaymentToken();
error ArbitrationPolicySP__NotDisputeModule();
////////////////////////////////////////////////////////////////////////////
// Royalty Module //
////////////////////////////////////////////////////////////////////////////
error RoyaltyModule__ZeroRoyaltyPolicy();
error RoyaltyModule__NotWhitelistedRoyaltyPolicy();
error RoyaltyModule__AlreadySetRoyaltyPolicy();
error RoyaltyModule__ZeroRoyaltyToken();
error RoyaltyModule__NotWhitelistedRoyaltyToken();
error RoyaltyModule__NoRoyaltyPolicySet();
error RoyaltyModule__IncompatibleRoyaltyPolicy();
error RoyaltyPolicyLS__ZeroRoyaltyModule();
error RoyaltyPolicyLS__ZeroLiquidSplitFactory();
error RoyaltyPolicyLS__ZeroLiquidSplitMain();
error RoyaltyPolicyLS__NotRoyaltyModule();
error RoyaltyPolicyLS__TransferFailed();
error RoyaltyPolicyLS__InvalidMinRoyalty();
error RoyaltyPolicyLS__InvalidRoyaltyStack();
error RoyaltyPolicyLS__ZeroMinRoyalty();
error RoyaltyPolicyLS__ZeroLicenseRegistry();
error LSClaimer__InvalidPath();
error LSClaimer__InvalidPathFirstPosition();
error LSClaimer__InvalidPathLastPosition();
error LSClaimer__AlreadyClaimed();
error LSClaimer__ZeroRNFT();
error LSClaimer__RNFTAlreadySet();
error LSClaimer__ETHBalanceNotZero();
error LSClaimer__ERC20BalanceNotZero();
error LSClaimer__ZeroIpId();
error LSClaimer__ZeroLicenseRegistry();
error LSClaimer__ZeroRoyaltyPolicyLS();
error LSClaimer__NotRoyaltyPolicyLS();
////////////////////////////////////////////////////////////////////////////
// ModuleRegistry //
////////////////////////////////////////////////////////////////////////////
error ModuleRegistry__ModuleAddressZeroAddress();
error ModuleRegistry__ModuleAddressNotContract();
error ModuleRegistry__ModuleAlreadyRegistered();
error ModuleRegistry__NameEmptyString();
error ModuleRegistry__NameAlreadyRegistered();
error ModuleRegistry__NameDoesNotMatch();
error ModuleRegistry__ModuleNotRegistered();
////////////////////////////////////////////////////////////////////////////
// RegistrationModule //
////////////////////////////////////////////////////////////////////////////
/// @notice The caller is not the owner of the root IP NFT.
error RegistrationModule__InvalidOwner();
////////////////////////////////////////////////////////////////////////////
// AccessController //
////////////////////////////////////////////////////////////////////////////
error AccessController__IPAccountIsZeroAddress();
error AccessController__IPAccountIsNotValid();
error AccessController__SignerIsZeroAddress();
error AccessController__CallerIsNotIPAccount();
error AccessController__PermissionIsNotValid();
////////////////////////////////////////////////////////////////////////////
// TaggingModule //
////////////////////////////////////////////////////////////////////////////
error TaggingModule__InvalidRelationTypeName();
error TaggingModule__RelationTypeAlreadyExists();
error TaggingModule__SrcIpIdDoesNotHaveSrcTag();
error TaggingModule__DstIpIdDoesNotHaveDstTag();
error TaggingModule__RelationTypeDoesNotExist();
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Interface that must be implemented by smart contracts in order to receive
* ERC-1155 token transfers.
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
import { Licensing } from "contracts/lib/Licensing.sol";
/// @title ILicenseRegistry
/// @notice Interface for the LicenseRegistry contract, which is the main entry point for the licensing system.
/// It is responsible for:
/// - Registering policy frameworks
/// - Registering policies
/// - Minting licenses
/// - Linking IP to its parent
/// - Verifying transfer parameters (through the ITransferParamVerifier interface implementation by the policy framework)
/// - Verifying linking parameters (through the ILinkParamVerifier interface implementation by the policy framework)
/// - Verifying policy parameters (through the IPolicyVerifier interface implementation by the policy framework)
interface ILicenseRegistry {
/// @notice Emitted when a policy framework is created by registering a policy framework manager
/// @param framework The address of the IPolicyFrameworkManager
/// @param framework The policy framework data
event PolicyFrameworkRegistered(
address indexed framework,
string name,
string licenseTextUrl
);
/// @notice Emitted when a policy is added to the contract
/// @param policyFrameworkManager The address that created the policy
/// @param policyId The id of the policy
/// @param policy The encoded policy data
event PolicyRegistered(
address indexed policyFrameworkManager,
uint256 indexed policyId,
bytes policy
);
/// @notice Emitted when a policy is added to an IP
/// @param caller The address that called the function
/// @param ipId The id of the IP
/// @param policyId The id of the policy
/// @param index The index of the policy in the IP's policy list
/// @param inheritedPolicy Whether the policy was inherited from a parent IP (linking) or set by IP owner
event PolicyAddedToIpId(
address indexed caller,
address indexed ipId,
uint256 indexed policyId,
uint256 index,
bool inheritedPolicy
);
/// @notice Emitted when a license is minted
/// @param creator The address that created the license
/// @param receiver The address that received the license
/// @param licenseId The id of the license
/// @param amount The amount of licenses minted
/// @param licenseData The license data
event LicenseMinted(
address indexed creator,
address indexed receiver,
uint256 indexed licenseId,
uint256 amount,
Licensing.License licenseData
);
/// @notice Emitted when an IP is linked to its parent by burning a license
/// @param caller The address that called the function
/// @param ipId The id of the IP
/// @param parentIpIds The ids of the parent IP
event IpIdLinkedToParents(address indexed caller, address indexed ipId, address[] indexed parentIpIds);
/// @notice Registers a policy framework manager into the contract, so it can add policy data for
/// licenses.
/// @param manager the address of the manager. Will be ERC165 checked for IPolicyFrameworkManager
function registerPolicyFrameworkManager(address manager) external;
/// @notice Registers a policy into the contract. MUST be called by a registered
/// framework or it will revert. The policy data and its integrity must be
/// verified by the policy framework manager.
/// @param data The policy data
function registerPolicy(bytes memory data) external returns (uint256 policyId);
/// @notice Adds a policy to an IP policy list
/// @param ipId The id of the IP
/// @param polId The id of the policy
/// @return indexOnIpId The index of the policy in the IP's policy list
function addPolicyToIp(address ipId, uint256 polId) external returns (uint256 indexOnIpId);
/// @notice Mints a license to create derivative IP
/// @param policyId The id of the policy with the licensing parameters
/// @param licensorIpId The id of the licensor IP
/// @param amount The amount of licenses to mint
/// @param receiver The address that will receive the license
function mintLicense(
uint256 policyId,
address licensorIpId,
uint256 amount,
address receiver
) external returns (uint256 licenseId);
/// @notice Links an IP to the licensors (parent IP IDs) listed in the License NFTs, if their policies allow it,
/// burning the NFTs in the proccess. The caller must be the owner of the NFTs and the IP owner.
/// @param licenseIds The id of the licenses to burn
/// @param childIpId The id of the child IP to be linked
/// @param holder The address that holds the license
function linkIpToParents(uint256[] calldata licenseIds, address childIpId, address holder) external;
///
/// Getters
///
/// @notice True if the framework address is registered in LicenseRegistry
function isFrameworkRegistered(address framework) external view returns (bool);
/// @notice Gets total number of policies (framework parameter configurations) in the contract
function totalPolicies() external view returns (uint256);
/// @notice Gets policy data by id
function policy(uint256 policyId) external view returns (Licensing.Policy memory pol);
/// @notice True if policy is defined in the contract
function isPolicyDefined(uint256 policyId) external view returns (bool);
/// @notice Gets the policy ids for an IP
function policyIdsForIp(address ipId) external view returns (uint256[] memory policyIds);
/// @notice Gets total number of policies for an IP
function totalPoliciesForIp(address ipId) external view returns (uint256);
/// @notice True if policy is part of an IP's policy list
function isPolicyIdSetForIp(address ipId, uint256 policyId) external view returns (bool);
/// @notice Gets the policy ID for an IP by index on the IP's policy list
function policyIdForIpAtIndex(address ipId, uint256 index) external view returns (uint256 policyId);
/// @notice Gets the policy for an IP by index on the IP's policy list
function policyForIpAtIndex(address ipId, uint256 index) external view returns (Licensing.Policy memory);
/// @notice Gets the index of a policy in an IP's policy list
function indexOfPolicyForIp(address ipId, uint256 policyId) external view returns (uint256 index);
/// @notice True if the license was added to the IP by linking (burning a license)
function isPolicyInherited(address ipId, uint256 policyId) external view returns (bool);
/// @notice True if holder is the licensee for the license (owner of the license NFT), or derivative IP owner if
/// the license was added to the IP by linking (burning a license)
function isLicensee(uint256 licenseId, address holder) external view returns (bool);
/// @notice IP ID of the licensor for the license (parent IP)
function licensorIpId(uint256 licenseId) external view returns (address);
/// @notice License data (licensor, policy...) for the license id
function license(uint256 licenseId) external view returns (Licensing.License memory);
/// @notice True if an IP is a derivative of another IP
function isParent(address parentIpId, address childIpId) external view returns (bool);
/// @notice Returns the parent IP IDs for an IP ID
function parentIpIds(address ipId) external view returns (address[] memory);
/// @notice Total number of parents for an IP ID
function totalParentsForIpId(address ipId) external view returns (uint256);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/// @title Liquid split policy claimer interface
interface ILSClaimer {
/// @notice Event emitted when a claim is made
/// @param path The path from the ipId to the claimer
/// @param claimer The claimer ipId address
/// @param withdrawETH Indicates if the claimer wants to withdraw ETH
/// @param tokens The ERC20 tokens to withdraw
event Claimed(address[] path, address claimer, bool withdrawETH, ERC20[] tokens);
/// @notice Allows an ipId to claim their rnfts and accrued royalties
/// @param path The path of the ipId
/// @param claimerIpId The ipId of the claimer
/// @param withdrawETH Indicates if the claimer wants to withdraw ETH
/// @param tokens The ERC20 tokens to withdraw
function claim(address[] calldata path, address claimerIpId, bool withdrawETH, ERC20[] calldata tokens) external;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
/// @title RoyaltyPolicy interface
interface IRoyaltyPolicy {
/// @notice Initializes the royalty policy
/// @param ipId The ipId
/// @param parentsIpIds The parent ipIds
/// @param data The data to initialize the policy
function initPolicy(address ipId, address[] calldata parentsIpIds, bytes calldata data) external;
/// @notice Allows to pay a royalty
/// @param caller The caller
/// @param ipId The ipId
/// @param token The token to pay
/// @param amount The amount to pay
function onRoyaltyPayment(address caller, address ipId, address token, uint256 amount) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* 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[EIP 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);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;
import { IPolicyVerifier } from "../interfaces/licensing/IPolicyVerifier.sol";
import { Errors } from "./Errors.sol";
/// @title Licensing
/// @notice Types and constants used by the licensing related contracts
library Licensing {
/// @notice A particular configuration (flavor) of a Policy Framework, setting values for the licensing
/// terms (parameters) of the framework.
/// @param policyFramework address of the IPolicyFrameworkManager this policy is based on
/// @param data Encoded data for the policy, specific to the policy framework
struct Policy {
address policyFramework;
bytes data;
}
/// @notice Data that define a License Agreement NFT
/// @param policyId Id of the policy this license is based on, which will be set in the derivative
/// IP when the license is burnt
/// @param licensorIpId Id of the IP this license is for
struct License {
uint256 policyId;
address licensorIpId;
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
import { IERC165 } from "@openzeppelin/contracts/interfaces/IERC165.sol";
/// @title IPolicyVerifier
/// @notice Placeholder interface for verifying policy parameters.
interface IPolicyVerifier is IERC165 {
}// 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";{
"remappings": [
"@openzeppelin/=node_modules/@openzeppelin/",
"base64-sol/=node_modules/base64-sol/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"hardhat-deploy/=node_modules/hardhat-deploy/",
"hardhat/=node_modules/hardhat/",
"openzeppelin-contracts/=lib/reference/lib/openzeppelin-contracts/",
"reference/=lib/reference/"
],
"optimizer": {
"enabled": true,
"runs": 20000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"libraries": {
"contracts/lib/registries/IPAccountChecker.sol": {
"IPAccountChecker": "0x4687d14d30ea46a60499c2dcc07a56d2d1590fc3"
}
}
}Contract ABI
API[{"inputs":[{"internalType":"address","name":"_royaltyModule","type":"address"},{"internalType":"address","name":"_licenseRegistry","type":"address"},{"internalType":"address","name":"_liquidSplitFactory","type":"address"},{"internalType":"address","name":"_liquidSplitMain","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"RoyaltyPolicyLS__InvalidMinRoyalty","type":"error"},{"inputs":[],"name":"RoyaltyPolicyLS__InvalidRoyaltyStack","type":"error"},{"inputs":[],"name":"RoyaltyPolicyLS__NotRoyaltyModule","type":"error"},{"inputs":[],"name":"RoyaltyPolicyLS__ZeroLicenseRegistry","type":"error"},{"inputs":[],"name":"RoyaltyPolicyLS__ZeroLiquidSplitFactory","type":"error"},{"inputs":[],"name":"RoyaltyPolicyLS__ZeroLiquidSplitMain","type":"error"},{"inputs":[],"name":"RoyaltyPolicyLS__ZeroMinRoyalty","type":"error"},{"inputs":[],"name":"RoyaltyPolicyLS__ZeroRoyaltyModule","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"LICENSE_REGISTRY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIQUID_SPLIT_FACTORY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIQUID_SPLIT_MAIN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROYALTY_MODULE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOTAL_RNFT_SUPPLY","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_withdrawETH","type":"uint256"},{"internalType":"contract ERC20[]","name":"_tokens","type":"address[]"}],"name":"claimRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ipId","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"address","name":"_distributorAddress","type":"address"}],"name":"distributeFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ipId","type":"address"},{"internalType":"address[]","name":"_parentIpIds","type":"address[]"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"initPolicy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address","name":"_ipId","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"onRoyaltyPayment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"ipId","type":"address"}],"name":"royaltyData","outputs":[{"internalType":"address","name":"splitClone","type":"address"},{"internalType":"address","name":"claimer","type":"address"},{"internalType":"uint32","name":"royaltyStack","type":"uint32"},{"internalType":"uint32","name":"minRoyalty","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
0x6101006040523480156200001257600080fd5b50604051620033db380380620033db833981016040819052620000359162000114565b6001600160a01b0384166200005d576040516312f08b9560e11b815260040160405180910390fd5b6001600160a01b0383166200008457604051628100a760e61b815260040160405180910390fd5b6001600160a01b038216620000ac5760405163281a770f60e01b815260040160405180910390fd5b6001600160a01b038116620000d45760405163ef65d3a960e01b815260040160405180910390fd5b6001600160a01b0393841660805291831660a052821660c0521660e05262000171565b80516001600160a01b03811681146200010f57600080fd5b919050565b600080600080608085870312156200012b57600080fd5b6200013685620000f7565b93506200014660208601620000f7565b92506200015660408601620000f7565b91506200016660608601620000f7565b905092959194509250565b60805160a05160c05160e05161320d620001ce6000396000818161027701526108fa0152600081816102100152610c0501526000818161035501526105850152600081816102b6015281816104640152610751015261320d6000f3fe60806040523480156200001157600080fd5b5060043610620000f15760003560e01c80635be8968b1162000097578063bc197c81116200006e578063bc197c8114620002ef578063ca6344bc1462000338578063f0ebdc83146200034f578063f23a6e61146200037757600080fd5b80635be8968b146200029957806373b7ce2814620002b05780637c8dc3a414620002d857600080fd5b80631c184e1d11620000cc5780631c184e1d146200020a5780632fd0a9bf14620002585780633c6940d5146200027157600080fd5b806301ffc9a714620000f657806305f4280f146200012257806308e21ede1462000142575b600080fd5b6200010d6200010736600462000f59565b620003b2565b60405190151581526020015b60405180910390f35b6200012c6103e881565b60405163ffffffff909116815260200162000119565b620001c56200015336600462000fc0565b6000602081905290815260409020805460019091015473ffffffffffffffffffffffffffffffffffffffff9182169181169063ffffffff740100000000000000000000000000000000000000008204811691780100000000000000000000000000000000000000000000000090041684565b6040805173ffffffffffffffffffffffffffffffffffffffff958616815294909316602085015263ffffffff9182169284019290925216606082015260800162000119565b620002327f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200162000119565b6200026f620002693660046200102f565b6200044c565b005b620002327f000000000000000000000000000000000000000000000000000000000000000081565b6200026f620002aa366004620010e6565b62000739565b620002327f000000000000000000000000000000000000000000000000000000000000000081565b6200026f620002e93660046200113e565b620007ea565b620003066200030036600462001364565b62000892565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200162000119565b6200026f6200034936600462001420565b620008bd565b620002327f000000000000000000000000000000000000000000000000000000000000000081565b620003066200038836600462001482565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806200044657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614620004bc576040517f66b6bc2f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000620004cc82840184620014f3565b905063ffffffff8116158015620004e257508315155b156200051a576040517f4dd2445e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000527600a826200151b565b63ffffffff161562000565576040517f442b256b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806200057587878562000971565b90925090503086156200060157887f000000000000000000000000000000000000000000000000000000000000000030604051620005b39062000f4b565b73ffffffffffffffffffffffffffffffffffffffff938416815291831660208301529091166040820152606001604051809103906000f080158015620005fd573d6000803e3d6000fd5b5090505b6000620006108a838662000a86565b6040805160808101825273ffffffffffffffffffffffffffffffffffffffff9283168152938216602080860191825263ffffffff968716868401908152988716606087019081529d841660009081529081905291909120935184547fffffffffffffffffffffffff000000000000000000000000000000000000000016908316178455516001909301805496519b51939091167fffffffffffffffff00000000000000000000000000000000000000000000000090961695909517740100000000000000000000000000000000000000009a84169a909a02999099177fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff167801000000000000000000000000000000000000000000000000919092160217909155505050505050565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614620007a9576040517f66b6bc2f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260208190526040902054811690620007e390841686838562000c95565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff808616600090815260208190526040908190205490517fd3561ecd00000000000000000000000000000000000000000000000000000000815291169063d3561ecd906200085790879087908790879060040162001566565b600060405180830381600087803b1580156200087257600080fd5b505af115801562000887573d6000803e3d6000fd5b505050505050505050565b7fbc197c81000000000000000000000000000000000000000000000000000000005b95945050505050565b6040517f6e5f691900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690636e5f69199062000937908790879087908790600401620015df565b600060405180830381600087803b1580156200095257600080fd5b505af115801562000967573d6000803e3d6000fd5b5050505050505050565b60008080805b63ffffffff811686111562000a265760008088888463ffffffff16818110620009a457620009a462001653565b9050602002016020810190620009bb919062000fc0565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040016000206001015462000a0f9074010000000000000000000000000000000000000000900463ffffffff1683620016b1565b91508062000a1d81620016d8565b91505062000977565b50600062000a358583620016b1565b90506103e863ffffffff8216111562000a7a576040517f699601df00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b90969095509350505050565b60408051600280825260608201835260009283929190602083019080368337019050509050848160008151811062000ac25762000ac262001653565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050838160018151811062000b135762000b1362001653565b73ffffffffffffffffffffffffffffffffffffffff92909216602092830291909101820152604080516002808252606082018352600093919290918301908036833701905050905062000b69846103e8620016fe565b8160008151811062000b7f5762000b7f62001653565b602002602001019063ffffffff16908163ffffffff1681525050838160018151811062000bb05762000bb062001653565b63ffffffff909216602092830291909101909101526040517fd621faa900000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063d621faa99062000c429086908690869081906004016200171e565b6020604051808303816000875af115801562000c62573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c889190620017e7565b93505050505b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905262000d2c90859062000d32565b50505050565b600062000d5673ffffffffffffffffffffffffffffffffffffffff84168362000dd8565b9050805160001415801562000d7e57508080602001905181019062000d7c919062001807565b155b1562000dd3576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b505050565b606062000c8e83836000846000808573ffffffffffffffffffffffffffffffffffffffff16848660405162000e0e91906200182b565b60006040518083038185875af1925050503d806000811462000e4d576040519150601f19603f3d011682016040523d82523d6000602084013e62000e52565b606091505b509150915062000e6486838362000e6e565b9695505050505050565b60608262000e875762000e818262000f05565b62000c8e565b815115801562000eac575073ffffffffffffffffffffffffffffffffffffffff84163b155b1562000efd576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240162000dca565b508062000c8e565b80511562000f165780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b61197b806200185d83390190565b60006020828403121562000f6c57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811462000c8e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811462000f4857600080fd5b60006020828403121562000fd357600080fd5b813562000c8e8162000f9d565b60008083601f84011262000ff357600080fd5b50813567ffffffffffffffff8111156200100c57600080fd5b6020830191508360208260051b85010111156200102857600080fd5b9250929050565b6000806000806000606086880312156200104857600080fd5b8535620010558162000f9d565b9450602086013567ffffffffffffffff808211156200107357600080fd5b6200108189838a0162000fe0565b909650945060408801359150808211156200109b57600080fd5b818801915088601f830112620010b057600080fd5b813581811115620010c057600080fd5b896020828501011115620010d357600080fd5b9699959850939650602001949392505050565b60008060008060808587031215620010fd57600080fd5b84356200110a8162000f9d565b935060208501356200111c8162000f9d565b925060408501356200112e8162000f9d565b9396929550929360600135925050565b6000806000806000608086880312156200115757600080fd5b8535620011648162000f9d565b94506020860135620011768162000f9d565b9350604086013567ffffffffffffffff8111156200119357600080fd5b620011a18882890162000fe0565b9094509250506060860135620011b78162000f9d565b809150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200123e576200123e620011c5565b604052919050565b600082601f8301126200125857600080fd5b8135602067ffffffffffffffff821115620012775762001277620011c5565b8160051b62001288828201620011f4565b9283528481018201928281019087851115620012a357600080fd5b83870192505b84831015620012c457823582529183019190830190620012a9565b979650505050505050565b600082601f830112620012e157600080fd5b813567ffffffffffffffff811115620012fe57620012fe620011c5565b6200133160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601620011f4565b8181528460208386010111156200134757600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156200137d57600080fd5b85356200138a8162000f9d565b945060208601356200139c8162000f9d565b9350604086013567ffffffffffffffff80821115620013ba57600080fd5b620013c889838a0162001246565b94506060880135915080821115620013df57600080fd5b620013ed89838a0162001246565b935060808801359150808211156200140457600080fd5b506200141388828901620012cf565b9150509295509295909350565b600080600080606085870312156200143757600080fd5b8435620014448162000f9d565b935060208501359250604085013567ffffffffffffffff8111156200146857600080fd5b620014768782880162000fe0565b95989497509550505050565b600080600080600060a086880312156200149b57600080fd5b8535620014a88162000f9d565b94506020860135620014ba8162000f9d565b93506040860135925060608601359150608086013567ffffffffffffffff811115620014e557600080fd5b6200141388828901620012cf565b6000602082840312156200150657600080fd5b813563ffffffff8116811462000c8e57600080fd5b600063ffffffff808416806200155a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910692915050565b73ffffffffffffffffffffffffffffffffffffffff858116825260606020808401829052908301859052600091869160808501845b88811015620015c6578435620015b18162000f9d565b8416825293820193908201906001016200159b565b5080945050508085166040850152505095945050505050565b73ffffffffffffffffffffffffffffffffffffffff858116825260208083018690526060604084018190528301849052600091859160808501845b8781101562001645578435620016308162000f9d565b8416825293820193908201906001016200161a565b509998505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b63ffffffff818116838216019080821115620016d157620016d162001682565b5092915050565b600063ffffffff808316818103620016f457620016f462001682565b6001019392505050565b63ffffffff828116828216039080821115620016d157620016d162001682565b6080808252855190820181905260009060209060a0840190828901845b828110156200176f57815173ffffffffffffffffffffffffffffffffffffffff16845292840192908401906001016200173b565b5050508381038285015286518082528783019183019060005b81811015620017ac57835163ffffffff168352928401929184019160010162001788565b505063ffffffff871660408601529250620017c5915050565b73ffffffffffffffffffffffffffffffffffffffff83166060830152620008b4565b600060208284031215620017fa57600080fd5b815162000c8e8162000f9d565b6000602082840312156200181a57600080fd5b8151801515811462000c8e57600080fd5b6000825160005b818110156200184e576020818601810151858301520162001832565b50600092019182525091905056fe60e06040523480156200001157600080fd5b506040516200197b3803806200197b8339810160408190526200003491620000ec565b60016000556001600160a01b0383166200006157604051633b2bdb6f60e01b815260040160405180910390fd5b6001600160a01b0382166200008957604051634dfcc82d60e01b815260040160405180910390fd5b6001600160a01b038116620000b1576040516356d340bb60e01b815260040160405180910390fd5b6001600160a01b0392831660c0529082166080521660a05262000136565b80516001600160a01b0381168114620000e757600080fd5b919050565b6000806000606084860312156200010257600080fd5b6200010d84620000cf565b92506200011d60208501620000cf565b91506200012d60408501620000cf565b90509250925092565b60805160a05160c0516117ec6200018f6000396000818160ba0152818161040101526104e6015260008181610165015281816105110152818161066901526109f601526000818161011b015261088901526117ec6000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806367b657e71161005b57806367b657e71461013d578063916aa4a714610160578063bc197c8114610187578063f23a6e61146101f057600080fd5b806301ffc9a71461008d5780633b7d592e146100b55780634d3d1243146101015780634faa26fc14610116575b600080fd5b6100a061009b3660046110a8565b610228565b60405190151581526020015b60405180910390f35b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ac565b61011461010f366004611166565b6102c1565b005b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6100a061014b3660046111ff565b60016020526000908152604090205460ff1681565b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6101bf6101953660046113a4565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016100ac565b6101bf6101fe366004611452565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806102bb57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6102c961082f565b600086866040516020016102de9291906114bb565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152600190935291205490915060ff161561035e576040517f3197f46100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16878760008181106103885761038861150a565b905060200201602081019061039d9190611539565b73ffffffffffffffffffffffffffffffffffffffff16146103ea576040517f0f4609d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016878761042e600182611585565b81811061043d5761043d61150a565b90506020020160208101906104529190611539565b73ffffffffffffffffffffffffffffffffffffffff161461049f576040517fcc92cf1400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104a98787610872565b6040517f08e21ede00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526000917f0000000000000000000000000000000000000000000000000000000000000000909116906308e21ede90602401608060405180830381865afa15801561055a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057e91906115b1565b50506040517efdd58e0000000000000000000000000000000000000000000000000000000081523060048201526000602482018190529293508392915073ffffffffffffffffffffffffffffffffffffffff83169062fdd58e90604401602060405180830381865afa1580156105f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061c919061160a565b6040517f08e21ede00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a8116600483015291925060009182917f0000000000000000000000000000000000000000000000000000000000000000909116906308e21ede90602401608060405180830381865afa1580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d691906115b1565b6040517ff242432a00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff808616602483015260006044830181905263ffffffff8416606484015260a0608484015260a48301529496509094509287169263f242432a925060c4019050600060405180830381600087803b15801561077057600080fd5b505af1158015610784573d6000803e3d6000fd5b5050505061079c8163ffffffff1684848c8c8c6109f2565b60008681526001602081905260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055517fe3a6596357b1424e59dc4645a4dcfafe4f38248034eddca95cf429df2f3448289061080f908e908e908e908e908e908e90611623565b60405180910390a15050505050506108276001600055565b505050505050565b60026000540361086b576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600055565b60005b610880600183611585565b8110156109ed577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d18f8ba08484848181106108d5576108d561150a565b90506020020160208101906108ea9190611539565b85856108f78660016116e8565b8181106109065761090661150a565b905060200201602081019061091b9190611539565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa15801561098b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109af91906116fb565b6109e5576040517faa49191800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600101610875565b505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16633c6940d56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a839190611718565b90508315610b77576040517f3bb66a7b00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff821690633bb66a7b90602401602060405180830381865afa158015610af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b19919061160a565b15610b50576040517fbeaa8af300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47600087610b5e8a84611735565b610b68919061174c565b9050610b748782610da5565b50505b60005b82811015610d9b5760018273ffffffffffffffffffffffffffffffffffffffff1663c3a8962c30878786818110610bb357610bb361150a565b9050602002016020810190610bc89190611539565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa158015610c38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5c919061160a565b1115610c94576040517fb488cffd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848483818110610ca857610ca861150a565b9050602002016020810190610cbd9190611539565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015610d2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d51919061160a565b9050600089610d608c84611735565b610d6a919061174c565b9050610d8d73ffffffffffffffffffffffffffffffffffffffff84168a83610dea565b505050806001019050610b7a565b5050505050505050565b600080600080600085875af19050806109ed576040517fdb8096c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092019092526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526109ed91859190600090610e8390841683610efc565b90508051600014158015610ea8575080806020019051810190610ea691906116fb565b155b156109ed576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b6060610f0a83836000610f11565b9392505050565b606081471015610f4f576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401610ef3565b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051610f789190611787565b60006040518083038185875af1925050503d8060008114610fb5576040519150601f19603f3d011682016040523d82523d6000602084013e610fba565b606091505b5091509150610fca868383610fd4565b9695505050505050565b606082610fe957610fe482611063565b610f0a565b815115801561100d575073ffffffffffffffffffffffffffffffffffffffff84163b155b1561105c576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610ef3565b5080610f0a565b8051156110735780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6000602082840312156110ba57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610f0a57600080fd5b60008083601f8401126110fc57600080fd5b50813567ffffffffffffffff81111561111457600080fd5b6020830191508360208260051b850101111561112f57600080fd5b9250929050565b73ffffffffffffffffffffffffffffffffffffffff811681146110a557600080fd5b80151581146110a557600080fd5b6000806000806000806080878903121561117f57600080fd5b863567ffffffffffffffff8082111561119757600080fd5b6111a38a838b016110ea565b9098509650602089013591506111b882611136565b9094506040880135906111ca82611158565b909350606088013590808211156111e057600080fd5b506111ed89828a016110ea565b979a9699509497509295939492505050565b60006020828403121561121157600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561128e5761128e611218565b604052919050565b600082601f8301126112a757600080fd5b8135602067ffffffffffffffff8211156112c3576112c3611218565b8160051b6112d2828201611247565b92835284810182019282810190878511156112ec57600080fd5b83870192505b8483101561130b578235825291830191908301906112f2565b979650505050505050565b600082601f83011261132757600080fd5b813567ffffffffffffffff81111561134157611341611218565b61137260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611247565b81815284602083860101111561138757600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156113bc57600080fd5b85356113c781611136565b945060208601356113d781611136565b9350604086013567ffffffffffffffff808211156113f457600080fd5b61140089838a01611296565b9450606088013591508082111561141657600080fd5b61142289838a01611296565b9350608088013591508082111561143857600080fd5b5061144588828901611316565b9150509295509295909350565b600080600080600060a0868803121561146a57600080fd5b853561147581611136565b9450602086013561148581611136565b93506040860135925060608601359150608086013567ffffffffffffffff8111156114af57600080fd5b61144588828901611316565b60008184825b858110156114ff5781356114d481611136565b73ffffffffffffffffffffffffffffffffffffffff16835260209283019291909101906001016114c1565b509095945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561154b57600080fd5b8135610f0a81611136565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156102bb576102bb611556565b805163ffffffff811681146115ac57600080fd5b919050565b600080600080608085870312156115c757600080fd5b84516115d281611136565b60208601519094506115e381611136565b92506115f160408601611598565b91506115ff60608601611598565b905092959194509250565b60006020828403121561161c57600080fd5b5051919050565b6080808252810186905260008760a08301825b8981101561167357823561164981611136565b73ffffffffffffffffffffffffffffffffffffffff16825260209283019290910190600101611636565b5073ffffffffffffffffffffffffffffffffffffffff8881166020868101919091528815156040870152858303606087015286835292508691830160005b878110156116d85783356116c481611136565b8316825292840192908401906001016116b1565b509b9a5050505050505050505050565b808201808211156102bb576102bb611556565b60006020828403121561170d57600080fd5b8151610f0a81611158565b60006020828403121561172a57600080fd5b8151610f0a81611136565b80820281158282048414176102bb576102bb611556565b600082611782577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000825160005b818110156117a8576020818601810151858301520161178e565b50600092019182525091905056fea26469706673582212203a5fbb28b30fdede9fe0dd4667db7db5d937e62523ba3521ffe2f3f5de08521f64736f6c63430008170033a26469706673582212204d2db41374afcf1d3afbf1105c3d54afe63a8b5029ec90849bfc012c3e259eeb64736f6c63430008170033000000000000000000000000f3588318bc9f4ea6c23f8f62f8440bcd4172fa95000000000000000000000000754ae6e1533c91123960fa99de306a48cbf7a03a000000000000000000000000f678bae6091ab6933425fe26afc20ee5f324c4ae00000000000000000000000057cbfa83f000a38c5b5881743e298819c503a559
Deployed Bytecode
0x60806040523480156200001157600080fd5b5060043610620000f15760003560e01c80635be8968b1162000097578063bc197c81116200006e578063bc197c8114620002ef578063ca6344bc1462000338578063f0ebdc83146200034f578063f23a6e61146200037757600080fd5b80635be8968b146200029957806373b7ce2814620002b05780637c8dc3a414620002d857600080fd5b80631c184e1d11620000cc5780631c184e1d146200020a5780632fd0a9bf14620002585780633c6940d5146200027157600080fd5b806301ffc9a714620000f657806305f4280f146200012257806308e21ede1462000142575b600080fd5b6200010d6200010736600462000f59565b620003b2565b60405190151581526020015b60405180910390f35b6200012c6103e881565b60405163ffffffff909116815260200162000119565b620001c56200015336600462000fc0565b6000602081905290815260409020805460019091015473ffffffffffffffffffffffffffffffffffffffff9182169181169063ffffffff740100000000000000000000000000000000000000008204811691780100000000000000000000000000000000000000000000000090041684565b6040805173ffffffffffffffffffffffffffffffffffffffff958616815294909316602085015263ffffffff9182169284019290925216606082015260800162000119565b620002327f000000000000000000000000f678bae6091ab6933425fe26afc20ee5f324c4ae81565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200162000119565b6200026f620002693660046200102f565b6200044c565b005b620002327f00000000000000000000000057cbfa83f000a38c5b5881743e298819c503a55981565b6200026f620002aa366004620010e6565b62000739565b620002327f000000000000000000000000f3588318bc9f4ea6c23f8f62f8440bcd4172fa9581565b6200026f620002e93660046200113e565b620007ea565b620003066200030036600462001364565b62000892565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200162000119565b6200026f6200034936600462001420565b620008bd565b620002327f000000000000000000000000754ae6e1533c91123960fa99de306a48cbf7a03a81565b620003066200038836600462001482565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806200044657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000f3588318bc9f4ea6c23f8f62f8440bcd4172fa951614620004bc576040517f66b6bc2f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000620004cc82840184620014f3565b905063ffffffff8116158015620004e257508315155b156200051a576040517f4dd2445e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000527600a826200151b565b63ffffffff161562000565576040517f442b256b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806200057587878562000971565b90925090503086156200060157887f000000000000000000000000754ae6e1533c91123960fa99de306a48cbf7a03a30604051620005b39062000f4b565b73ffffffffffffffffffffffffffffffffffffffff938416815291831660208301529091166040820152606001604051809103906000f080158015620005fd573d6000803e3d6000fd5b5090505b6000620006108a838662000a86565b6040805160808101825273ffffffffffffffffffffffffffffffffffffffff9283168152938216602080860191825263ffffffff968716868401908152988716606087019081529d841660009081529081905291909120935184547fffffffffffffffffffffffff000000000000000000000000000000000000000016908316178455516001909301805496519b51939091167fffffffffffffffff00000000000000000000000000000000000000000000000090961695909517740100000000000000000000000000000000000000009a84169a909a02999099177fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff167801000000000000000000000000000000000000000000000000919092160217909155505050505050565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000f3588318bc9f4ea6c23f8f62f8440bcd4172fa951614620007a9576040517f66b6bc2f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260208190526040902054811690620007e390841686838562000c95565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff808616600090815260208190526040908190205490517fd3561ecd00000000000000000000000000000000000000000000000000000000815291169063d3561ecd906200085790879087908790879060040162001566565b600060405180830381600087803b1580156200087257600080fd5b505af115801562000887573d6000803e3d6000fd5b505050505050505050565b7fbc197c81000000000000000000000000000000000000000000000000000000005b95945050505050565b6040517f6e5f691900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000057cbfa83f000a38c5b5881743e298819c503a5591690636e5f69199062000937908790879087908790600401620015df565b600060405180830381600087803b1580156200095257600080fd5b505af115801562000967573d6000803e3d6000fd5b5050505050505050565b60008080805b63ffffffff811686111562000a265760008088888463ffffffff16818110620009a457620009a462001653565b9050602002016020810190620009bb919062000fc0565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040016000206001015462000a0f9074010000000000000000000000000000000000000000900463ffffffff1683620016b1565b91508062000a1d81620016d8565b91505062000977565b50600062000a358583620016b1565b90506103e863ffffffff8216111562000a7a576040517f699601df00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b90969095509350505050565b60408051600280825260608201835260009283929190602083019080368337019050509050848160008151811062000ac25762000ac262001653565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050838160018151811062000b135762000b1362001653565b73ffffffffffffffffffffffffffffffffffffffff92909216602092830291909101820152604080516002808252606082018352600093919290918301908036833701905050905062000b69846103e8620016fe565b8160008151811062000b7f5762000b7f62001653565b602002602001019063ffffffff16908163ffffffff1681525050838160018151811062000bb05762000bb062001653565b63ffffffff909216602092830291909101909101526040517fd621faa900000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000f678bae6091ab6933425fe26afc20ee5f324c4ae169063d621faa99062000c429086908690869081906004016200171e565b6020604051808303816000875af115801562000c62573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c889190620017e7565b93505050505b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905262000d2c90859062000d32565b50505050565b600062000d5673ffffffffffffffffffffffffffffffffffffffff84168362000dd8565b9050805160001415801562000d7e57508080602001905181019062000d7c919062001807565b155b1562000dd3576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b505050565b606062000c8e83836000846000808573ffffffffffffffffffffffffffffffffffffffff16848660405162000e0e91906200182b565b60006040518083038185875af1925050503d806000811462000e4d576040519150601f19603f3d011682016040523d82523d6000602084013e62000e52565b606091505b509150915062000e6486838362000e6e565b9695505050505050565b60608262000e875762000e818262000f05565b62000c8e565b815115801562000eac575073ffffffffffffffffffffffffffffffffffffffff84163b155b1562000efd576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240162000dca565b508062000c8e565b80511562000f165780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b61197b806200185d83390190565b60006020828403121562000f6c57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811462000c8e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116811462000f4857600080fd5b60006020828403121562000fd357600080fd5b813562000c8e8162000f9d565b60008083601f84011262000ff357600080fd5b50813567ffffffffffffffff8111156200100c57600080fd5b6020830191508360208260051b85010111156200102857600080fd5b9250929050565b6000806000806000606086880312156200104857600080fd5b8535620010558162000f9d565b9450602086013567ffffffffffffffff808211156200107357600080fd5b6200108189838a0162000fe0565b909650945060408801359150808211156200109b57600080fd5b818801915088601f830112620010b057600080fd5b813581811115620010c057600080fd5b896020828501011115620010d357600080fd5b9699959850939650602001949392505050565b60008060008060808587031215620010fd57600080fd5b84356200110a8162000f9d565b935060208501356200111c8162000f9d565b925060408501356200112e8162000f9d565b9396929550929360600135925050565b6000806000806000608086880312156200115757600080fd5b8535620011648162000f9d565b94506020860135620011768162000f9d565b9350604086013567ffffffffffffffff8111156200119357600080fd5b620011a18882890162000fe0565b9094509250506060860135620011b78162000f9d565b809150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200123e576200123e620011c5565b604052919050565b600082601f8301126200125857600080fd5b8135602067ffffffffffffffff821115620012775762001277620011c5565b8160051b62001288828201620011f4565b9283528481018201928281019087851115620012a357600080fd5b83870192505b84831015620012c457823582529183019190830190620012a9565b979650505050505050565b600082601f830112620012e157600080fd5b813567ffffffffffffffff811115620012fe57620012fe620011c5565b6200133160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601620011f4565b8181528460208386010111156200134757600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156200137d57600080fd5b85356200138a8162000f9d565b945060208601356200139c8162000f9d565b9350604086013567ffffffffffffffff80821115620013ba57600080fd5b620013c889838a0162001246565b94506060880135915080821115620013df57600080fd5b620013ed89838a0162001246565b935060808801359150808211156200140457600080fd5b506200141388828901620012cf565b9150509295509295909350565b600080600080606085870312156200143757600080fd5b8435620014448162000f9d565b935060208501359250604085013567ffffffffffffffff8111156200146857600080fd5b620014768782880162000fe0565b95989497509550505050565b600080600080600060a086880312156200149b57600080fd5b8535620014a88162000f9d565b94506020860135620014ba8162000f9d565b93506040860135925060608601359150608086013567ffffffffffffffff811115620014e557600080fd5b6200141388828901620012cf565b6000602082840312156200150657600080fd5b813563ffffffff8116811462000c8e57600080fd5b600063ffffffff808416806200155a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910692915050565b73ffffffffffffffffffffffffffffffffffffffff858116825260606020808401829052908301859052600091869160808501845b88811015620015c6578435620015b18162000f9d565b8416825293820193908201906001016200159b565b5080945050508085166040850152505095945050505050565b73ffffffffffffffffffffffffffffffffffffffff858116825260208083018690526060604084018190528301849052600091859160808501845b8781101562001645578435620016308162000f9d565b8416825293820193908201906001016200161a565b509998505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b63ffffffff818116838216019080821115620016d157620016d162001682565b5092915050565b600063ffffffff808316818103620016f457620016f462001682565b6001019392505050565b63ffffffff828116828216039080821115620016d157620016d162001682565b6080808252855190820181905260009060209060a0840190828901845b828110156200176f57815173ffffffffffffffffffffffffffffffffffffffff16845292840192908401906001016200173b565b5050508381038285015286518082528783019183019060005b81811015620017ac57835163ffffffff168352928401929184019160010162001788565b505063ffffffff871660408601529250620017c5915050565b73ffffffffffffffffffffffffffffffffffffffff83166060830152620008b4565b600060208284031215620017fa57600080fd5b815162000c8e8162000f9d565b6000602082840312156200181a57600080fd5b8151801515811462000c8e57600080fd5b6000825160005b818110156200184e576020818601810151858301520162001832565b50600092019182525091905056fe60e06040523480156200001157600080fd5b506040516200197b3803806200197b8339810160408190526200003491620000ec565b60016000556001600160a01b0383166200006157604051633b2bdb6f60e01b815260040160405180910390fd5b6001600160a01b0382166200008957604051634dfcc82d60e01b815260040160405180910390fd5b6001600160a01b038116620000b1576040516356d340bb60e01b815260040160405180910390fd5b6001600160a01b0392831660c0529082166080521660a05262000136565b80516001600160a01b0381168114620000e757600080fd5b919050565b6000806000606084860312156200010257600080fd5b6200010d84620000cf565b92506200011d60208501620000cf565b91506200012d60408501620000cf565b90509250925092565b60805160a05160c0516117ec6200018f6000396000818160ba0152818161040101526104e6015260008181610165015281816105110152818161066901526109f601526000818161011b015261088901526117ec6000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806367b657e71161005b57806367b657e71461013d578063916aa4a714610160578063bc197c8114610187578063f23a6e61146101f057600080fd5b806301ffc9a71461008d5780633b7d592e146100b55780634d3d1243146101015780634faa26fc14610116575b600080fd5b6100a061009b3660046110a8565b610228565b60405190151581526020015b60405180910390f35b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100ac565b61011461010f366004611166565b6102c1565b005b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6100a061014b3660046111ff565b60016020526000908152604090205460ff1681565b6100dc7f000000000000000000000000000000000000000000000000000000000000000081565b6101bf6101953660046113a4565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016100ac565b6101bf6101fe366004611452565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806102bb57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6102c961082f565b600086866040516020016102de9291906114bb565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152600190935291205490915060ff161561035e576040517f3197f46100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16878760008181106103885761038861150a565b905060200201602081019061039d9190611539565b73ffffffffffffffffffffffffffffffffffffffff16146103ea576040517f0f4609d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016878761042e600182611585565b81811061043d5761043d61150a565b90506020020160208101906104529190611539565b73ffffffffffffffffffffffffffffffffffffffff161461049f576040517fcc92cf1400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104a98787610872565b6040517f08e21ede00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526000917f0000000000000000000000000000000000000000000000000000000000000000909116906308e21ede90602401608060405180830381865afa15801561055a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057e91906115b1565b50506040517efdd58e0000000000000000000000000000000000000000000000000000000081523060048201526000602482018190529293508392915073ffffffffffffffffffffffffffffffffffffffff83169062fdd58e90604401602060405180830381865afa1580156105f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061c919061160a565b6040517f08e21ede00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a8116600483015291925060009182917f0000000000000000000000000000000000000000000000000000000000000000909116906308e21ede90602401608060405180830381865afa1580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d691906115b1565b6040517ff242432a00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff808616602483015260006044830181905263ffffffff8416606484015260a0608484015260a48301529496509094509287169263f242432a925060c4019050600060405180830381600087803b15801561077057600080fd5b505af1158015610784573d6000803e3d6000fd5b5050505061079c8163ffffffff1684848c8c8c6109f2565b60008681526001602081905260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055517fe3a6596357b1424e59dc4645a4dcfafe4f38248034eddca95cf429df2f3448289061080f908e908e908e908e908e908e90611623565b60405180910390a15050505050506108276001600055565b505050505050565b60026000540361086b576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600055565b60005b610880600183611585565b8110156109ed577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d18f8ba08484848181106108d5576108d561150a565b90506020020160208101906108ea9190611539565b85856108f78660016116e8565b8181106109065761090661150a565b905060200201602081019061091b9190611539565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa15801561098b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109af91906116fb565b6109e5576040517faa49191800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600101610875565b505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16633c6940d56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a839190611718565b90508315610b77576040517f3bb66a7b00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff821690633bb66a7b90602401602060405180830381865afa158015610af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b19919061160a565b15610b50576040517fbeaa8af300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b47600087610b5e8a84611735565b610b68919061174c565b9050610b748782610da5565b50505b60005b82811015610d9b5760018273ffffffffffffffffffffffffffffffffffffffff1663c3a8962c30878786818110610bb357610bb361150a565b9050602002016020810190610bc89190611539565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa158015610c38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5c919061160a565b1115610c94576040517fb488cffd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848483818110610ca857610ca861150a565b9050602002016020810190610cbd9190611539565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015610d2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d51919061160a565b9050600089610d608c84611735565b610d6a919061174c565b9050610d8d73ffffffffffffffffffffffffffffffffffffffff84168a83610dea565b505050806001019050610b7a565b5050505050505050565b600080600080600085875af19050806109ed576040517fdb8096c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff848116602483015260448083018590528351808403909101815260649092019092526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526109ed91859190600090610e8390841683610efc565b90508051600014158015610ea8575080806020019051810190610ea691906116fb565b155b156109ed576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b6060610f0a83836000610f11565b9392505050565b606081471015610f4f576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401610ef3565b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051610f789190611787565b60006040518083038185875af1925050503d8060008114610fb5576040519150601f19603f3d011682016040523d82523d6000602084013e610fba565b606091505b5091509150610fca868383610fd4565b9695505050505050565b606082610fe957610fe482611063565b610f0a565b815115801561100d575073ffffffffffffffffffffffffffffffffffffffff84163b155b1561105c576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610ef3565b5080610f0a565b8051156110735780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6000602082840312156110ba57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610f0a57600080fd5b60008083601f8401126110fc57600080fd5b50813567ffffffffffffffff81111561111457600080fd5b6020830191508360208260051b850101111561112f57600080fd5b9250929050565b73ffffffffffffffffffffffffffffffffffffffff811681146110a557600080fd5b80151581146110a557600080fd5b6000806000806000806080878903121561117f57600080fd5b863567ffffffffffffffff8082111561119757600080fd5b6111a38a838b016110ea565b9098509650602089013591506111b882611136565b9094506040880135906111ca82611158565b909350606088013590808211156111e057600080fd5b506111ed89828a016110ea565b979a9699509497509295939492505050565b60006020828403121561121157600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561128e5761128e611218565b604052919050565b600082601f8301126112a757600080fd5b8135602067ffffffffffffffff8211156112c3576112c3611218565b8160051b6112d2828201611247565b92835284810182019282810190878511156112ec57600080fd5b83870192505b8483101561130b578235825291830191908301906112f2565b979650505050505050565b600082601f83011261132757600080fd5b813567ffffffffffffffff81111561134157611341611218565b61137260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611247565b81815284602083860101111561138757600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156113bc57600080fd5b85356113c781611136565b945060208601356113d781611136565b9350604086013567ffffffffffffffff808211156113f457600080fd5b61140089838a01611296565b9450606088013591508082111561141657600080fd5b61142289838a01611296565b9350608088013591508082111561143857600080fd5b5061144588828901611316565b9150509295509295909350565b600080600080600060a0868803121561146a57600080fd5b853561147581611136565b9450602086013561148581611136565b93506040860135925060608601359150608086013567ffffffffffffffff8111156114af57600080fd5b61144588828901611316565b60008184825b858110156114ff5781356114d481611136565b73ffffffffffffffffffffffffffffffffffffffff16835260209283019291909101906001016114c1565b509095945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561154b57600080fd5b8135610f0a81611136565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156102bb576102bb611556565b805163ffffffff811681146115ac57600080fd5b919050565b600080600080608085870312156115c757600080fd5b84516115d281611136565b60208601519094506115e381611136565b92506115f160408601611598565b91506115ff60608601611598565b905092959194509250565b60006020828403121561161c57600080fd5b5051919050565b6080808252810186905260008760a08301825b8981101561167357823561164981611136565b73ffffffffffffffffffffffffffffffffffffffff16825260209283019290910190600101611636565b5073ffffffffffffffffffffffffffffffffffffffff8881166020868101919091528815156040870152858303606087015286835292508691830160005b878110156116d85783356116c481611136565b8316825292840192908401906001016116b1565b509b9a5050505050505050505050565b808201808211156102bb576102bb611556565b60006020828403121561170d57600080fd5b8151610f0a81611158565b60006020828403121561172a57600080fd5b8151610f0a81611136565b80820281158282048414176102bb576102bb611556565b600082611782577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000825160005b818110156117a8576020818601810151858301520161178e565b50600092019182525091905056fea26469706673582212203a5fbb28b30fdede9fe0dd4667db7db5d937e62523ba3521ffe2f3f5de08521f64736f6c63430008170033a26469706673582212204d2db41374afcf1d3afbf1105c3d54afe63a8b5029ec90849bfc012c3e259eeb64736f6c63430008170033
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.