Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
JBReconfigurationBufferBallot
Compiler Version
v0.8.6+commit.11564f7e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; import './interfaces/IJBReconfigurationBufferBallot.sol'; import './structs/JBFundingCycle.sol'; /** @notice Manages approving funding cycle reconfigurations automatically after a buffer period. @dev Adheres to - IJBReconfigurationBufferBallot: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules. @dev Inherits from - ERC165: Introspection on interface adherance. */ contract JBReconfigurationBufferBallot is IJBReconfigurationBufferBallot, ERC165 { //*********************************************************************// // ---------------- public immutable stored properties --------------- // //*********************************************************************// /** @notice The number of seconds that must pass for a funding cycle reconfiguration to become either `Approved` or `Failed`. */ uint256 public immutable override duration; /** @notice The contract storing all funding cycle configurations. */ IJBFundingCycleStore public immutable override fundingCycleStore; //*********************************************************************// // --------------------- public stored properties -------------------- // //*********************************************************************// /** @notice The finalized state. @dev If `Active`, the ballot for the provided configuration can still be finalized whenever its state settles. _projectId The ID of the project to check the final ballot state of. _configuration The configuration of the funding cycle to check the final ballot state of. */ mapping(uint256 => mapping(uint256 => JBBallotState)) public override finalState; //*********************************************************************// // -------------------------- public views --------------------------- // //*********************************************************************// /** @notice The approval state of a particular funding cycle. @param _projectId The ID of the project to which the funding cycle being checked belongs. @param _configured The configuration of the funding cycle to check the state of. @param _start The start timestamp of the funding cycle to check the state of. @return The state of the provided ballot. */ function stateOf( uint256 _projectId, uint256 _configured, uint256 _start ) public view override returns (JBBallotState) { // If there is a finalized state, return it. if (finalState[_projectId][_configured] != JBBallotState.Active) return finalState[_projectId][_configured]; // If the delay hasn't yet passed, the ballot is either failed or active. if (block.timestamp < _configured + duration) // If the current timestamp is past the start, the ballot is failed. return (block.timestamp >= _start) ? JBBallotState.Failed : JBBallotState.Active; // The ballot is otherwise approved. return JBBallotState.Approved; } /** @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(ERC165, IERC165) returns (bool) { return _interfaceId == type(IJBReconfigurationBufferBallot).interfaceId || _interfaceId == type(IJBFundingCycleBallot).interfaceId || super.supportsInterface(_interfaceId); } //*********************************************************************// // -------------------------- constructor ---------------------------- // //*********************************************************************// /** @param _duration The number of seconds to wait until a reconfiguration can be either `Approved` or `Failed`. @param _fundingCycleStore A contract storing all funding cycle configurations. */ constructor(uint256 _duration, IJBFundingCycleStore _fundingCycleStore) { duration = _duration; fundingCycleStore = _fundingCycleStore; } //*********************************************************************// // ---------------------- external transactions ---------------------- // //*********************************************************************// /** @notice Finalizes a configuration state if the current state has settled. @param _projectId The ID of the project to which the funding cycle being checked belongs. @param _configured The configuration of the funding cycle to check the state of. @return ballotState The state of the finalized ballot. If `Active`, the ballot can still later be finalized when it's state resolves. */ function finalize(uint256 _projectId, uint256 _configured) external override returns (JBBallotState ballotState) { // Get the funding cycle for the configuration in question. JBFundingCycle memory _fundingCycle = fundingCycleStore.get(_projectId, _configured); // Get the current ballot state. ballotState = finalState[_projectId][_configured]; // If the final ballot state is still `Active`. if (ballotState == JBBallotState.Active) { ballotState = stateOf(_projectId, _configured, _fundingCycle.start); // If the ballot is active after the cycle has started, it should be finalized as failed. if (ballotState != JBBallotState.Active) { // Store the updated value. finalState[_projectId][_configured] = ballotState; emit Finalize(_projectId, _configured, ballotState, msg.sender); } } } }
// 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: MIT pragma solidity 0.8.6; enum JBBallotState { Active, Approved, Failed }
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import '@openzeppelin/contracts/utils/introspection/IERC165.sol'; import './../enums/JBBallotState.sol'; import './IJBFundingCycleStore.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.6; 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.6; import './IJBFundingCycleBallot.sol'; interface IJBReconfigurationBufferBallot is IJBFundingCycleBallot { event Finalize( uint256 indexed projectId, uint256 indexed configuration, JBBallotState indexed ballotState, address caller ); function finalState(uint256 _projectId, uint256 _configuration) external view returns (JBBallotState); function fundingCycleStore() external view returns (IJBFundingCycleStore); function finalize(uint256 _projectId, uint256 _configured) external returns (JBBallotState); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; 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.6; 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; }
{ "evmVersion": "berlin", "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":"uint256","name":"_duration","type":"uint256"},{"internalType":"contract IJBFundingCycleStore","name":"_fundingCycleStore","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"configuration","type":"uint256"},{"indexed":true,"internalType":"enum JBBallotState","name":"ballotState","type":"uint8"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"Finalize","type":"event"},{"inputs":[],"name":"duration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"finalState","outputs":[{"internalType":"enum JBBallotState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"uint256","name":"_configured","type":"uint256"}],"name":"finalize","outputs":[{"internalType":"enum JBBallotState","name":"ballotState","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fundingCycleStore","outputs":[{"internalType":"contract IJBFundingCycleStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"uint256","name":"_configured","type":"uint256"},{"internalType":"uint256","name":"_start","type":"uint256"}],"name":"stateOf","outputs":[{"internalType":"enum JBBallotState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c060405234801561001057600080fd5b5060405161080c38038061080c83398101604081905261002f9161004a565b60809190915260601b6001600160601b03191660a052610087565b6000806040838503121561005d57600080fd5b825160208401519092506001600160a01b038116811461007c57600080fd5b809150509250929050565b60805160a05160601c6107516100bb6000396000818160d9015261035d01526000818160a401526102bd01526107516000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c806374167907116100505780637416790714610120578063a994c09f14610140578063b6013cef1461016b57600080fd5b806301ffc9a7146100775780630fb5a6b41461009f578063557e7155146100d4575b600080fd5b61008a61008536600461050b565b61017e565b60405190151581526020015b60405180910390f35b6100c67f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610096565b6100fb7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610096565b61013361012e3660046105ef565b610263565b604051610096919061061b565b61013361014e3660046105cd565b600060208181529281526040808220909352908152205460ff1681565b6101336101793660046105cd565b61030d565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4aeb8d2500000000000000000000000000000000000000000000000000000000148061021157507fffffffff0000000000000000000000000000000000000000000000000000000082167f7ba3dfb300000000000000000000000000000000000000000000000000000000145b8061025d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60008060008581526020818152604080832087845290915290205460ff166002811115610292576102926106ec565b146102b8575060008381526020818152604080832085845290915290205460ff16610306565b6102e27f0000000000000000000000000000000000000000000000000000000000000000846106ad565b42101561030257814210156102f85760006102fb565b60025b9050610306565b5060015b9392505050565b6040517f669e48aa0000000000000000000000000000000000000000000000000000000081526004810183905260248101829052600090819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063669e48aa906044016101206040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d8919061054d565b60008581526020818152604080832087845290915281205460ff16935090915082600281111561040a5761040a6106ec565b14156104db5761041f84848360600151610263565b91506000826002811115610435576104356106ec565b146104db57600084815260208181526040808320868452909152902080548391907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600281111561048c5761048c6106ec565b02179055508160028111156104a3576104a36106ec565b604051338152849086907f7e3b0e79d754a8d4c902d51b0deb131c43d7a702f465413e38db25cf786b0b349060200160405180910390a45b5092915050565b805173ffffffffffffffffffffffffffffffffffffffff8116811461050657600080fd5b919050565b60006020828403121561051d57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461030657600080fd5b6000610120828403121561056057600080fd5b61056861065c565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c08201526105b460e084016104e2565b60e0820152610100928301519281019290925250919050565b600080604083850312156105e057600080fd5b50508035926020909101359150565b60008060006060848603121561060457600080fd5b505081359360208301359350604090920135919050565b6020810160038310610656577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b604051610120810167ffffffffffffffff811182821017156106a7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b600082198211156106e7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220b4c451762a49327da15d0f73731945f302ac28b4c7176ec1fd7268bced594b7b64736f6c63430008060033000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000006b8e01daa8a61b544f96d2738893e05d04bf1d12
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100725760003560e01c806374167907116100505780637416790714610120578063a994c09f14610140578063b6013cef1461016b57600080fd5b806301ffc9a7146100775780630fb5a6b41461009f578063557e7155146100d4575b600080fd5b61008a61008536600461050b565b61017e565b60405190151581526020015b60405180910390f35b6100c67f000000000000000000000000000000000000000000000000000000000003f48081565b604051908152602001610096565b6100fb7f0000000000000000000000006b8e01daa8a61b544f96d2738893e05d04bf1d1281565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610096565b61013361012e3660046105ef565b610263565b604051610096919061061b565b61013361014e3660046105cd565b600060208181529281526040808220909352908152205460ff1681565b6101336101793660046105cd565b61030d565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4aeb8d2500000000000000000000000000000000000000000000000000000000148061021157507fffffffff0000000000000000000000000000000000000000000000000000000082167f7ba3dfb300000000000000000000000000000000000000000000000000000000145b8061025d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60008060008581526020818152604080832087845290915290205460ff166002811115610292576102926106ec565b146102b8575060008381526020818152604080832085845290915290205460ff16610306565b6102e27f000000000000000000000000000000000000000000000000000000000003f480846106ad565b42101561030257814210156102f85760006102fb565b60025b9050610306565b5060015b9392505050565b6040517f669e48aa0000000000000000000000000000000000000000000000000000000081526004810183905260248101829052600090819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000006b8e01daa8a61b544f96d2738893e05d04bf1d12169063669e48aa906044016101206040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d8919061054d565b60008581526020818152604080832087845290915281205460ff16935090915082600281111561040a5761040a6106ec565b14156104db5761041f84848360600151610263565b91506000826002811115610435576104356106ec565b146104db57600084815260208181526040808320868452909152902080548391907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600281111561048c5761048c6106ec565b02179055508160028111156104a3576104a36106ec565b604051338152849086907f7e3b0e79d754a8d4c902d51b0deb131c43d7a702f465413e38db25cf786b0b349060200160405180910390a45b5092915050565b805173ffffffffffffffffffffffffffffffffffffffff8116811461050657600080fd5b919050565b60006020828403121561051d57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461030657600080fd5b6000610120828403121561056057600080fd5b61056861065c565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c08201526105b460e084016104e2565b60e0820152610100928301519281019290925250919050565b600080604083850312156105e057600080fd5b50508035926020909101359150565b60008060006060848603121561060457600080fd5b505081359360208301359350604090920135919050565b6020810160038310610656577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b604051610120810167ffffffffffffffff811182821017156106a7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b600082198211156106e7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220b4c451762a49327da15d0f73731945f302ac28b4c7176ec1fd7268bced594b7b64736f6c63430008060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000006b8e01daa8a61b544f96d2738893e05d04bf1d12
-----Decoded View---------------
Arg [0] : _duration (uint256): 259200
Arg [1] : _fundingCycleStore (address): 0x6B8e01DAA8A61b544F96d2738893E05D04BF1D12
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [1] : 0000000000000000000000006b8e01daa8a61b544f96d2738893e05d04bf1d12
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.