Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60c06040 | 16961439 | 555 days ago | IN | 0 ETH | 0.08341807 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
16961439 | 555 days ago | Contract Creation | 0 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
JBETHERC20SplitsPayerDeployer
Compiler Version
v0.8.16+commit.07a7930e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import { Clones } from '@openzeppelin/contracts/proxy/Clones.sol'; import './interfaces/IJBETHERC20SplitsPayerDeployer.sol'; import './structs/JBSplit.sol'; import './structs/JBGroupedSplits.sol'; import './JBETHERC20SplitsPayer.sol'; /** @notice Deploys splits payer contracts. @dev Adheres to - IJBETHERC20SplitsPayerDeployer: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules. */ contract JBETHERC20SplitsPayerDeployer is IJBETHERC20SplitsPayerDeployer { address immutable implementation; IJBSplitsStore immutable splitsStore; constructor(IJBSplitsStore _splitsStore) { implementation = address(new JBETHERC20SplitsPayer(_splitsStore)); splitsStore = _splitsStore; } //*********************************************************************// // ---------------------- external transactions ---------------------- // //*********************************************************************// /** @notice Allows anyone to deploy a new splits payer contract. @dev This contract must have Operator permissions over the SET_SPLITS permission of the specified `_defaultSplitsProjectId`. @param _defaultSplitsProjectId The ID of project for which the default splits are stored. @param _defaultSplits The splits to payout when this contract receives direct payments. @param _splitsStore A contract that stores splits for each project. @param _defaultProjectId The ID of the project whose treasury should be forwarded the splits payer contract's received payment leftovers after distributing to the default splits group. @param _defaultBeneficiary The address that'll receive the project's tokens when the splits payer receives payments. @param _defaultPreferClaimedTokens A flag indicating whether issued tokens from the splits payer's received payments should be automatically claimed into the beneficiary's wallet. @param _defaultMemo The memo that'll be forwarded with the splits payer's received payments. @param _defaultMetadata The metadata that'll be forwarded with the splits payer's received payments. @param _defaultPreferAddToBalance A flag indicating if received payments should call the `pay` function or the `addToBalance` function of a project. @param _owner The address that will own the splits payer. @return splitsPayer The splits payer contract. */ function deploySplitsPayerWithSplits( uint256 _defaultSplitsProjectId, JBSplit[] memory _defaultSplits, IJBSplitsStore _splitsStore, uint256 _defaultProjectId, address payable _defaultBeneficiary, bool _defaultPreferClaimedTokens, string memory _defaultMemo, bytes memory _defaultMetadata, bool _defaultPreferAddToBalance, address _owner ) external override returns (IJBSplitsPayer splitsPayer) { // Use this contract's address as the domain. uint256 _domain = uint256(uint160(address(this))); // Create the random hash using data unique to this instance that'll be used as the storage domain. uint256 _group = uint256(keccak256(abi.encodePacked(msg.sender, block.number))); // Set the splits in the store. JBGroupedSplits[] memory _groupedSplits; _groupedSplits = new JBGroupedSplits[](1); _groupedSplits[0] = JBGroupedSplits(_group, _defaultSplits); _splitsStore.set(_defaultSplitsProjectId, _domain, _groupedSplits); return deploySplitsPayer( _defaultSplitsProjectId, _domain, _group, _defaultProjectId, _defaultBeneficiary, _defaultPreferClaimedTokens, _defaultMemo, _defaultMetadata, _defaultPreferAddToBalance, _owner ); } //*********************************************************************// // ---------------------- public transactions ---------------------- // //*********************************************************************// /** @notice Allows anyone to deploy a new splits payer contract. @param _defaultSplitsProjectId The ID of project for which the default splits are stored. @param _defaultSplitsDomain The splits domain to payout when this contract receives direct payments. @param _defaultSplitsGroup The splits group to payout when this contract receives direct payments. @param _defaultProjectId The ID of the project whose treasury should be forwarded the splits payer contract's received payment leftovers after distributing to the default splits group. @param _defaultBeneficiary The address that'll receive the project's tokens when the splits payer receives payments. @param _defaultPreferClaimedTokens A flag indicating whether issued tokens from the splits payer's received payments should be automatically claimed into the beneficiary's wallet. @param _defaultMemo The memo that'll be forwarded with the splits payer's received payments. @param _defaultMetadata The metadata that'll be forwarded with the splits payer's received payments. @param _defaultPreferAddToBalance A flag indicating if received payments should call the `pay` function or the `addToBalance` function of a project. @param _owner The address that will own the splits payer. @return splitsPayer The splits payer contract. */ function deploySplitsPayer( uint256 _defaultSplitsProjectId, uint256 _defaultSplitsDomain, uint256 _defaultSplitsGroup, uint256 _defaultProjectId, address payable _defaultBeneficiary, bool _defaultPreferClaimedTokens, string memory _defaultMemo, bytes memory _defaultMetadata, bool _defaultPreferAddToBalance, address _owner ) public override returns (IJBSplitsPayer splitsPayer) { // Deploy the splits payer. splitsPayer = IJBSplitsPayer(payable(Clones.clone(implementation))); splitsPayer.initialize( _defaultSplitsProjectId, _defaultSplitsDomain, _defaultSplitsGroup, _defaultProjectId, _defaultBeneficiary, _defaultPreferClaimedTokens, _defaultMemo, _defaultMetadata, _defaultPreferAddToBalance, _owner ); emit DeploySplitsPayer( splitsPayer, _defaultSplitsProjectId, _defaultSplitsDomain, _defaultSplitsGroup, splitsStore, _defaultProjectId, _defaultBeneficiary, _defaultPreferClaimedTokens, _defaultMemo, _defaultMetadata, _defaultPreferAddToBalance, _owner, msg.sender ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @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; 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() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @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, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @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, it is bubbled up by this * function (like regular Solidity function calls). * * 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. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @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`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./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); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @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: Unlicense pragma solidity >=0.8.4; import "prb-math/contracts/PRBMath.sol";
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; import './interfaces/IJBProjectPayer.sol'; import './libraries/JBTokens.sol'; /** @notice Sends ETH or ERC20's to a project treasury as it receives direct payments or has it's functions called. @dev Inherit from this contract or borrow from its logic to forward ETH or ERC20's to project treasuries from within other contracts. @dev Adheres to - IJBProjectPayer: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules. @dev Inherits from - Ownable: Includes convenience functionality for checking a message sender's permissions before executing certain transactions. ERC165: Introspection on interface adherance. */ contract JBETHERC20ProjectPayer is Ownable, ERC165, IJBProjectPayer { using SafeERC20 for IERC20; //*********************************************************************// // -------------------------- custom errors -------------------------- // //*********************************************************************// error INCORRECT_DECIMAL_AMOUNT(); error ALREADY_INITIALIZED(); error NO_MSG_VALUE_ALLOWED(); error TERMINAL_NOT_FOUND(); //*********************************************************************// // ------------------- public immutable properties ------------------- // //*********************************************************************// /** @notice A contract storing directories of terminals and controllers for each project. */ IJBDirectory public immutable override directory; /** @notice The deployer associated with this implementation. Used to rule out double initialization. */ address public immutable override projectPayerDeployer; //*********************************************************************// // --------------------- public stored properties -------------------- // //*********************************************************************// /** @notice The ID of the project that should be used to forward this contract's received payments. */ uint256 public override defaultProjectId; /** @notice The beneficiary that should be used in the payment made when this contract receives payments. */ address payable public override defaultBeneficiary; /** @notice A flag indicating whether issued tokens should be automatically claimed into the beneficiary's wallet. Leaving tokens unclaimed saves gas. */ bool public override defaultPreferClaimedTokens; /** @notice The memo that should be used in the payment made when this contract receives payments. */ string public override defaultMemo; /** @notice The metadata that should be used in the payment made when this contract receives payments. */ bytes public override defaultMetadata; /** @notice A flag indicating if received payments should call the `pay` function or the `addToBalance` function of a project. */ bool public override defaultPreferAddToBalance; //*********************************************************************// // ------------------------- public views ---------------------------- // //*********************************************************************// /** @notice Indicates if this contract adheres to the specified interface. @dev See {IERC165-supportsInterface}. @param _interfaceId The ID of the interface to check for adherance to. */ function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return _interfaceId == type(IJBProjectPayer).interfaceId || super.supportsInterface(_interfaceId); } //*********************************************************************// // -------------------------- constructors --------------------------- // //*********************************************************************// /** @dev This is the constructor of the implementation. The directory is shared between project payers and is immutable. If a new JBDirectory is needed, a new JBProjectPayerDeployer should be deployed. @param _directory A contract storing directories of terminals and controllers for each project. */ constructor(IJBDirectory _directory) { directory = _directory; projectPayerDeployer = msg.sender; } /** @param _defaultProjectId The ID of the project whose treasury should be forwarded this contract's received payments. @param _defaultBeneficiary The address that'll receive the project's tokens. @param _defaultPreferClaimedTokens A flag indicating whether issued tokens should be automatically claimed into the beneficiary's wallet. @param _defaultMemo A memo to pass along to the emitted event, and passed along the the funding cycle's data source and delegate. A data source can alter the memo before emitting in the event and forwarding to the delegate. @param _defaultMetadata Bytes to send along to the project's data source and delegate, if provided. @param _defaultPreferAddToBalance A flag indicating if received payments should call the `pay` function or the `addToBalance` function of a project. @param _owner The address that will own the contract. */ function initialize( uint256 _defaultProjectId, address payable _defaultBeneficiary, bool _defaultPreferClaimedTokens, string memory _defaultMemo, bytes memory _defaultMetadata, bool _defaultPreferAddToBalance, address _owner ) public { if(msg.sender != projectPayerDeployer) revert ALREADY_INITIALIZED(); defaultProjectId = _defaultProjectId; defaultBeneficiary = _defaultBeneficiary; defaultPreferClaimedTokens = _defaultPreferClaimedTokens; defaultMemo = _defaultMemo; defaultMetadata = _defaultMetadata; defaultPreferAddToBalance = _defaultPreferAddToBalance; _transferOwnership(_owner); } //*********************************************************************// // ------------------------- default receive ------------------------- // //*********************************************************************// /** @notice Received funds are paid to the default project ID using the stored default properties. @dev Use the `addToBalance` function if there's a preference to do so. Otherwise use `pay`. @dev This function is called automatically when the contract receives an ETH payment. */ receive() external payable virtual override { if (defaultPreferAddToBalance) _addToBalanceOf( defaultProjectId, JBTokens.ETH, address(this).balance, 18, // balance is a fixed point number with 18 decimals. defaultMemo, defaultMetadata ); else _pay( defaultProjectId, JBTokens.ETH, address(this).balance, 18, // balance is a fixed point number with 18 decimals. defaultBeneficiary == address(0) ? tx.origin : defaultBeneficiary, 0, // Can't determine expectation of returned tokens ahead of time. defaultPreferClaimedTokens, defaultMemo, defaultMetadata ); } //*********************************************************************// // ---------------------- external transactions ---------------------- // //*********************************************************************// /** @notice Sets the default values that determine how to interact with a protocol treasury when this contract receives ETH directly. @param _projectId The ID of the project whose treasury should be forwarded this contract's received payments. @param _beneficiary The address that'll receive the project's tokens. @param _preferClaimedTokens A flag indicating whether issued tokens should be automatically claimed into the beneficiary's wallet. @param _memo The memo that'll be used. @param _metadata The metadata that'll be sent. @param _defaultPreferAddToBalance A flag indicating if received payments should call the `pay` function or the `addToBalance` function of a project. */ function setDefaultValues( uint256 _projectId, address payable _beneficiary, bool _preferClaimedTokens, string memory _memo, bytes memory _metadata, bool _defaultPreferAddToBalance ) external virtual override onlyOwner { // Set the default project ID if it has changed. if (_projectId != defaultProjectId) defaultProjectId = _projectId; // Set the default beneficiary if it has changed. if (_beneficiary != defaultBeneficiary) defaultBeneficiary = _beneficiary; // Set the default claimed token preference if it has changed. if (_preferClaimedTokens != defaultPreferClaimedTokens) defaultPreferClaimedTokens = _preferClaimedTokens; // Set the default memo if it has changed. if (keccak256(abi.encodePacked(_memo)) != keccak256(abi.encodePacked(defaultMemo))) defaultMemo = _memo; // Set the default metadata if it has changed. if (keccak256(abi.encodePacked(_metadata)) != keccak256(abi.encodePacked(defaultMetadata))) defaultMetadata = _metadata; // Set the add to balance preference if it has changed. if (_defaultPreferAddToBalance != defaultPreferAddToBalance) defaultPreferAddToBalance = _defaultPreferAddToBalance; emit SetDefaultValues( _projectId, _beneficiary, _preferClaimedTokens, _memo, _metadata, _defaultPreferAddToBalance, msg.sender ); } //*********************************************************************// // ----------------------- public transactions ----------------------- // //*********************************************************************// /** @notice Make a payment to the specified project. @param _projectId The ID of the project that is being paid. @param _token The token being paid in. @param _amount The amount of tokens being paid, as a fixed point number. If the token is ETH, this is ignored and msg.value is used in its place. @param _decimals The number of decimals in the `_amount` fixed point number. If the token is ETH, this is ignored and 18 is used in its place, which corresponds to the amount of decimals expected in msg.value. @param _beneficiary The address who will receive tokens from the payment. @param _minReturnedTokens The minimum number of project tokens expected in return, as a fixed point number with 18 decimals. @param _preferClaimedTokens A flag indicating whether the request prefers to mint project tokens into the beneficiaries wallet rather than leaving them unclaimed. This is only possible if the project has an attached token contract. Leaving them unclaimed saves gas. @param _memo A memo to pass along to the emitted event, and passed along the the funding cycle's data source and delegate. A data source can alter the memo before emitting in the event and forwarding to the delegate. @param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided. */ function pay( uint256 _projectId, address _token, uint256 _amount, uint256 _decimals, address _beneficiary, uint256 _minReturnedTokens, bool _preferClaimedTokens, string calldata _memo, bytes calldata _metadata ) public payable virtual override { // ETH shouldn't be sent if the token isn't ETH. if (address(_token) != JBTokens.ETH) { if (msg.value > 0) revert NO_MSG_VALUE_ALLOWED(); // Get a reference to the balance before receiving tokens. uint256 _balanceBefore = IERC20(_token).balanceOf(address(this)); // Transfer tokens to this contract from the msg sender. IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); // The amount should reflect the change in balance. _amount = IERC20(_token).balanceOf(address(this)) - _balanceBefore; } else { // If ETH is being paid, set the amount to the message value, and decimals to 18. _amount = msg.value; _decimals = 18; } _pay( _projectId, _token, _amount, _decimals, _beneficiary, _minReturnedTokens, _preferClaimedTokens, _memo, _metadata ); } /** @notice Add to the balance of the specified project. @param _projectId The ID of the project that is being paid. @param _token The token being paid in. @param _amount The amount of tokens being paid, as a fixed point number. If the token is ETH, this is ignored and msg.value is used in its place. @param _decimals The number of decimals in the `_amount` fixed point number. If the token is ETH, this is ignored and 18 is used in its place, which corresponds to the amount of decimals expected in msg.value. @param _memo A memo to pass along to the emitted event. @param _metadata Extra data to pass along to the terminal. */ function addToBalanceOf( uint256 _projectId, address _token, uint256 _amount, uint256 _decimals, string calldata _memo, bytes calldata _metadata ) public payable virtual override { // ETH shouldn't be sent if the token isn't ETH. if (address(_token) != JBTokens.ETH) { if (msg.value > 0) revert NO_MSG_VALUE_ALLOWED(); // Get a reference to the balance before receiving tokens. uint256 _balanceBefore = IERC20(_token).balanceOf(address(this)); // Transfer tokens to this contract from the msg sender. IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); // The amount should reflect the change in balance. _amount = IERC20(_token).balanceOf(address(this)) - _balanceBefore; } else { // If ETH is being paid, set the amount to the message value, and decimals to 18. _amount = msg.value; _decimals = 18; } _addToBalanceOf(_projectId, _token, _amount, _decimals, _memo, _metadata); } //*********************************************************************// // ---------------------- internal transactions ---------------------- // //*********************************************************************// /** @notice Make a payment to the specified project. @param _projectId The ID of the project that is being paid. @param _token The token being paid in. @param _amount The amount of tokens being paid, as a fixed point number. @param _decimals The number of decimals in the `_amount` fixed point number. @param _beneficiary The address who will receive tokens from the payment. @param _minReturnedTokens The minimum number of project tokens expected in return, as a fixed point number with 18 decimals. @param _preferClaimedTokens A flag indicating whether the request prefers to mint project tokens into the beneficiaries wallet rather than leaving them unclaimed. This is only possible if the project has an attached token contract. Leaving them unclaimed saves gas. @param _memo A memo to pass along to the emitted event, and passed along the the funding cycle's data source and delegate. A data source can alter the memo before emitting in the event and forwarding to the delegate. @param _metadata Bytes to send along to the data source and delegate, if provided. */ function _pay( uint256 _projectId, address _token, uint256 _amount, uint256 _decimals, address _beneficiary, uint256 _minReturnedTokens, bool _preferClaimedTokens, string memory _memo, bytes memory _metadata ) internal virtual { // Find the terminal for the specified project. IJBPaymentTerminal _terminal = directory.primaryTerminalOf(_projectId, _token); // There must be a terminal. if (_terminal == IJBPaymentTerminal(address(0))) revert TERMINAL_NOT_FOUND(); // The amount's decimals must match the terminal's expected decimals. if (_terminal.decimalsForToken(_token) != _decimals) revert INCORRECT_DECIMAL_AMOUNT(); // Approve the `_amount` of tokens from the destination terminal to transfer tokens from this contract. if (_token != JBTokens.ETH) IERC20(_token).safeApprove(address(_terminal), _amount); // If the token is ETH, send it in msg.value. uint256 _payableValue = _token == JBTokens.ETH ? _amount : 0; // Send funds to the terminal. // If the token is ETH, send it in msg.value. _terminal.pay{value: _payableValue}( _projectId, _amount, // ignored if the token is JBTokens.ETH. _token, _beneficiary != address(0) ? _beneficiary : defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin, _minReturnedTokens, _preferClaimedTokens, _memo, _metadata ); } /** @notice Add to the balance of the specified project. @param _projectId The ID of the project that is being paid. @param _token The token being paid in. @param _amount The amount of tokens being paid, as a fixed point number. If the token is ETH, this is ignored and msg.value is used in its place. @param _decimals The number of decimals in the `_amount` fixed point number. If the token is ETH, this is ignored and 18 is used in its place, which corresponds to the amount of decimals expected in msg.value. @param _memo A memo to pass along to the emitted event. @param _metadata Extra data to pass along to the terminal. */ function _addToBalanceOf( uint256 _projectId, address _token, uint256 _amount, uint256 _decimals, string memory _memo, bytes memory _metadata ) internal virtual { // Find the terminal for the specified project. IJBPaymentTerminal _terminal = directory.primaryTerminalOf(_projectId, _token); // There must be a terminal. if (_terminal == IJBPaymentTerminal(address(0))) revert TERMINAL_NOT_FOUND(); // The amount's decimals must match the terminal's expected decimals. if (_terminal.decimalsForToken(_token) != _decimals) revert INCORRECT_DECIMAL_AMOUNT(); // Approve the `_amount` of tokens from the destination terminal to transfer tokens from this contract. if (_token != JBTokens.ETH) IERC20(_token).safeApprove(address(_terminal), _amount); // If the token is ETH, send it in msg.value. uint256 _payableValue = _token == JBTokens.ETH ? _amount : 0; // Add to balance so tokens don't get issued. _terminal.addToBalanceOf{value: _payableValue}(_projectId, _amount, _token, _memo, _metadata); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@paulrberg/contracts/math/PRBMath.sol'; import './interfaces/IJBSplitsPayer.sol'; import './interfaces/IJBSplitsStore.sol'; import './libraries/JBConstants.sol'; import './JBETHERC20ProjectPayer.sol'; /** @notice Sends ETH or ERC20's to a group of splits as it receives direct payments or has its functions called. @dev Inherit from this contract or borrow from its logic to forward ETH or ERC20's to a group of splits from within other contracts. @dev Adheres to - IJBSplitsPayer: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules. @dev Inherits from - JBETHERC20ProjectPayer: Sends ETH or ERC20's to a project treasury as it receives direct payments or has it's functions called. ReentrancyGuard: Contract module that helps prevent reentrant calls to a function. */ contract JBETHERC20SplitsPayer is JBETHERC20ProjectPayer, ReentrancyGuard, IJBSplitsPayer { using SafeERC20 for IERC20; //*********************************************************************// // ---------------- public immutable stored properties --------------- // //*********************************************************************// /** @notice The contract that stores splits for each project. */ IJBSplitsStore public immutable override splitsStore; //*********************************************************************// // --------------------- public stored properties -------------------- // //*********************************************************************// /** @notice The ID of project for which the default splits are stored. */ uint256 public override defaultSplitsProjectId; /** @notice The domain within which the default splits are stored. */ uint256 public override defaultSplitsDomain; /** @notice The group within which the default splits are stored. */ uint256 public override defaultSplitsGroup; //*********************************************************************// // -------------------------- public views --------------------------- // //*********************************************************************// /** @notice Indicates if this contract adheres to the specified interface. @dev See {IERC165-supportsInterface}. @param _interfaceId The ID of the interface to check for adherance to. @return A flag indicating if this contract adheres to the specified interface. */ function supportsInterface(bytes4 _interfaceId) public view virtual override(JBETHERC20ProjectPayer, IERC165) returns (bool) { return _interfaceId == type(IJBSplitsPayer).interfaceId || super.supportsInterface(_interfaceId); } //*********************************************************************// // -------------------------- constructor ---------------------------- // //*********************************************************************// /** @param _splitsStore A contract that stores splits for each project. */ constructor( IJBSplitsStore _splitsStore ) JBETHERC20ProjectPayer( _splitsStore.directory() ) { splitsStore = _splitsStore; } /** @dev The re-initialize check is done in the inherited paroject payer @param _defaultSplitsProjectId The ID of project for which the default splits are stored. @param _defaultSplitsDomain The splits domain to payout when this contract receives direct payments. @param _defaultSplitsGroup The splits group to payout when this contract receives direct payments. @param _defaultProjectId The ID of the project whose treasury should be forwarded the splits payer contract's received payment leftovers after distributing to the default splits group. @param _defaultBeneficiary The address that'll receive the project's tokens. @param _defaultPreferClaimedTokens A flag indicating whether issued tokens should be automatically claimed into the beneficiary's wallet. @param _defaultMemo A memo to pass along to the emitted event, and passed along the the funding cycle's data source and delegate. A data source can alter the memo before emitting in the event and forwarding to the delegate. @param _defaultMetadata Bytes to send along to the project's data source and delegate, if provided. @param _preferAddToBalance A flag indicating if received payments should call the `pay` function or the `addToBalance` function of a project. @param _owner The address that will own the contract. */ function initialize( uint256 _defaultSplitsProjectId, uint256 _defaultSplitsDomain, uint256 _defaultSplitsGroup, uint256 _defaultProjectId, address payable _defaultBeneficiary, bool _defaultPreferClaimedTokens, string memory _defaultMemo, bytes memory _defaultMetadata, bool _preferAddToBalance, address _owner ) external override { super.initialize( _defaultProjectId, _defaultBeneficiary, _defaultPreferClaimedTokens, _defaultMemo, _defaultMetadata, _preferAddToBalance, _owner ); defaultSplitsProjectId = _defaultSplitsProjectId; defaultSplitsDomain = _defaultSplitsDomain; defaultSplitsGroup = _defaultSplitsGroup; } //*********************************************************************// // ------------------------- default receive ------------------------- // //*********************************************************************// /** @notice Received funds are paid to the default split group using the stored default properties. @dev This function is called automatically when the contract receives an ETH payment. */ receive() external payable virtual override nonReentrant { // Pay the splits and get a reference to the amount leftover. uint256 _leftoverAmount = _payToSplits( defaultSplitsProjectId, defaultSplitsDomain, defaultSplitsGroup, JBTokens.ETH, address(this).balance, 18, // decimals. defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin ); // If there is no leftover amount, nothing left to pay. if (_leftoverAmount == 0) return; // If there's a default project ID, try to pay it. if (defaultProjectId != 0) if (defaultPreferAddToBalance) // Pay the project by adding to its balance if prefered. _addToBalanceOf( defaultProjectId, JBTokens.ETH, _leftoverAmount, 18, // decimals. defaultMemo, defaultMetadata ); // Otherwise, issue a payment to the project. else _pay( defaultProjectId, JBTokens.ETH, _leftoverAmount, 18, // decimals. defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin, 0, // min returned tokens. defaultPreferClaimedTokens, defaultMemo, defaultMetadata ); // If no project was specified, send the funds directly to the beneficiary or the tx.origin. else Address.sendValue( defaultBeneficiary != address(0) ? payable(defaultBeneficiary) : payable(tx.origin), _leftoverAmount ); } //*********************************************************************// // ---------------------- external transactions ---------------------- // //*********************************************************************// /** @notice Sets the splits in the splits store that payments this contract receives will be split between. @param _projectId The ID of project for which the default splits are stored. @param _domain The domain within which the default splits are stored. @param _group The group within which the default splits are stored. @param _groupedSplits The split groups to set. */ function setDefaultSplits( uint256 _projectId, uint256 _domain, uint256 _group, JBGroupedSplits[] memory _groupedSplits ) external virtual override onlyOwner { // Set the splits in the store. splitsStore.set(_projectId, _domain, _groupedSplits); // Set the splits reference. setDefaultSplitsReference(_projectId, _domain, _group); } //*********************************************************************// // ----------------------- public transactions ----------------------- // //*********************************************************************// /** @notice Sets the location of the splits that payments this contract receives will be split between. @param _projectId The ID of project for which the default splits are stored. @param _domain The domain within which the default splits are stored. @param _group The group within which the default splits are stored. */ function setDefaultSplitsReference( uint256 _projectId, uint256 _domain, uint256 _group ) public virtual override onlyOwner { // Set the default splits project ID if it's changing. if (_projectId != defaultSplitsProjectId) defaultSplitsProjectId = _projectId; // Set the default splits domain if it's changing. if (_domain != defaultSplitsDomain) defaultSplitsDomain = _domain; // Set the default splits group if it's changing. if (_group != defaultSplitsGroup) defaultSplitsGroup = _group; emit SetDefaultSplitsReference(_projectId, _domain, _group, msg.sender); } /** @notice Make a payment to the specified project after first splitting the amount among the stored default splits. @param _projectId The ID of the project that is being paid after. @param _token The token being paid in. @param _amount The amount of tokens being paid, as a fixed point number. If the token is ETH, this is ignored and msg.value is used in its place. @param _decimals The number of decimals in the `_amount` fixed point number. If the token is ETH, this is ignored and 18 is used in its place, which corresponds to the amount of decimals expected in msg.value. @param _beneficiary The address who will receive tokens from the payment made with leftover funds. @param _minReturnedTokens The minimum number of project tokens expected in return, as a fixed point number with 18 decimals. @param _preferClaimedTokens A flag indicating whether the request prefers to mint project tokens into the beneficiaries wallet rather than leaving them unclaimed. This is only possible if the project has an attached token contract. Leaving them unclaimed saves gas. @param _memo A memo to pass along to the emitted event, and passed along the the funding cycle's data source and delegate. A data source can alter the memo before emitting in the event and forwarding to the delegate. @param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided. */ function pay( uint256 _projectId, address _token, uint256 _amount, uint256 _decimals, address _beneficiary, uint256 _minReturnedTokens, bool _preferClaimedTokens, string calldata _memo, bytes calldata _metadata ) public payable virtual override nonReentrant { // ETH shouldn't be sent if the token isn't ETH. if (address(_token) != JBTokens.ETH) { if (msg.value > 0) revert NO_MSG_VALUE_ALLOWED(); // Get a reference to the balance before receiving tokens. uint256 _balanceBefore = IERC20(_token).balanceOf(address(this)); // Transfer tokens to this contract from the msg sender. IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); // The amount should reflect the change in balance. _amount = IERC20(_token).balanceOf(address(this)) - _balanceBefore; } else { // If ETH is being paid, set the amount to the message value, and decimals to 18. _amount = msg.value; _decimals = 18; } // Pay the splits and get a reference to the amount leftover. uint256 _leftoverAmount = _payToSplits( defaultSplitsProjectId, defaultSplitsDomain, defaultSplitsGroup, _token, _amount, _decimals, defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin ); // Pay any leftover amount. if (_leftoverAmount > 0) { // If there's a default project ID, try to pay it. if (_projectId != 0) { _pay( _projectId, _token, _leftoverAmount, _decimals, _beneficiary != address(0) ? _beneficiary : defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin, _minReturnedTokens, _preferClaimedTokens, _memo, _metadata ); } // If no project was specified, send the funds directly to the beneficiary or the tx.origin. else { // Transfer the ETH. if (_token == JBTokens.ETH) Address.sendValue( // If there's a beneficiary, send the funds directly to the beneficiary. Otherwise send to the tx.origin. _beneficiary != address(0) ? payable(_beneficiary) : defaultBeneficiary != address(0) ? defaultBeneficiary : payable(tx.origin), _leftoverAmount ); // Or, transfer the ERC20. else IERC20(_token).safeTransfer( // If there's a beneficiary, send the funds directly to the beneficiary. Otherwise send to the tx.origin. _beneficiary != address(0) ? _beneficiary : defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin, _leftoverAmount ); } } emit Pay( _projectId, _beneficiary != address(0) ? _beneficiary : defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin, _token, _amount, _decimals, _leftoverAmount, _minReturnedTokens, _preferClaimedTokens, _memo, _metadata, msg.sender ); } /** @notice Add to the balance of the specified project after first splitting the amount among the stored default splits. @param _projectId The ID of the project that is being paid after. @param _token The token being paid in. @param _amount The amount of tokens being paid, as a fixed point number. If the token is ETH, this is ignored and msg.value is used in its place. @param _decimals The number of decimals in the `_amount` fixed point number. If the token is ETH, this is ignored and 18 is used in its place, which corresponds to the amount of decimals expected in msg.value. @param _memo A memo to pass along to the emitted event. @param _metadata Extra data to pass along to the terminal. */ function addToBalanceOf( uint256 _projectId, address _token, uint256 _amount, uint256 _decimals, string calldata _memo, bytes calldata _metadata ) public payable virtual override nonReentrant { // ETH shouldn't be sent if this terminal's token isn't ETH. if (address(_token) != JBTokens.ETH) { if (msg.value > 0) revert NO_MSG_VALUE_ALLOWED(); // Get a reference to the balance before receiving tokens. uint256 _balanceBefore = IERC20(_token).balanceOf(address(this)); // Transfer tokens to this contract from the msg sender. IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); // The amount should reflect the change in balance. _amount = IERC20(_token).balanceOf(address(this)) - _balanceBefore; } else { // If ETH is being paid, set the amount to the message value, and decimals to 18. _amount = msg.value; _decimals = 18; } // Pay the splits and get a reference to the amount leftover. uint256 _leftoverAmount = _payToSplits( defaultSplitsProjectId, defaultSplitsDomain, defaultSplitsGroup, _token, _amount, _decimals, defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin ); // Distribute any leftover amount. if (_leftoverAmount > 0) { // If there's a default project ID, try to add to its balance. if (_projectId != 0) // Add to the project's balance. _addToBalanceOf(_projectId, _token, _leftoverAmount, _decimals, _memo, _metadata); // Otherwise, send a payment to the beneficiary. else { // Transfer the ETH. if (_token == JBTokens.ETH) Address.sendValue( // If there's a default beneficiary, send the funds directly to the beneficiary. Otherwise send to the tx.origin. defaultBeneficiary != address(0) ? defaultBeneficiary : payable(tx.origin), _leftoverAmount ); // Or, transfer the ERC20. else IERC20(_token).safeTransfer( // If there's a default beneficiary, send the funds directly to the beneficiary. Otherwise send to the tx.origin. defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin, _leftoverAmount ); } } emit AddToBalance( _projectId, defaultBeneficiary != address(0) ? defaultBeneficiary : tx.origin, _token, _amount, _decimals, _leftoverAmount, _memo, _metadata, msg.sender ); } //*********************************************************************// // ---------------------- internal transactions ---------------------- // //*********************************************************************// /** @notice Split an amount between all splits. @param _splitsProjectId The ID of the project to which the splits belong. @param _splitsDomain The splits domain to which the group belongs. @param _splitsGroup The splits group to pay. @param _token The token the amonut being split is in. @param _amount The amount of tokens being split, as a fixed point number. If the `_token` is ETH, this is ignored and msg.value is used in its place. @param _decimals The number of decimals in the `_amount` fixed point number. @param _defaultBeneficiary The address that will benefit from any non-specified beneficiaries in splits. @return leftoverAmount The amount leftover after all splits were paid. */ function _payToSplits( uint256 _splitsProjectId, uint256 _splitsDomain, uint256 _splitsGroup, address _token, uint256 _amount, uint256 _decimals, address _defaultBeneficiary ) internal virtual returns (uint256 leftoverAmount) { // Pay the splits. leftoverAmount = _payTo( splitsStore.splitsOf(_splitsProjectId, _splitsDomain, _splitsGroup), _token, _amount, _decimals, _defaultBeneficiary ); emit DistributeToSplitGroup(_splitsProjectId, _splitsDomain, _splitsGroup, msg.sender); } /** @notice Split an amount between all splits. @param _splits The splits. @param _token The token the amonut being split is in. @param _amount The amount of tokens being split, as a fixed point number. If the `_token` is ETH, this is ignored and msg.value is used in its place. @param _decimals The number of decimals in the `_amount` fixed point number. @param _defaultBeneficiary The address that will benefit from any non-specified beneficiaries in splits. @return leftoverAmount The amount leftover after all splits were paid. */ function _payTo( JBSplit[] memory _splits, address _token, uint256 _amount, uint256 _decimals, address _defaultBeneficiary ) internal virtual returns (uint256 leftoverAmount) { // Set the leftover amount to the initial balance. leftoverAmount = _amount; // Settle between all splits. for (uint256 i; i < _splits.length; ) { // Get a reference to the split being iterated on. JBSplit memory _split = _splits[i]; // The amount to send towards the split. uint256 _splitAmount = PRBMath.mulDiv( _amount, _split.percent, JBConstants.SPLITS_TOTAL_PERCENT ); if (_splitAmount > 0) { // Transfer tokens to the split. // If there's an allocator set, transfer to its `allocate` function. if (_split.allocator != IJBSplitAllocator(address(0))) { // Create the data to send to the allocator. JBSplitAllocationData memory _data = JBSplitAllocationData( _token, _splitAmount, _decimals, defaultProjectId, 0, _split ); // Approve the `_amount` of tokens for the split allocator to transfer tokens from this contract. if (_token != JBTokens.ETH) IERC20(_token).safeApprove(address(_split.allocator), _splitAmount); // If the token is ETH, send it in msg.value. uint256 _payableValue = _token == JBTokens.ETH ? _splitAmount : 0; // Trigger the allocator's `allocate` function. _split.allocator.allocate{value: _payableValue}(_data); // Otherwise, if a project is specified, make a payment to it. } else if (_split.projectId != 0) { if (_split.preferAddToBalance) _addToBalanceOf( _split.projectId, _token, _splitAmount, _decimals, defaultMemo, defaultMetadata ); else _pay( _split.projectId, _token, _splitAmount, _decimals, _split.beneficiary != address(0) ? _split.beneficiary : _defaultBeneficiary, 0, _split.preferClaimed, defaultMemo, defaultMetadata ); } else { // Transfer the ETH. if (_token == JBTokens.ETH) Address.sendValue( // Get a reference to the address receiving the tokens. If there's a beneficiary, send the funds directly to the beneficiary. Otherwise send to _defaultBeneficiary. _split.beneficiary != address(0) ? _split.beneficiary : payable(_defaultBeneficiary), _splitAmount ); // Or, transfer the ERC20. else { IERC20(_token).safeTransfer( // Get a reference to the address receiving the tokens. If there's a beneficiary, send the funds directly to the beneficiary. Otherwise send to _defaultBeneficiary. _split.beneficiary != address(0) ? _split.beneficiary : _defaultBeneficiary, _splitAmount ); } } // Subtract from the amount to be sent to the beneficiary. leftoverAmount = leftoverAmount - _splitAmount; } emit DistributeToSplit(_split, _splitAmount, _defaultBeneficiary, msg.sender); unchecked { ++i; } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; enum JBBallotState { Active, Approved, Failed }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './IJBFundingCycleStore.sol'; import './IJBPaymentTerminal.sol'; import './IJBProjects.sol'; interface IJBDirectory { event SetController(uint256 indexed projectId, address indexed controller, address caller); event AddTerminal(uint256 indexed projectId, IJBPaymentTerminal indexed terminal, address caller); event SetTerminals(uint256 indexed projectId, IJBPaymentTerminal[] terminals, address caller); event SetPrimaryTerminal( uint256 indexed projectId, address indexed token, IJBPaymentTerminal indexed terminal, address caller ); event SetIsAllowedToSetFirstController(address indexed addr, bool indexed flag, address caller); function projects() external view returns (IJBProjects); function fundingCycleStore() external view returns (IJBFundingCycleStore); function controllerOf(uint256 _projectId) external view returns (address); function isAllowedToSetFirstController(address _address) external view returns (bool); function terminalsOf(uint256 _projectId) external view returns (IJBPaymentTerminal[] memory); function isTerminalOf(uint256 _projectId, IJBPaymentTerminal _terminal) external view returns (bool); function primaryTerminalOf(uint256 _projectId, address _token) external view returns (IJBPaymentTerminal); function setControllerOf(uint256 _projectId, address _controller) external; function setTerminalsOf(uint256 _projectId, IJBPaymentTerminal[] calldata _terminals) external; function setPrimaryTerminalOf( uint256 _projectId, address _token, IJBPaymentTerminal _terminal ) external; function setIsAllowedToSetFirstController(address _address, bool _flag) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './IJBSplitsPayer.sol'; import './IJBSplitsStore.sol'; interface IJBETHERC20SplitsPayerDeployer { event DeploySplitsPayer( IJBSplitsPayer indexed splitsPayer, uint256 defaultSplitsProjectId, uint256 defaultSplitsDomain, uint256 defaultSplitsGroup, IJBSplitsStore splitsStore, uint256 defaultProjectId, address defaultBeneficiary, bool defaultPreferClaimedTokens, string defaultMemo, bytes defaultMetadata, bool preferAddToBalance, address owner, address caller ); function deploySplitsPayer( uint256 _defaultSplitsProjectId, uint256 _defaultSplitsDomain, uint256 _defaultSplitsGroup, uint256 _defaultProjectId, address payable _defaultBeneficiary, bool _defaultPreferClaimedTokens, string calldata _defaultMemo, bytes calldata _defaultMetadata, bool _preferAddToBalance, address _owner ) external returns (IJBSplitsPayer splitsPayer); function deploySplitsPayerWithSplits( uint256 _defaultSplitsProjectId, JBSplit[] memory _defaultSplits, IJBSplitsStore _splitsStore, uint256 _defaultProjectId, address payable _defaultBeneficiary, bool _defaultPreferClaimedTokens, string memory _defaultMemo, bytes memory _defaultMetadata, bool _defaultPreferAddToBalance, address _owner ) external returns (IJBSplitsPayer splitsPayer); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/introspection/IERC165.sol'; import './../enums/JBBallotState.sol'; interface IJBFundingCycleBallot is IERC165 { function duration() external view returns (uint256); function stateOf( uint256 _projectId, uint256 _configuration, uint256 _start ) external view returns (JBBallotState); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './../enums/JBBallotState.sol'; import './../structs/JBFundingCycle.sol'; import './../structs/JBFundingCycleData.sol'; interface IJBFundingCycleStore { event Configure( uint256 indexed configuration, uint256 indexed projectId, JBFundingCycleData data, uint256 metadata, uint256 mustStartAtOrAfter, address caller ); event Init(uint256 indexed configuration, uint256 indexed projectId, uint256 indexed basedOn); function latestConfigurationOf(uint256 _projectId) external view returns (uint256); function get(uint256 _projectId, uint256 _configuration) external view returns (JBFundingCycle memory); function latestConfiguredOf(uint256 _projectId) external view returns (JBFundingCycle memory fundingCycle, JBBallotState ballotState); function queuedOf(uint256 _projectId) external view returns (JBFundingCycle memory fundingCycle); function currentOf(uint256 _projectId) external view returns (JBFundingCycle memory fundingCycle); function currentBallotStateOf(uint256 _projectId) external view returns (JBBallotState); function configureFor( uint256 _projectId, JBFundingCycleData calldata _data, uint256 _metadata, uint256 _mustStartAtOrAfter ) external returns (JBFundingCycle memory fundingCycle); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/introspection/IERC165.sol'; interface IJBPaymentTerminal is IERC165 { function acceptsToken(address _token, uint256 _projectId) external view returns (bool); function currencyForToken(address _token) external view returns (uint256); function decimalsForToken(address _token) external view returns (uint256); // Return value must be a fixed point number with 18 decimals. function currentEthOverflowOf(uint256 _projectId) external view returns (uint256); function pay( uint256 _projectId, uint256 _amount, address _token, address _beneficiary, uint256 _minReturnedTokens, bool _preferClaimedTokens, string calldata _memo, bytes calldata _metadata ) external payable returns (uint256 beneficiaryTokenCount); function addToBalanceOf( uint256 _projectId, uint256 _amount, address _token, string calldata _memo, bytes calldata _metadata ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/introspection/IERC165.sol'; import './IJBDirectory.sol'; interface IJBProjectPayer is IERC165 { event SetDefaultValues( uint256 indexed projectId, address indexed beneficiary, bool preferClaimedTokens, string memo, bytes metadata, bool preferAddToBalance, address caller ); function directory() external view returns (IJBDirectory); function projectPayerDeployer() external view returns (address); function defaultProjectId() external view returns (uint256); function defaultBeneficiary() external view returns (address payable); function defaultPreferClaimedTokens() external view returns (bool); function defaultMemo() external view returns (string memory); function defaultMetadata() external view returns (bytes memory); function defaultPreferAddToBalance() external view returns (bool); function initialize( uint256 _defaultProjectId, address payable _defaultBeneficiary, bool _defaultPreferClaimedTokens, string memory _defaultMemo, bytes memory _defaultMetadata, bool _defaultPreferAddToBalance, address _owner ) external; function setDefaultValues( uint256 _projectId, address payable _beneficiary, bool _preferClaimedTokens, string memory _memo, bytes memory _metadata, bool _defaultPreferAddToBalance ) external; function pay( uint256 _projectId, address _token, uint256 _amount, uint256 _decimals, address _beneficiary, uint256 _minReturnedTokens, bool _preferClaimedTokens, string memory _memo, bytes memory _metadata ) external payable; function addToBalanceOf( uint256 _projectId, address _token, uint256 _amount, uint256 _decimals, string memory _memo, bytes memory _metadata ) external payable; receive() external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import './../structs/JBProjectMetadata.sol'; import './IJBTokenUriResolver.sol'; interface IJBProjects is IERC721 { event Create( uint256 indexed projectId, address indexed owner, JBProjectMetadata metadata, address caller ); event SetMetadata(uint256 indexed projectId, JBProjectMetadata metadata, address caller); event SetTokenUriResolver(IJBTokenUriResolver indexed resolver, address caller); function count() external view returns (uint256); function metadataContentOf(uint256 _projectId, uint256 _domain) external view returns (string memory); function tokenUriResolver() external view returns (IJBTokenUriResolver); function createFor(address _owner, JBProjectMetadata calldata _metadata) external returns (uint256 projectId); function setMetadataOf(uint256 _projectId, JBProjectMetadata calldata _metadata) external; function setTokenUriResolver(IJBTokenUriResolver _newResolver) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/introspection/IERC165.sol'; import '../structs/JBSplitAllocationData.sol'; /** @title Split allocator @notice Provide a way to process a single split with extra logic @dev Adheres to: IERC165 for adequate interface integration @dev The contract address should be set as an allocator in the adequate split */ interface IJBSplitAllocator is IERC165 { /** @notice This function is called by JBPaymentTerminal.distributePayoutOf(..), during the processing of the split including it @dev Critical business logic should be protected by an appropriate access control. The token and/or eth are optimistically transfered to the allocator for its logic. @param _data the data passed by the terminal, as a JBSplitAllocationData struct: address token; uint256 amount; uint256 decimals; uint256 projectId; uint256 group; JBSplit split; */ function allocate(JBSplitAllocationData calldata _data) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/introspection/IERC165.sol'; import './../structs/JBSplit.sol'; import './../structs/JBGroupedSplits.sol'; import './IJBSplitsStore.sol'; interface IJBSplitsPayer is IERC165 { event SetDefaultSplitsReference( uint256 indexed projectId, uint256 indexed domain, uint256 indexed group, address caller ); event Pay( uint256 indexed projectId, address beneficiary, address token, uint256 amount, uint256 decimals, uint256 leftoverAmount, uint256 minReturnedTokens, bool preferClaimedTokens, string memo, bytes metadata, address caller ); event AddToBalance( uint256 indexed projectId, address beneficiary, address token, uint256 amount, uint256 decimals, uint256 leftoverAmount, string memo, bytes metadata, address caller ); event DistributeToSplitGroup( uint256 indexed projectId, uint256 indexed domain, uint256 indexed group, address caller ); event DistributeToSplit( JBSplit split, uint256 amount, address defaultBeneficiary, address caller ); function defaultSplitsProjectId() external view returns (uint256); function defaultSplitsDomain() external view returns (uint256); function defaultSplitsGroup() external view returns (uint256); function splitsStore() external view returns (IJBSplitsStore); function initialize( uint256 _defaultSplitsProjectId, uint256 _defaultSplitsDomain, uint256 _defaultSplitsGroup, uint256 _defaultProjectId, address payable _defaultBeneficiary, bool _defaultPreferClaimedTokens, string memory _defaultMemo, bytes memory _defaultMetadata, bool _preferAddToBalance, address _owner ) external; function setDefaultSplitsReference( uint256 _projectId, uint256 _domain, uint256 _group ) external; function setDefaultSplits( uint256 _projectId, uint256 _domain, uint256 _group, JBGroupedSplits[] memory _splitsGroup ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './../structs/JBGroupedSplits.sol'; import './../structs/JBSplit.sol'; import './IJBDirectory.sol'; import './IJBProjects.sol'; interface IJBSplitsStore { event SetSplit( uint256 indexed projectId, uint256 indexed domain, uint256 indexed group, JBSplit split, address caller ); function projects() external view returns (IJBProjects); function directory() external view returns (IJBDirectory); function splitsOf( uint256 _projectId, uint256 _domain, uint256 _group ) external view returns (JBSplit[] memory); function set( uint256 _projectId, uint256 _domain, JBGroupedSplits[] memory _groupedSplits ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IJBTokenUriResolver { function getUri(uint256 _projectId) external view returns (string memory tokenUri); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** @notice Global constants used across Juicebox contracts. */ library JBConstants { uint256 public constant MAX_RESERVED_RATE = 10_000; uint256 public constant MAX_REDEMPTION_RATE = 10_000; uint256 public constant MAX_DISCOUNT_RATE = 1_000_000_000; uint256 public constant SPLITS_TOTAL_PERCENT = 1_000_000_000; uint256 public constant MAX_FEE = 1_000_000_000; uint256 public constant MAX_FEE_DISCOUNT = 1_000_000_000; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library JBTokens { /** @notice The ETH token address in Juicebox is represented by 0x000000000000000000000000000000000000EEEe. */ address public constant ETH = address(0x000000000000000000000000000000000000EEEe); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './../interfaces/IJBFundingCycleBallot.sol'; /** @member number The funding cycle number for the cycle's project. Each funding cycle has a number that is an increment of the cycle that directly preceded it. Each project's first funding cycle has a number of 1. @member configuration The timestamp when the parameters for this funding cycle were configured. This value will stay the same for subsequent funding cycles that roll over from an originally configured cycle. @member basedOn The `configuration` of the funding cycle that was active when this cycle was created. @member start The timestamp marking the moment from which the funding cycle is considered active. It is a unix timestamp measured in seconds. @member duration The number of seconds the funding cycle lasts for, after which a new funding cycle will start. A duration of 0 means that the funding cycle will stay active until the project owner explicitly issues a reconfiguration, at which point a new funding cycle will immediately start with the updated properties. If the duration is greater than 0, a project owner cannot make changes to a funding cycle's parameters while it is active – any proposed changes will apply to the subsequent cycle. If no changes are proposed, a funding cycle rolls over to another one with the same properties but new `start` timestamp and a discounted `weight`. @member weight A fixed point number with 18 decimals that contracts can use to base arbitrary calculations on. For example, payment terminals can use this to determine how many tokens should be minted when a payment is received. @member discountRate A percent by how much the `weight` of the subsequent funding cycle should be reduced, if the project owner hasn't configured the subsequent funding cycle with an explicit `weight`. If it's 0, each funding cycle will have equal weight. If the number is 90%, the next funding cycle will have a 10% smaller weight. This weight is out of `JBConstants.MAX_DISCOUNT_RATE`. @member ballot An address of a contract that says whether a proposed reconfiguration should be accepted or rejected. It can be used to create rules around how a project owner can change funding cycle parameters over time. @member metadata Extra data that can be associated with a funding cycle. */ struct JBFundingCycle { uint256 number; uint256 configuration; uint256 basedOn; uint256 start; uint256 duration; uint256 weight; uint256 discountRate; IJBFundingCycleBallot ballot; uint256 metadata; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './../interfaces/IJBFundingCycleBallot.sol'; /** @member duration The number of seconds the funding cycle lasts for, after which a new funding cycle will start. A duration of 0 means that the funding cycle will stay active until the project owner explicitly issues a reconfiguration, at which point a new funding cycle will immediately start with the updated properties. If the duration is greater than 0, a project owner cannot make changes to a funding cycle's parameters while it is active – any proposed changes will apply to the subsequent cycle. If no changes are proposed, a funding cycle rolls over to another one with the same properties but new `start` timestamp and a discounted `weight`. @member weight A fixed point number with 18 decimals that contracts can use to base arbitrary calculations on. For example, payment terminals can use this to determine how many tokens should be minted when a payment is received. @member discountRate A percent by how much the `weight` of the subsequent funding cycle should be reduced, if the project owner hasn't configured the subsequent funding cycle with an explicit `weight`. If it's 0, each funding cycle will have equal weight. If the number is 90%, the next funding cycle will have a 10% smaller weight. This weight is out of `JBConstants.MAX_DISCOUNT_RATE`. @member ballot An address of a contract that says whether a proposed reconfiguration should be accepted or rejected. It can be used to create rules around how a project owner can change funding cycle parameters over time. */ struct JBFundingCycleData { uint256 duration; uint256 weight; uint256 discountRate; IJBFundingCycleBallot ballot; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './JBSplit.sol'; /** @member group The group indentifier. @member splits The splits to associate with the group. */ struct JBGroupedSplits { uint256 group; JBSplit[] splits; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** @member content The metadata content. @member domain The domain within which the metadata applies. */ struct JBProjectMetadata { string content; uint256 domain; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './../interfaces/IJBSplitAllocator.sol'; /** @member preferClaimed A flag that only has effect if a projectId is also specified, and the project has a token contract attached. If so, this flag indicates if the tokens that result from making a payment to the project should be delivered claimed into the beneficiary's wallet, or unclaimed to save gas. @member preferAddToBalance A flag indicating if a distribution to a project should prefer triggering it's addToBalance function instead of its pay function. @member percent The percent of the whole group that this split occupies. This number is out of `JBConstants.SPLITS_TOTAL_PERCENT`. @member projectId The ID of a project. If an allocator is not set but a projectId is set, funds will be sent to the protocol treasury belonging to the project who's ID is specified. Resulting tokens will be routed to the beneficiary with the claimed token preference respected. @member beneficiary An address. The role the of the beneficary depends on whether or not projectId is specified, and whether or not an allocator is specified. If allocator is set, the beneficiary will be forwarded to the allocator for it to use. If allocator is not set but projectId is set, the beneficiary is the address to which the project's tokens will be sent that result from a payment to it. If neither allocator or projectId are set, the beneficiary is where the funds from the split will be sent. @member lockedUntil Specifies if the split should be unchangeable until the specified time, with the exception of extending the locked period. @member allocator If an allocator is specified, funds will be sent to the allocator contract along with all properties of this split. */ struct JBSplit { bool preferClaimed; bool preferAddToBalance; uint256 percent; uint256 projectId; address payable beneficiary; uint256 lockedUntil; IJBSplitAllocator allocator; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './JBSplit.sol'; /** @member token The token being sent to the split allocator. @member amount The amount being sent to the split allocator, as a fixed point number. @member decimals The number of decimals in the amount. @member projectId The project to which the split belongs. @member group The group to which the split belongs. @member split The split that caused the allocation. */ struct JBSplitAllocationData { address token; uint256 amount; uint256 decimals; uint256 projectId; uint256 group; JBSplit split; }
// SPDX-License-Identifier: Unlicense pragma solidity >=0.8.4; /// @notice Emitted when the result overflows uint256. error PRBMath__MulDivFixedPointOverflow(uint256 prod1); /// @notice Emitted when the result overflows uint256. error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator); /// @notice Emitted when one of the inputs is type(int256).min. error PRBMath__MulDivSignedInputTooSmall(); /// @notice Emitted when the intermediary absolute result overflows int256. error PRBMath__MulDivSignedOverflow(uint256 rAbs); /// @notice Emitted when the input is MIN_SD59x18. error PRBMathSD59x18__AbsInputTooSmall(); /// @notice Emitted when ceiling a number overflows SD59x18. error PRBMathSD59x18__CeilOverflow(int256 x); /// @notice Emitted when one of the inputs is MIN_SD59x18. error PRBMathSD59x18__DivInputTooSmall(); /// @notice Emitted when one of the intermediary unsigned results overflows SD59x18. error PRBMathSD59x18__DivOverflow(uint256 rAbs); /// @notice Emitted when the input is greater than 133.084258667509499441. error PRBMathSD59x18__ExpInputTooBig(int256 x); /// @notice Emitted when the input is greater than 192. error PRBMathSD59x18__Exp2InputTooBig(int256 x); /// @notice Emitted when flooring a number underflows SD59x18. error PRBMathSD59x18__FloorUnderflow(int256 x); /// @notice Emitted when converting a basic integer to the fixed-point format overflows SD59x18. error PRBMathSD59x18__FromIntOverflow(int256 x); /// @notice Emitted when converting a basic integer to the fixed-point format underflows SD59x18. error PRBMathSD59x18__FromIntUnderflow(int256 x); /// @notice Emitted when the product of the inputs is negative. error PRBMathSD59x18__GmNegativeProduct(int256 x, int256 y); /// @notice Emitted when multiplying the inputs overflows SD59x18. error PRBMathSD59x18__GmOverflow(int256 x, int256 y); /// @notice Emitted when the input is less than or equal to zero. error PRBMathSD59x18__LogInputTooSmall(int256 x); /// @notice Emitted when one of the inputs is MIN_SD59x18. error PRBMathSD59x18__MulInputTooSmall(); /// @notice Emitted when the intermediary absolute result overflows SD59x18. error PRBMathSD59x18__MulOverflow(uint256 rAbs); /// @notice Emitted when the intermediary absolute result overflows SD59x18. error PRBMathSD59x18__PowuOverflow(uint256 rAbs); /// @notice Emitted when the input is negative. error PRBMathSD59x18__SqrtNegativeInput(int256 x); /// @notice Emitted when the calculating the square root overflows SD59x18. error PRBMathSD59x18__SqrtOverflow(int256 x); /// @notice Emitted when addition overflows UD60x18. error PRBMathUD60x18__AddOverflow(uint256 x, uint256 y); /// @notice Emitted when ceiling a number overflows UD60x18. error PRBMathUD60x18__CeilOverflow(uint256 x); /// @notice Emitted when the input is greater than 133.084258667509499441. error PRBMathUD60x18__ExpInputTooBig(uint256 x); /// @notice Emitted when the input is greater than 192. error PRBMathUD60x18__Exp2InputTooBig(uint256 x); /// @notice Emitted when converting a basic integer to the fixed-point format format overflows UD60x18. error PRBMathUD60x18__FromUintOverflow(uint256 x); /// @notice Emitted when multiplying the inputs overflows UD60x18. error PRBMathUD60x18__GmOverflow(uint256 x, uint256 y); /// @notice Emitted when the input is less than 1. error PRBMathUD60x18__LogInputTooSmall(uint256 x); /// @notice Emitted when the calculating the square root overflows UD60x18. error PRBMathUD60x18__SqrtOverflow(uint256 x); /// @notice Emitted when subtraction underflows UD60x18. error PRBMathUD60x18__SubUnderflow(uint256 x, uint256 y); /// @dev Common mathematical functions used in both PRBMathSD59x18 and PRBMathUD60x18. Note that this shared library /// does not always assume the signed 59.18-decimal fixed-point or the unsigned 60.18-decimal fixed-point /// representation. When it does not, it is explicitly mentioned in the NatSpec documentation. library PRBMath { /// STRUCTS /// struct SD59x18 { int256 value; } struct UD60x18 { uint256 value; } /// STORAGE /// /// @dev How many trailing decimals can be represented. uint256 internal constant SCALE = 1e18; /// @dev Largest power of two divisor of SCALE. uint256 internal constant SCALE_LPOTD = 262144; /// @dev SCALE inverted mod 2^256. uint256 internal constant SCALE_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281; /// FUNCTIONS /// /// @notice Calculates the binary exponent of x using the binary fraction method. /// @dev Has to use 192.64-bit fixed-point numbers. /// See https://ethereum.stackexchange.com/a/96594/24693. /// @param x The exponent as an unsigned 192.64-bit fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function exp2(uint256 x) internal pure returns (uint256 result) { unchecked { // Start from 0.5 in the 192.64-bit fixed-point format. result = 0x800000000000000000000000000000000000000000000000; // Multiply the result by root(2, 2^-i) when the bit at position i is 1. None of the intermediary results overflows // because the initial result is 2^191 and all magic factors are less than 2^65. if (x & 0x8000000000000000 > 0) { result = (result * 0x16A09E667F3BCC909) >> 64; } if (x & 0x4000000000000000 > 0) { result = (result * 0x1306FE0A31B7152DF) >> 64; } if (x & 0x2000000000000000 > 0) { result = (result * 0x1172B83C7D517ADCE) >> 64; } if (x & 0x1000000000000000 > 0) { result = (result * 0x10B5586CF9890F62A) >> 64; } if (x & 0x800000000000000 > 0) { result = (result * 0x1059B0D31585743AE) >> 64; } if (x & 0x400000000000000 > 0) { result = (result * 0x102C9A3E778060EE7) >> 64; } if (x & 0x200000000000000 > 0) { result = (result * 0x10163DA9FB33356D8) >> 64; } if (x & 0x100000000000000 > 0) { result = (result * 0x100B1AFA5ABCBED61) >> 64; } if (x & 0x80000000000000 > 0) { result = (result * 0x10058C86DA1C09EA2) >> 64; } if (x & 0x40000000000000 > 0) { result = (result * 0x1002C605E2E8CEC50) >> 64; } if (x & 0x20000000000000 > 0) { result = (result * 0x100162F3904051FA1) >> 64; } if (x & 0x10000000000000 > 0) { result = (result * 0x1000B175EFFDC76BA) >> 64; } if (x & 0x8000000000000 > 0) { result = (result * 0x100058BA01FB9F96D) >> 64; } if (x & 0x4000000000000 > 0) { result = (result * 0x10002C5CC37DA9492) >> 64; } if (x & 0x2000000000000 > 0) { result = (result * 0x1000162E525EE0547) >> 64; } if (x & 0x1000000000000 > 0) { result = (result * 0x10000B17255775C04) >> 64; } if (x & 0x800000000000 > 0) { result = (result * 0x1000058B91B5BC9AE) >> 64; } if (x & 0x400000000000 > 0) { result = (result * 0x100002C5C89D5EC6D) >> 64; } if (x & 0x200000000000 > 0) { result = (result * 0x10000162E43F4F831) >> 64; } if (x & 0x100000000000 > 0) { result = (result * 0x100000B1721BCFC9A) >> 64; } if (x & 0x80000000000 > 0) { result = (result * 0x10000058B90CF1E6E) >> 64; } if (x & 0x40000000000 > 0) { result = (result * 0x1000002C5C863B73F) >> 64; } if (x & 0x20000000000 > 0) { result = (result * 0x100000162E430E5A2) >> 64; } if (x & 0x10000000000 > 0) { result = (result * 0x1000000B172183551) >> 64; } if (x & 0x8000000000 > 0) { result = (result * 0x100000058B90C0B49) >> 64; } if (x & 0x4000000000 > 0) { result = (result * 0x10000002C5C8601CC) >> 64; } if (x & 0x2000000000 > 0) { result = (result * 0x1000000162E42FFF0) >> 64; } if (x & 0x1000000000 > 0) { result = (result * 0x10000000B17217FBB) >> 64; } if (x & 0x800000000 > 0) { result = (result * 0x1000000058B90BFCE) >> 64; } if (x & 0x400000000 > 0) { result = (result * 0x100000002C5C85FE3) >> 64; } if (x & 0x200000000 > 0) { result = (result * 0x10000000162E42FF1) >> 64; } if (x & 0x100000000 > 0) { result = (result * 0x100000000B17217F8) >> 64; } if (x & 0x80000000 > 0) { result = (result * 0x10000000058B90BFC) >> 64; } if (x & 0x40000000 > 0) { result = (result * 0x1000000002C5C85FE) >> 64; } if (x & 0x20000000 > 0) { result = (result * 0x100000000162E42FF) >> 64; } if (x & 0x10000000 > 0) { result = (result * 0x1000000000B17217F) >> 64; } if (x & 0x8000000 > 0) { result = (result * 0x100000000058B90C0) >> 64; } if (x & 0x4000000 > 0) { result = (result * 0x10000000002C5C860) >> 64; } if (x & 0x2000000 > 0) { result = (result * 0x1000000000162E430) >> 64; } if (x & 0x1000000 > 0) { result = (result * 0x10000000000B17218) >> 64; } if (x & 0x800000 > 0) { result = (result * 0x1000000000058B90C) >> 64; } if (x & 0x400000 > 0) { result = (result * 0x100000000002C5C86) >> 64; } if (x & 0x200000 > 0) { result = (result * 0x10000000000162E43) >> 64; } if (x & 0x100000 > 0) { result = (result * 0x100000000000B1721) >> 64; } if (x & 0x80000 > 0) { result = (result * 0x10000000000058B91) >> 64; } if (x & 0x40000 > 0) { result = (result * 0x1000000000002C5C8) >> 64; } if (x & 0x20000 > 0) { result = (result * 0x100000000000162E4) >> 64; } if (x & 0x10000 > 0) { result = (result * 0x1000000000000B172) >> 64; } if (x & 0x8000 > 0) { result = (result * 0x100000000000058B9) >> 64; } if (x & 0x4000 > 0) { result = (result * 0x10000000000002C5D) >> 64; } if (x & 0x2000 > 0) { result = (result * 0x1000000000000162E) >> 64; } if (x & 0x1000 > 0) { result = (result * 0x10000000000000B17) >> 64; } if (x & 0x800 > 0) { result = (result * 0x1000000000000058C) >> 64; } if (x & 0x400 > 0) { result = (result * 0x100000000000002C6) >> 64; } if (x & 0x200 > 0) { result = (result * 0x10000000000000163) >> 64; } if (x & 0x100 > 0) { result = (result * 0x100000000000000B1) >> 64; } if (x & 0x80 > 0) { result = (result * 0x10000000000000059) >> 64; } if (x & 0x40 > 0) { result = (result * 0x1000000000000002C) >> 64; } if (x & 0x20 > 0) { result = (result * 0x10000000000000016) >> 64; } if (x & 0x10 > 0) { result = (result * 0x1000000000000000B) >> 64; } if (x & 0x8 > 0) { result = (result * 0x10000000000000006) >> 64; } if (x & 0x4 > 0) { result = (result * 0x10000000000000003) >> 64; } if (x & 0x2 > 0) { result = (result * 0x10000000000000001) >> 64; } if (x & 0x1 > 0) { result = (result * 0x10000000000000001) >> 64; } // We're doing two things at the same time: // // 1. Multiply the result by 2^n + 1, where "2^n" is the integer part and the one is added to account for // the fact that we initially set the result to 0.5. This is accomplished by subtracting from 191 // rather than 192. // 2. Convert the result to the unsigned 60.18-decimal fixed-point format. // // This works because 2^(191-ip) = 2^ip / 2^191, where "ip" is the integer part "2^n". result *= SCALE; result >>= (191 - (x >> 64)); } } /// @notice Finds the zero-based index of the first one in the binary representation of x. /// @dev See the note on msb in the "Find First Set" Wikipedia article https://en.wikipedia.org/wiki/Find_first_set /// @param x The uint256 number for which to find the index of the most significant bit. /// @return msb The index of the most significant bit as an uint256. function mostSignificantBit(uint256 x) internal pure returns (uint256 msb) { if (x >= 2**128) { x >>= 128; msb += 128; } if (x >= 2**64) { x >>= 64; msb += 64; } if (x >= 2**32) { x >>= 32; msb += 32; } if (x >= 2**16) { x >>= 16; msb += 16; } if (x >= 2**8) { x >>= 8; msb += 8; } if (x >= 2**4) { x >>= 4; msb += 4; } if (x >= 2**2) { x >>= 2; msb += 2; } if (x >= 2**1) { // No need to shift x any more. msb += 1; } } /// @notice Calculates floor(x*y÷denominator) with full precision. /// /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv. /// /// Requirements: /// - The denominator cannot be zero. /// - The result must fit within uint256. /// /// Caveats: /// - This function does not work with fixed-point numbers. /// /// @param x The multiplicand as an uint256. /// @param y The multiplier as an uint256. /// @param denominator The divisor as an uint256. /// @return result The result as an uint256. function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { unchecked { result = prod0 / denominator; } return result; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (prod1 >= denominator) { revert PRBMath__MulDivOverflow(prod1, denominator); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. unchecked { // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 lpotdod = denominator & (~denominator + 1); assembly { // Divide denominator by lpotdod. denominator := div(denominator, lpotdod) // Divide [prod1 prod0] by lpotdod. prod0 := div(prod0, lpotdod) // Flip lpotdod such that it is 2^256 / lpotdod. If lpotdod is zero, then it becomes one. lpotdod := add(div(sub(0, lpotdod), lpotdod), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * lpotdod; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /// @notice Calculates floor(x*y÷1e18) with full precision. /// /// @dev Variant of "mulDiv" with constant folding, i.e. in which the denominator is always 1e18. Before returning the /// final result, we add 1 if (x * y) % SCALE >= HALF_SCALE. Without this, 6.6e-19 would be truncated to 0 instead of /// being rounded to 1e-18. See "Listing 6" and text above it at https://accu.org/index.php/journals/1717. /// /// Requirements: /// - The result must fit within uint256. /// /// Caveats: /// - The body is purposely left uncommented; see the NatSpec comments in "PRBMath.mulDiv" to understand how this works. /// - It is assumed that the result can never be type(uint256).max when x and y solve the following two equations: /// 1. x * y = type(uint256).max * SCALE /// 2. (x * y) % SCALE >= SCALE / 2 /// /// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number. /// @param y The multiplier as an unsigned 60.18-decimal fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function mulDivFixedPoint(uint256 x, uint256 y) internal pure returns (uint256 result) { uint256 prod0; uint256 prod1; assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } if (prod1 >= SCALE) { revert PRBMath__MulDivFixedPointOverflow(prod1); } uint256 remainder; uint256 roundUpUnit; assembly { remainder := mulmod(x, y, SCALE) roundUpUnit := gt(remainder, 499999999999999999) } if (prod1 == 0) { unchecked { result = (prod0 / SCALE) + roundUpUnit; return result; } } assembly { result := add( mul( or( div(sub(prod0, remainder), SCALE_LPOTD), mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, SCALE_LPOTD), SCALE_LPOTD), 1)) ), SCALE_INVERSE ), roundUpUnit ) } } /// @notice Calculates floor(x*y÷denominator) with full precision. /// /// @dev An extension of "mulDiv" for signed numbers. Works by computing the signs and the absolute values separately. /// /// Requirements: /// - None of the inputs can be type(int256).min. /// - The result must fit within int256. /// /// @param x The multiplicand as an int256. /// @param y The multiplier as an int256. /// @param denominator The divisor as an int256. /// @return result The result as an int256. function mulDivSigned( int256 x, int256 y, int256 denominator ) internal pure returns (int256 result) { if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) { revert PRBMath__MulDivSignedInputTooSmall(); } // Get hold of the absolute values of x, y and the denominator. uint256 ax; uint256 ay; uint256 ad; unchecked { ax = x < 0 ? uint256(-x) : uint256(x); ay = y < 0 ? uint256(-y) : uint256(y); ad = denominator < 0 ? uint256(-denominator) : uint256(denominator); } // Compute the absolute value of (x*y)÷denominator. The result must fit within int256. uint256 rAbs = mulDiv(ax, ay, ad); if (rAbs > uint256(type(int256).max)) { revert PRBMath__MulDivSignedOverflow(rAbs); } // Get the signs of x, y and the denominator. uint256 sx; uint256 sy; uint256 sd; assembly { sx := sgt(x, sub(0, 1)) sy := sgt(y, sub(0, 1)) sd := sgt(denominator, sub(0, 1)) } // XOR over sx, sy and sd. This is checking whether there are one or three negative signs in the inputs. // If yes, the result should be negative. result = sx ^ sy ^ sd == 0 ? -int256(rAbs) : int256(rAbs); } /// @notice Calculates the square root of x, rounding down. /// @dev Uses the Babylonian method https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method. /// /// Caveats: /// - This function does not work with fixed-point numbers. /// /// @param x The uint256 number for which to calculate the square root. /// @return result The result as an uint256. function sqrt(uint256 x) internal pure returns (uint256 result) { if (x == 0) { return 0; } // Set the initial guess to the closest power of two that is higher than x. uint256 xAux = uint256(x); result = 1; if (xAux >= 0x100000000000000000000000000000000) { xAux >>= 128; result <<= 64; } if (xAux >= 0x10000000000000000) { xAux >>= 64; result <<= 32; } if (xAux >= 0x100000000) { xAux >>= 32; result <<= 16; } if (xAux >= 0x10000) { xAux >>= 16; result <<= 8; } if (xAux >= 0x100) { xAux >>= 8; result <<= 4; } if (xAux >= 0x10) { xAux >>= 4; result <<= 2; } if (xAux >= 0x8) { result <<= 1; } // The operations can never overflow because the result is max 2^127 when it enters this block. unchecked { result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; // Seven iterations should be enough uint256 roundedDownResult = x / result; return result >= roundedDownResult ? roundedDownResult : result; } } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 10000 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IJBSplitsStore","name":"_splitsStore","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IJBSplitsPayer","name":"splitsPayer","type":"address"},{"indexed":false,"internalType":"uint256","name":"defaultSplitsProjectId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"defaultSplitsDomain","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"defaultSplitsGroup","type":"uint256"},{"indexed":false,"internalType":"contract IJBSplitsStore","name":"splitsStore","type":"address"},{"indexed":false,"internalType":"uint256","name":"defaultProjectId","type":"uint256"},{"indexed":false,"internalType":"address","name":"defaultBeneficiary","type":"address"},{"indexed":false,"internalType":"bool","name":"defaultPreferClaimedTokens","type":"bool"},{"indexed":false,"internalType":"string","name":"defaultMemo","type":"string"},{"indexed":false,"internalType":"bytes","name":"defaultMetadata","type":"bytes"},{"indexed":false,"internalType":"bool","name":"preferAddToBalance","type":"bool"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"DeploySplitsPayer","type":"event"},{"inputs":[{"internalType":"uint256","name":"_defaultSplitsProjectId","type":"uint256"},{"internalType":"uint256","name":"_defaultSplitsDomain","type":"uint256"},{"internalType":"uint256","name":"_defaultSplitsGroup","type":"uint256"},{"internalType":"uint256","name":"_defaultProjectId","type":"uint256"},{"internalType":"address payable","name":"_defaultBeneficiary","type":"address"},{"internalType":"bool","name":"_defaultPreferClaimedTokens","type":"bool"},{"internalType":"string","name":"_defaultMemo","type":"string"},{"internalType":"bytes","name":"_defaultMetadata","type":"bytes"},{"internalType":"bool","name":"_defaultPreferAddToBalance","type":"bool"},{"internalType":"address","name":"_owner","type":"address"}],"name":"deploySplitsPayer","outputs":[{"internalType":"contract IJBSplitsPayer","name":"splitsPayer","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_defaultSplitsProjectId","type":"uint256"},{"components":[{"internalType":"bool","name":"preferClaimed","type":"bool"},{"internalType":"bool","name":"preferAddToBalance","type":"bool"},{"internalType":"uint256","name":"percent","type":"uint256"},{"internalType":"uint256","name":"projectId","type":"uint256"},{"internalType":"address payable","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"lockedUntil","type":"uint256"},{"internalType":"contract IJBSplitAllocator","name":"allocator","type":"address"}],"internalType":"struct JBSplit[]","name":"_defaultSplits","type":"tuple[]"},{"internalType":"contract IJBSplitsStore","name":"_splitsStore","type":"address"},{"internalType":"uint256","name":"_defaultProjectId","type":"uint256"},{"internalType":"address payable","name":"_defaultBeneficiary","type":"address"},{"internalType":"bool","name":"_defaultPreferClaimedTokens","type":"bool"},{"internalType":"string","name":"_defaultMemo","type":"string"},{"internalType":"bytes","name":"_defaultMetadata","type":"bytes"},{"internalType":"bool","name":"_defaultPreferAddToBalance","type":"bool"},{"internalType":"address","name":"_owner","type":"address"}],"name":"deploySplitsPayerWithSplits","outputs":[{"internalType":"contract IJBSplitsPayer","name":"splitsPayer","type":"address"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c060405234801561001057600080fd5b506040516147ad3803806147ad83398101604081905261002f9161008d565b8060405161003c90610080565b6001600160a01b039091168152602001604051809103906000f080158015610068573d6000803e3d6000fd5b506001600160a01b039081166080521660a0526100bd565b613b7e80610c2f83390190565b60006020828403121561009f57600080fd5b81516001600160a01b03811681146100b657600080fd5b9392505050565b60805160a051610b4e6100e1600039600061018b0152600060910152610b4e6000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80631a2a1a201461003b5780632d3fb8a314610077575b600080fd5b61004e6100493660046105b5565b61008a565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b61004e61008536600461077a565b6101e0565b60006100b57f000000000000000000000000000000000000000000000000000000000000000061035a565b6040517fec818c8900000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff82169063ec818c899061011c908e908e908e908e908e908e908e908e908e908e90600401610870565b600060405180830381600087803b15801561013657600080fd5b505af115801561014a573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff167f9d8d9335be0008f50a6547966dd6a854fd9df1f0be7838b8a445b562513627448c8c8c7f00000000000000000000000000000000000000000000000000000000000000008d8d8d8d8d8d8d336040516101ca9c9b9a999897969594939291906108fa565b60405180910390a29a9950505050505050505050565b6040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b16602082015243603482015260009030908290605401604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815282825280516020909101206001808452838301909252925060609190816020015b60408051808201909152600081526060602082015281526020019060019003908161026a57905050905060405180604001604052808381526020018e815250816000815181106102bc576102bc6109c6565b60200260200101819052508b73ffffffffffffffffffffffffffffffffffffffff1663f2da44b68f85846040518463ffffffff1660e01b8152600401610304939291906109f5565b600060405180830381600087803b15801561031e57600080fd5b505af1158015610332573d6000803e3d6000fd5b505050506103488e84848e8e8e8e8e8e8e61008a565b9e9d5050505050505050505050505050565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f091505073ffffffffffffffffffffffffffffffffffffffff811661043b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f455243313136373a20637265617465206661696c656400000000000000000000604482015260640160405180910390fd5b919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461046257600080fd5b50565b803561043b81610440565b8035801515811461043b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff811182821017156104d2576104d2610480565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561051f5761051f610480565b604052919050565b600082601f83011261053857600080fd5b813567ffffffffffffffff81111561055257610552610480565b61058360207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016104d8565b81815284602083860101111561059857600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000806000806000806101408b8d0312156105d557600080fd5b8a35995060208b0135985060408b0135975060608b013596506105fa60808c01610465565b955061060860a08c01610470565b945060c08b013567ffffffffffffffff8082111561062557600080fd5b6106318e838f01610527565b955060e08d013591508082111561064757600080fd5b506106548d828e01610527565b9350506106646101008c01610470565b91506106736101208c01610465565b90509295989b9194979a5092959850565b600082601f83011261069557600080fd5b8135602067ffffffffffffffff8211156106b1576106b1610480565b6106bf818360051b016104d8565b82815260e092830285018201928282019190878511156106de57600080fd5b8387015b8581101561076d5781818a0312156106fa5760008081fd5b6107026104af565b61070b82610470565b8152610718868301610470565b81870152604082810135908201526060808301359082015260808083013561073f81610440565b9082015260a0828101359082015260c08083013561075c81610440565b9082015284529284019281016106e2565b5090979650505050505050565b6000806000806000806000806000806101408b8d03121561079a57600080fd5b8a35995060208b013567ffffffffffffffff808211156107b957600080fd5b6107c58e838f01610684565b9a506107d360408e01610465565b995060608d013598506107e860808e01610465565b97506107f660a08e01610470565b965060c08d013591508082111561062557600080fd5b6000815180845260005b8181101561083257602081850181015186830182015201610816565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60006101408c83528b60208401528a604084015289606084015273ffffffffffffffffffffffffffffffffffffffff808a16608085015288151560a08501528160c08501526108c18285018961080c565b915083820360e08501526108d5828861080c565b925085151561010085015280851661012085015250509b9a5050505050505050505050565b60006101808e83528d60208401528c604084015273ffffffffffffffffffffffffffffffffffffffff808d1660608501528b6080850152808b1660a08501525088151560c08401528060e08401526109548184018961080c565b9050828103610100840152610969818861080c565b91505084151561012083015261099861014083018573ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff83166101608301529d9c50505050505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060608083018684526020868186015260408381870152828751808552608094508488019150848160051b890101848a0160005b83811015610b06578a83037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff800185528151805184528701518784018790528051878501819052908801906000908b8601905b80831015610af15783518051151583528b81015115158c8401528a8101518b8401528d8101518e8401528c81015173ffffffffffffffffffffffffffffffffffffffff9081168e85015260a0808301519085015260c0918201511690830152928a01926001929092019160e090910190610a7c565b50968901969450505090860190600101610a2a565b50909c9b50505050505050505050505056fea26469706673582212200ce553bd906a6acfb51f721c67147d428b61e4bb20e8c11fdbe007a2536e8b7364736f6c6343000810003360e06040523480156200001157600080fd5b5060405162003b7e38038062003b7e83398101604081905262000034916200012e565b806001600160a01b031663c41c2f246040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000073573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200009991906200012e565b620000a433620000c5565b6001600160a01b039081166080523360a05260016006551660c05262000155565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200012b57600080fd5b50565b6000602082840312156200014157600080fd5b81516200014e8162000115565b9392505050565b60805160a05160c0516139d6620001a8600039600081816105910152818161086e0152611c330152600081816106630152611cc70152600081816107c00152818161096f0152610bd301526139d66000f3fe6080604052600436106101845760003560e01c8063715018a6116100d6578063ae16f56a1161007f578063c41c2f2411610059578063c41c2f24146107ae578063ec818c89146107e2578063f2fde38b1461080257600080fd5b8063ae16f56a14610759578063b96053df14610779578063c0048ca51461078e57600080fd5b80638da5cb5b116100b05780638da5cb5b146106ef57806393b7f1541461070d578063a4919eb11461072757600080fd5b8063715018a6146106a55780637e646549146106ba5780638293fee6146106dc57600080fd5b80633ce9830b1161013857806354ab58af1161011257806354ab58af1461063157806364d3ed271461065157806371277d571461068557600080fd5b80633ce9830b146105ef578063421a2fb5146106055780635380cf8f1461061b57600080fd5b80630e45f78e116101695780630e45f78e1461055f5780632bdfe0041461057f5780633c212b1c146105cb57600080fd5b806301ffc9a71461051557806309a6b7e51461054a57600080fd5b36610510576002600654036101e05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026006819055600754600854600954925460009361022893929161eeee9047906012906001600160a01b03166102175732610822565b6002546001600160a01b0316610822565b9050806000036102385750610507565b600154156104d85760055460ff16156103775761037260015461eeee83601260038054610264906128dd565b80601f0160208091040260200160405190810160405280929190818152602001828054610290906128dd565b80156102dd5780601f106102b2576101008083540402835291602001916102dd565b820191906000526020600020905b8154815290600101906020018083116102c057829003601f168201915b5050505050600480546102ef906128dd565b80601f016020809104026020016040519081016040528092919081815260200182805461031b906128dd565b80156103685780601f1061033d57610100808354040283529160200191610368565b820191906000526020600020905b81548152906001019060200180831161034b57829003601f168201915b505050505061092d565b610505565b600154600254610372919061eeee9084906012906001600160a01b031661039e57326103ab565b6002546001600160a01b03165b6000600260149054906101000a900460ff16600380546103ca906128dd565b80601f01602080910402602001604051908101604052809291908181526020018280546103f6906128dd565b80156104435780601f1061041857610100808354040283529160200191610443565b820191906000526020600020905b81548152906001019060200180831161042657829003601f168201915b505050505060048054610455906128dd565b80601f0160208091040260200160405190810160405280929190818152602001828054610481906128dd565b80156104ce5780601f106104a3576101008083540402835291602001916104ce565b820191906000526020600020905b8154815290600101906020018083116104b157829003601f168201915b5050505050610b91565b600254610505906001600160a01b03166104f257326104ff565b6002546001600160a01b03165b82610e52565b505b60016006819055005b600080fd5b34801561052157600080fd5b50610535610530366004612930565b610f70565b60405190151581526020015b60405180910390f35b61055d6105583660046129e0565b610fcc565b005b34801561056b57600080fd5b5061055d61057a366004612bb4565b61135f565b34801561058b57600080fd5b506105b37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610541565b3480156105d757600080fd5b506105e160095481565b604051908152602001610541565b3480156105fb57600080fd5b506105e160015481565b34801561061157600080fd5b506105e160075481565b34801561062757600080fd5b506105e160085481565b34801561063d57600080fd5b506002546105b3906001600160a01b031681565b34801561065d57600080fd5b506105b37f000000000000000000000000000000000000000000000000000000000000000081565b34801561069157600080fd5b5061055d6106a0366004612c5a565b6115c2565b3480156106b157600080fd5b5061055d611687565b3480156106c657600080fd5b506106cf6116ed565b6040516105419190612cd6565b61055d6106ea366004612ce9565b61177b565b3480156106fb57600080fd5b506000546001600160a01b03166105b3565b34801561071957600080fd5b506005546105359060ff1681565b34801561073357600080fd5b506002546105359074010000000000000000000000000000000000000000900460ff1681565b34801561076557600080fd5b5061055d610774366004612de9565b611ba9565b34801561078557600080fd5b506106cf611caf565b34801561079a57600080fd5b5061055d6107a9366004613031565b611cbc565b3480156107ba57600080fd5b506105b37f000000000000000000000000000000000000000000000000000000000000000081565b3480156107ee57600080fd5b5061055d6107fd3660046130eb565b611dcb565b34801561080e57600080fd5b5061055d61081d3660046131ba565b611df2565b6040517f69e11cc50000000000000000000000000000000000000000000000000000000081526004810188905260248101879052604481018690526000906108e6906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906369e11cc590606401600060405180830381865afa1580156108b5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108dd91908101906131d7565b86868686611ed4565b604051338152909150869088908a907f2522c1d6a5eb94bdf38d0007aadcdd12c34a8b834b915ab71117e8c0a7e5df809060200160405180910390a4979650505050505050565b6040517f86202650000000000000000000000000000000000000000000000000000000008152600481018790526001600160a01b0386811660248301526000917f000000000000000000000000000000000000000000000000000000000000000090911690638620265090604401602060405180830381865afa1580156109b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dc91906132e1565b90506001600160a01b038116610a1e576040517ffba10dd600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb7bad1b10000000000000000000000000000000000000000000000000000000081526001600160a01b03878116600483015285919083169063b7bad1b190602401602060405180830381865afa158015610a80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa491906132fe565b14610adb576040517fb972592400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03861661eeee14610b0157610b016001600160a01b038716828761220f565b60006001600160a01b03871661eeee14610b1c576000610b1e565b855b9050816001600160a01b0316630cf8e858828a898b89896040518763ffffffff1660e01b8152600401610b55959493929190613317565b6000604051808303818588803b158015610b6e57600080fd5b505af1158015610b82573d6000803e3d6000fd5b50505050505050505050505050565b6040517f86202650000000000000000000000000000000000000000000000000000000008152600481018a90526001600160a01b0389811660248301526000917f000000000000000000000000000000000000000000000000000000000000000090911690638620265090604401602060405180830381865afa158015610c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4091906132e1565b90506001600160a01b038116610c82576040517ffba10dd600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fb7bad1b10000000000000000000000000000000000000000000000000000000081526001600160a01b038a8116600483015288919083169063b7bad1b190602401602060405180830381865afa158015610ce4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0891906132fe565b14610d3f576040517fb972592400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03891661eeee14610d6557610d656001600160a01b038a16828a61220f565b60006001600160a01b038a1661eeee14610d80576000610d82565b885b9050816001600160a01b0316631ebc263f828d8c8e60006001600160a01b03168d6001600160a01b031603610dd8576002546001600160a01b0316610dc75732610dda565b6002546001600160a01b0316610dda565b8c5b8c8c8c8c6040518a63ffffffff1660e01b8152600401610e01989796959493929190613363565b60206040518083038185885af1158015610e1f573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e4491906132fe565b505050505050505050505050565b80471015610ea25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016101d7565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610eef576040519150601f19603f3d011682016040523d82523d6000602084013e610ef4565b606091505b5050905080610f6b5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016101d7565b505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f35d42f96000000000000000000000000000000000000000000000000000000001480610fc65750610fc6826123bd565b92915050565b60026006540361101e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d7565b60026006556001600160a01b03871661eeee1461119d57341561106d576040517fbcfd35be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa1580156110cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f191906132fe565b90506111086001600160a01b03891633308a612454565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038a16906370a0823190602401602060405180830381865afa158015611167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118b91906132fe565b61119591906133cd565b9650506111a5565b349550601294505b6007546008546009546002546000936111d593909290918c908c908c906001600160a01b03166102175732610822565b905080156112e157881561125f5761125a8989838989898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a908190840183828082843760009201919091525061092d92505050565b6112e1565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff11126001600160a01b038916016112a95760025461125a906001600160a01b03166104f257326104ff565b6002546112e1906001600160a01b03166112c357326112d0565b6002546001600160a01b03165b6001600160a01b038a1690836124a5565b60025489907f5f17f788c7f8d3fd7332fb1e6c42a67accbf9bb129ac8e4389fe693b506369f1906001600160a01b031661131b5732611328565b6002546001600160a01b03165b8a8a8a868b8b8b8b336040516113479a99989796959493929190613432565b60405180910390a25050600160065550505050505050565b6000546001600160a01b031633146113b95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101d7565b60015486146113c85760018690555b6002546001600160a01b0386811691161461141157600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0387161790555b600260149054906101000a900460ff1615158415151461146f57600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000861515021790555b60036040516020016114819190613532565b60405160208183030381529060405280519060200120836040516020016114a8919061353e565b60405160208183030381529060405280519060200120146114d15760036114cf84826135a8565b505b60046040516020016114e39190613532565b604051602081830303815290604052805190602001208260405160200161150a919061353e565b604051602081830303815290604052805190602001201461153357600461153183826135a8565b505b60055460ff1615158115151461157057600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168215151790555b846001600160a01b0316867f36b1c5cef608e320317b9ee5155756634c65fe7055b424ce57e2f6c59eec794786868686336040516115b29594939291906136a4565b60405180910390a3505050505050565b6000546001600160a01b0316331461161c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101d7565b600754831461162b5760078390555b600854821461163a5760088290555b60095481146116495760098190555b6040513381528190839085907f5ef5a6931855992f84842284a6bba50d74bfe8654238b4d6325427473a90f3a59060200160405180910390a4505050565b6000546001600160a01b031633146116e15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101d7565b6116eb60006124ee565b565b600480546116fa906128dd565b80601f0160208091040260200160405190810160405280929190818152602001828054611726906128dd565b80156117735780601f1061174857610100808354040283529160200191611773565b820191906000526020600020905b81548152906001019060200180831161175657829003601f168201915b505050505081565b6002600654036117cd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d7565b60026006556001600160a01b038a1661eeee1461194c57341561181c576040517fbcfd35be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038c16906370a0823190602401602060405180830381865afa15801561187c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a091906132fe565b90506118b76001600160a01b038c1633308d612454565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038d16906370a0823190602401602060405180830381865afa158015611916573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193a91906132fe565b61194491906133cd565b995050611954565b349850601297505b60075460085460095460025460009361198493909290918f908f908f906001600160a01b03166102175732610822565b90508015611b12578b15611a5857611a538c8c838c6001600160a01b038d166119ce576002546001600160a01b03166119bd57326119d0565b6002546001600160a01b03166119d0565b8c5b8c8c8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b9192505050565b611b12565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff11126001600160a01b038c1601611ac757611a536001600160a01b038916611ac0576002546001600160a01b0316611aaf57326104ff565b6002546001600160a01b03166104ff565b8882610e52565b611b126001600160a01b038916611aff576002546001600160a01b0316611aee5732611b01565b6002546001600160a01b0316611b01565b885b6001600160a01b038d1690836124a5565b8b7f72877920bfc936c0f18c54961abe3105d7d2990103eaa013cd8420fecacb0b606001600160a01b038a16611b69576002546001600160a01b0316611b585732611b6b565b6002546001600160a01b0316611b6b565b895b8d8d8d868d8d8d8d8d8d33604051611b8e9c9b9a999897969594939291906136f4565b60405180910390a25050600160065550505050505050505050565b6000546001600160a01b03163314611c035760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101d7565b6040517ff2da44b60000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f2da44b690611c6c90879087908690600401613774565b600060405180830381600087803b158015611c8657600080fd5b505af1158015611c9a573d6000803e3d6000fd5b50505050611ca98484846115c2565b50505050565b600380546116fa906128dd565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611d1e576040517f439a74c900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018790556002805486151574010000000000000000000000000000000000000000027fffffffffffffffffffffff0000000000000000000000000000000000000000009091166001600160a01b038916171790556003611d7f85826135a8565b506004611d8c84826135a8565b50600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016831515179055611dc2816124ee565b50505050505050565b611dda87878787878787611cbc565b50505060079690965550505060089190915560095550565b6000546001600160a01b03163314611e4c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101d7565b6001600160a01b038116611ec85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016101d7565b611ed1816124ee565b50565b8260005b8651811015612205576000878281518110611ef557611ef561389d565b602002602001015190506000611f14878360400151633b9aca00612556565b905080156121be5760c08201516001600160a01b0316156120ae576040805160c0810182526001600160a01b038a168082526020820184905291810188905260015460608201526000608082015260a081018490529061eeee14611f8c5760c0830151611f8c906001600160a01b038b16908461220f565b60006001600160a01b038a1661eeee14611fa7576000611fa9565b825b60c080860151604080517f9d740bfa00000000000000000000000000000000000000000000000000000000815286516001600160a01b03908116600483015260208089015160248401528389015160448401526060808a015160648501526080808b0151608486015260a0808c01518051151560a488015293840151151560c48701529583015160e486015290820151610104850152810151821661012484015292830151610144830152919093015181166101648401529293509190911690639d740bfa908390610184016000604051808303818588803b15801561208e57600080fd5b505af11580156120a2573d6000803e3d6000fd5b505050505050506121b1565b606082015115612128578160200151156120df576120da826060015189838960038054610264906128dd565b6121b1565b6120da826060015189838960006001600160a01b031687608001516001600160a01b03160361210e5789612114565b86608001515b60008860000151600380546103ca906128dd565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff11126001600160a01b0389160161217f5760808201516120da906001600160a01b031661217457856104ff565b826080015182610e52565b60808201516121b1906001600160a01b031661219b57856112d0565b82608001516001600160a01b038a1690836124a5565b6121bb81856133cd565b93505b7ff44ffe151def7bd57d653ffdd625b5cfff3e6992ad5b8eb1f021cdaca6599544828287336040516121f394939291906138cc565b60405180910390a15050600101611ed8565b5095945050505050565b8015806122a257506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561227c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a091906132fe565b155b6123145760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016101d7565b6040516001600160a01b038316602482015260448101829052610f6b9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612660565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7ddb72fc000000000000000000000000000000000000000000000000000000001480610fc657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610fc6565b6040516001600160a01b0380851660248301528316604482015260648101829052611ca99085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612359565b6040516001600160a01b038316602482015260448101829052610f6b9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401612359565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709858702925082811083820303915050806000036125ae578382816125a4576125a4613954565b0492505050612659565b8381106125f1576040517f773cc18c00000000000000000000000000000000000000000000000000000000815260048101829052602481018590526044016101d7565b600084868809851960019081018716968790049682860381900495909211909303600082900391909104909201919091029190911760038402600290811880860282030280860282030280860282030280860282030280860282030280860290910302029150505b9392505050565b60006126b5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127459092919063ffffffff16565b805190915015610f6b57808060200190518101906126d39190613983565b610f6b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016101d7565b6060612754848460008561275c565b949350505050565b6060824710156127d45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016101d7565b6001600160a01b0385163b61282b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d7565b600080866001600160a01b03168587604051612847919061353e565b60006040518083038185875af1925050503d8060008114612884576040519150601f19603f3d011682016040523d82523d6000602084013e612889565b606091505b50915091506128998282866128a4565b979650505050505050565b606083156128b3575081612659565b8251156128c35782518084602001fd5b8160405162461bcd60e51b81526004016101d79190612cd6565b600181811c908216806128f157607f821691505b60208210810361292a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60006020828403121561294257600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461265957600080fd5b6001600160a01b0381168114611ed157600080fd5b803561299281612972565b919050565b60008083601f8401126129a957600080fd5b50813567ffffffffffffffff8111156129c157600080fd5b6020830191508360208285010111156129d957600080fd5b9250929050565b60008060008060008060008060c0898b0312156129fc57600080fd5b883597506020890135612a0e81612972565b96506040890135955060608901359450608089013567ffffffffffffffff80821115612a3957600080fd5b612a458c838d01612997565b909650945060a08b0135915080821115612a5e57600080fd5b50612a6b8b828c01612997565b999c989b5096995094979396929594505050565b8015158114611ed157600080fd5b803561299281612a7f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715612aea57612aea612a98565b60405290565b60405160e0810167ffffffffffffffff81118282101715612aea57612aea612a98565b604051601f8201601f1916810167ffffffffffffffff81118282101715612b3c57612b3c612a98565b604052919050565b600082601f830112612b5557600080fd5b813567ffffffffffffffff811115612b6f57612b6f612a98565b612b826020601f19601f84011601612b13565b818152846020838601011115612b9757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c08789031215612bcd57600080fd5b863595506020870135612bdf81612972565b94506040870135612bef81612a7f565b9350606087013567ffffffffffffffff80821115612c0c57600080fd5b612c188a838b01612b44565b94506080890135915080821115612c2e57600080fd5b50612c3b89828a01612b44565b92505060a0870135612c4c81612a7f565b809150509295509295509295565b600080600060608486031215612c6f57600080fd5b505081359360208301359350604090920135919050565b60005b83811015612ca1578181015183820152602001612c89565b50506000910152565b60008151808452612cc2816020860160208601612c86565b601f01601f19169290920160200192915050565b6020815260006126596020830184612caa565b60008060008060008060008060008060006101208c8e031215612d0b57600080fd5b8b359a50612d1c60208d0135612972565b60208c0135995060408c0135985060608c01359750612d3e60808d0135612972565b60808c0135965060a08c01359550612d5860c08d01612a8d565b945067ffffffffffffffff8060e08e01351115612d7457600080fd5b612d848e60e08f01358f01612997565b90955093506101008d0135811015612d9b57600080fd5b50612dad8d6101008e01358e01612997565b81935080925050509295989b509295989b9093969950565b600067ffffffffffffffff821115612ddf57612ddf612a98565b5060051b60200190565b60008060008060808587031215612dff57600080fd5b84359350602085013592506040850135915067ffffffffffffffff60608601351115612e2a57600080fd5b85601f606087013587010112612e3f57600080fd5b612e57612e526060870135870135612dc5565b612b13565b6060860135860180358083526020808401939260059290921b90910101881015612e8057600080fd5b602060608801358801015b60608801358801803560051b016020018110156130245767ffffffffffffffff81351115612eb857600080fd5b6040601f19823560608b01358b01018b03011215612ed557600080fd5b612edd612ac7565b606089013589018235016020810135825267ffffffffffffffff6040909101351115612f0857600080fd5b60608901358901823501604081013501603f81018b13612f2757600080fd5b612f37612e526020830135612dc5565b602082810135808352908201919060e00283016040018d1015612f5957600080fd5b604083015b604060e060208601350285010181101561300b5760e0818f031215612f8257600080fd5b612f8a612af0565b612f948235612a7f565b81358152612fa56020830135612a7f565b602082013560208201526040820135604082015260608201356060820152612fd06080830135612972565b6080820135608082015260a082013560a0820152612ff160c0830135612972565b60c08281013590820152835260209092019160e001612f5e565b5060208481019190915292865250509283019201612e8b565b5094979396509194505050565b600080600080600080600060e0888a03121561304c57600080fd5b87359650602088013561305e81612972565b9550604088013561306e81612a7f565b9450606088013567ffffffffffffffff8082111561308b57600080fd5b6130978b838c01612b44565b955060808a01359150808211156130ad57600080fd5b506130ba8a828b01612b44565b93505060a08801356130cb81612a7f565b915060c08801356130db81612972565b8091505092959891949750929550565b6000806000806000806000806000806101408b8d03121561310b57600080fd5b8a35995060208b0135985060408b0135975060608b0135965061313060808c01612987565b955061313e60a08c01612a8d565b945060c08b013567ffffffffffffffff8082111561315b57600080fd5b6131678e838f01612b44565b955060e08d013591508082111561317d57600080fd5b5061318a8d828e01612b44565b93505061319a6101008c01612a8d565b91506131a96101208c01612987565b90509295989b9194979a5092959850565b6000602082840312156131cc57600080fd5b813561265981612972565b600060208083850312156131ea57600080fd5b825167ffffffffffffffff81111561320157600080fd5b8301601f8101851361321257600080fd5b8051613220612e5282612dc5565b81815260e0918202830184019184820191908884111561323f57600080fd5b938501935b838510156132d55780858a03121561325c5760008081fd5b613264612af0565b855161326f81612a7f565b81528587015161327e81612a7f565b8188015260408681015190820152606080870151908201526080808701516132a581612972565b9082015260a0868101519082015260c0808701516132c281612972565b9082015283529384019391850191613244565b50979650505050505050565b6000602082840312156132f357600080fd5b815161265981612972565b60006020828403121561331057600080fd5b5051919050565b8581528460208201526001600160a01b038416604082015260a06060820152600061334560a0830185612caa565b82810360808401526133578185612caa565b98975050505050505050565b60006101008a83528960208401526001600160a01b03808a16604085015280891660608501525086608084015285151560a08401528060c08401526133aa81840186612caa565b905082810360e08401526133be8185612caa565b9b9a5050505050505050505050565b81810381811115610fc6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b60006101006001600160a01b03808e168452808d1660208501528b60408501528a60608501528960808501528160a0850152613471828501898b613407565b915083820360c0850152613486828789613407565b925080851660e085015250509b9a5050505050505050505050565b600081546134ae816128dd565b600182811680156134c657600181146134f957613528565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168752821515830287019450613528565b8560005260208060002060005b8581101561351f5781548a820152908401908201613506565b50505082870194505b5050505092915050565b600061265982846134a1565b60008251613550818460208701612c86565b9190910192915050565b601f821115610f6b57600081815260208120601f850160051c810160208610156135815750805b601f850160051c820191505b818110156135a05782815560010161358d565b505050505050565b815167ffffffffffffffff8111156135c2576135c2612a98565b6135d6816135d084546128dd565b8461355a565b602080601f83116001811461362957600084156135f35750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b1785556135a0565b600085815260208120601f198616915b8281101561365857888601518255948401946001909101908401613639565b508582101561369457878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b851515815260a0602082015260006136bf60a0830187612caa565b82810360408401526136d18187612caa565b941515606084015250506001600160a01b03919091166080909101529392505050565b60006001600160a01b03808f168352808e1660208401528c60408401528b60608401528a60808401528960a084015288151560c084015261014060e08401526137426101408401888a613407565b838103610100850152613756818789613407565b925050808416610120840152509d9c50505050505050505050505050565b60006060808301868452602086818601526040838187015282875180855260808801915060808160051b89010194508389016000805b8381101561388b578a88037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff800185528251805189528701518789018790528051878a018190529088019083908b8b01905b8083101561387657613860828551805115158252602081015115156020830152604081015160408301526060810151606083015260808101516001600160a01b03808216608085015260a083015160a08501528060c08401511660c085015250505050565b60e0820191508a840193506001830192506137fb565b509950505093860193918601916001016137aa565b50959c9b505050505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610140810161392d8287805115158252602081015115156020830152604081015160408301526060810151606083015260808101516001600160a01b03808216608085015260a083015160a08501528060c08401511660c085015250505050565b60e08201949094526001600160a01b03928316610100820152911661012090910152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006020828403121561399557600080fd5b815161265981612a7f56fea26469706673582212208c9af2b4648981cff6fb1cbd7aa3f4bb5ce48d5a26e15246a6f617cd311d398764736f6c634300081000330000000000000000000000000d25194abe95185db8e4b0294f5669e21c534785
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c80631a2a1a201461003b5780632d3fb8a314610077575b600080fd5b61004e6100493660046105b5565b61008a565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b61004e61008536600461077a565b6101e0565b60006100b57f0000000000000000000000006e32c616fa9cf86049b9ecaa89372adb9c21ad0e61035a565b6040517fec818c8900000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff82169063ec818c899061011c908e908e908e908e908e908e908e908e908e908e90600401610870565b600060405180830381600087803b15801561013657600080fd5b505af115801561014a573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff167f9d8d9335be0008f50a6547966dd6a854fd9df1f0be7838b8a445b562513627448c8c8c7f0000000000000000000000000d25194abe95185db8e4b0294f5669e21c5347858d8d8d8d8d8d8d336040516101ca9c9b9a999897969594939291906108fa565b60405180910390a29a9950505050505050505050565b6040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b16602082015243603482015260009030908290605401604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815282825280516020909101206001808452838301909252925060609190816020015b60408051808201909152600081526060602082015281526020019060019003908161026a57905050905060405180604001604052808381526020018e815250816000815181106102bc576102bc6109c6565b60200260200101819052508b73ffffffffffffffffffffffffffffffffffffffff1663f2da44b68f85846040518463ffffffff1660e01b8152600401610304939291906109f5565b600060405180830381600087803b15801561031e57600080fd5b505af1158015610332573d6000803e3d6000fd5b505050506103488e84848e8e8e8e8e8e8e61008a565b9e9d5050505050505050505050505050565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f091505073ffffffffffffffffffffffffffffffffffffffff811661043b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f455243313136373a20637265617465206661696c656400000000000000000000604482015260640160405180910390fd5b919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461046257600080fd5b50565b803561043b81610440565b8035801515811461043b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff811182821017156104d2576104d2610480565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561051f5761051f610480565b604052919050565b600082601f83011261053857600080fd5b813567ffffffffffffffff81111561055257610552610480565b61058360207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016104d8565b81815284602083860101111561059857600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806000806000806000806101408b8d0312156105d557600080fd5b8a35995060208b0135985060408b0135975060608b013596506105fa60808c01610465565b955061060860a08c01610470565b945060c08b013567ffffffffffffffff8082111561062557600080fd5b6106318e838f01610527565b955060e08d013591508082111561064757600080fd5b506106548d828e01610527565b9350506106646101008c01610470565b91506106736101208c01610465565b90509295989b9194979a5092959850565b600082601f83011261069557600080fd5b8135602067ffffffffffffffff8211156106b1576106b1610480565b6106bf818360051b016104d8565b82815260e092830285018201928282019190878511156106de57600080fd5b8387015b8581101561076d5781818a0312156106fa5760008081fd5b6107026104af565b61070b82610470565b8152610718868301610470565b81870152604082810135908201526060808301359082015260808083013561073f81610440565b9082015260a0828101359082015260c08083013561075c81610440565b9082015284529284019281016106e2565b5090979650505050505050565b6000806000806000806000806000806101408b8d03121561079a57600080fd5b8a35995060208b013567ffffffffffffffff808211156107b957600080fd5b6107c58e838f01610684565b9a506107d360408e01610465565b995060608d013598506107e860808e01610465565b97506107f660a08e01610470565b965060c08d013591508082111561062557600080fd5b6000815180845260005b8181101561083257602081850181015186830182015201610816565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60006101408c83528b60208401528a604084015289606084015273ffffffffffffffffffffffffffffffffffffffff808a16608085015288151560a08501528160c08501526108c18285018961080c565b915083820360e08501526108d5828861080c565b925085151561010085015280851661012085015250509b9a5050505050505050505050565b60006101808e83528d60208401528c604084015273ffffffffffffffffffffffffffffffffffffffff808d1660608501528b6080850152808b1660a08501525088151560c08401528060e08401526109548184018961080c565b9050828103610100840152610969818861080c565b91505084151561012083015261099861014083018573ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff83166101608301529d9c50505050505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060608083018684526020868186015260408381870152828751808552608094508488019150848160051b890101848a0160005b83811015610b06578a83037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff800185528151805184528701518784018790528051878501819052908801906000908b8601905b80831015610af15783518051151583528b81015115158c8401528a8101518b8401528d8101518e8401528c81015173ffffffffffffffffffffffffffffffffffffffff9081168e85015260a0808301519085015260c0918201511690830152928a01926001929092019160e090910190610a7c565b50968901969450505090860190600101610a2a565b50909c9b50505050505050505050505056fea26469706673582212200ce553bd906a6acfb51f721c67147d428b61e4bb20e8c11fdbe007a2536e8b7364736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000d25194abe95185db8e4b0294f5669e21c534785
-----Decoded View---------------
Arg [0] : _splitsStore (address): 0x0D25194ABE95185Db8e4B0294F5669E21C534785
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000d25194abe95185db8e4b0294f5669e21c534785
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
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.