Проверенный контрактЧастичноеMIT
VetoCouncil
Адрес0xa3a32d3c9a5a593bc35d69bacbe2df5ea2c3cf5c
- Баланс
0 ETH
- Транзакций
4
- Компилятор
solc 0.8.21
- Тот же код
Только этот контракт
Подробности
- Компилятор
- solc 0.8.21+commit.d9974bed
- Язык
- solidity
- Оптимизация
- Да, 1 000 000 прогонов
- Версия EVM
- paris
- Лицензия
- MIT
- Совпадение
- Частичноекод создания: да, код в сети: да
- Проверен на Sourcify
- Создан в блоке
- 18 809 233
- Транзакция создания
- 0xbb0e61fd5b…bd61881201
- Библиотеки
- src/libraries/HalfLife.sol:HalfLife0xcf4d…60b199src/libraries/HalfLifeCarbonCreditAuction.sol:HalfLifeCarbonCreditAuction0xd178…d446de
9 файлов
- src/VetoCouncil/VetoCouncil.solглавный8,22 КБ
- lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2,78 КБ
- lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol2,26 КБ
- lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol6,43 КБ
- lib/openzeppelin-contracts/contracts/utils/Address.sol6,26 КБ
- src/VetoCouncil/VetoCouncilSalaryHelper.sol18,1 КБ
- src/interfaces/IGlow.sol7,99 КБ
- src/interfaces/IVetoCouncil.sol3,58 КБ
- src/libraries/VestingMathLib.sol3,32 КБ
src/VetoCouncil/VetoCouncil.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {IVetoCouncil} from "@/interfaces/IVetoCouncil.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IGlow} from "@/interfaces/IGlow.sol";
import {VetoCouncilSalaryHelper} from "@/VetoCouncil/VetoCouncilSalaryHelper.sol";
/**
* @title VetoCouncil
* @notice A contract for managing the Glow veto council
* @dev This contract is used to manage the Glow veto council. The council is made up of maximum 7 members
* - council members can be added and removed by the governance contract
* - council member payouts are vested over 100 weeks
* - council members can veto proposals inside {Governance}
*/
contract VetoCouncil is IVetoCouncil, VetoCouncilSalaryHelper {
/* -------------------------------------------------------------------------- */
/* constants */
/* -------------------------------------------------------------------------- */
/// @notice the veto council is awared 5_000 GLOW per week
uint256 public constant REWARDS_PER_SECOND_FOR_ALL = 5_000 ether / uint256(7 days);
/// @dev 1% of the rewards vest per week
uint256 public constant VESTING_REWARDS_PER_SECOND_FOR_ALL = REWARDS_PER_SECOND_FOR_ALL / (100 * 86400 * 7);
/// @notice the maximum number of council members
uint256 public constant MAX_COUNCIL_MEMBERS = 7;
/* -------------------------------------------------------------------------- */
/* immutables */
/* -------------------------------------------------------------------------- */
/// @notice the address of the governance contract
address public immutable GOVERNANCE;
/// @notice the address of the GLOW token
IERC20 public immutable GLOW_TOKEN;
/// @notice the genesis timestamp of the glow protocol
uint256 public immutable GENESIS_TIMESTAMP;
/* -------------------------------------------------------------------------- */
/* state vars */
/* -------------------------------------------------------------------------- */
/**
* @notice the number of council members
* @dev this is equivalent to `vetoCouncilMembers`.length
* @dev we use this variable to avoid having to call `vetoCouncilMembers.length` in the `addAndRemoveCouncilMember` function
* - it reduces gas by not having to iterate over the _vetoCouncilMembers array in VetoCouncilSalaryHelper
* - To find the true number of council members
*/
uint256 public numberOfCouncilMembers;
/* -------------------------------------------------------------------------- */
/* constructor */
/* -------------------------------------------------------------------------- */
/**
* @param governance the address of the governance contract
* @param _glowToken the address of the GLOW token
* @param _startingMembers the addresses of the starting council members
* @dev starting with zero members will cause a divide by zero error
* - It's expected that _startingMembers will never be empty
*/
constructor(address governance, address _glowToken, address[] memory _startingMembers) payable {
if (_isZeroAddress(governance)) {
_revert(IVetoCouncil.ZeroAddressInConstructor.selector);
}
if (_isZeroAddress(_glowToken)) {
_revert(IVetoCouncil.ZeroAddressInConstructor.selector);
}
numberOfCouncilMembers = _startingMembers.length;
//Impossible to have more than 7 council members
//No risk of large array allocation
if (_startingMembers.length > MAX_COUNCIL_MEMBERS) {
_revert(IVetoCouncil.MaxCouncilMembersExceeded.selector);
}
//Set governance
GOVERNANCE = governance;
//Set GLOW token
GLOW_TOKEN = IERC20(_glowToken);
//Pull the Genesis timestamp from the GLOW token
GENESIS_TIMESTAMP = IGlow(_glowToken).GENESIS_TIMESTAMP();
initializeMembers(_startingMembers, GENESIS_TIMESTAMP);
}
/* -------------------------------------------------------------------------- */
/* adding/removing members */
/* -------------------------------------------------------------------------- */
/// @inheritdoc IVetoCouncil
function addAndRemoveCouncilMember(address oldMember, address newMember, bool slashOldMember)
external
override
returns (bool)
{
if (msg.sender != GOVERNANCE) {
_revert(IVetoCouncil.CallerNotGovernance.selector);
}
uint256 _numCouncilMembers = numberOfCouncilMembers;
//Should already be filtered by the governance contract.
if (oldMember == newMember) {
return false;
}
bool isoldMemberZeroAddress = _isZeroAddress(oldMember);
bool isnewMemberZeroAddress = _isZeroAddress(newMember);
//if old member is the zero address, we arent removing an member
//however, it it's not, then we are removing an member
uint256 numMembersRemoving = isoldMemberZeroAddress ? 0 : 1;
//if new member is the zero address, we arent adding an member
//however, if it's not, then we are adding an member
uint256 numMembersAdding = isnewMemberZeroAddress ? 0 : 1;
if (_numCouncilMembers == 0) {
//If we don't check this, there can be an underflow
//and the entire system can freeze;
//We should not be able to remove an member if there are no members
if (numMembersRemoving > 0) {
return false;
}
}
_numCouncilMembers = _numCouncilMembers - numMembersRemoving + numMembersAdding;
if (_numCouncilMembers > MAX_COUNCIL_MEMBERS) {
return false;
}
if (!replaceMember(oldMember, newMember, slashOldMember)) {
return false;
}
numberOfCouncilMembers = _numCouncilMembers;
emit IVetoCouncil.VetoCouncilSeatsEdited(oldMember, newMember, slashOldMember);
return true;
}
/* -------------------------------------------------------------------------- */
/* claiming payouts */
/* -------------------------------------------------------------------------- */
/// @inheritdoc IVetoCouncil
function claimPayout(address member, uint256 nonce, bool sync, address[] memory members) public {
if (sync) {
pullGlowFromInflation();
}
VetoCouncilSalaryHelper.claimPayout(member, nonce, GLOW_TOKEN, members);
}
/* -------------------------------------------------------------------------- */
/* view functions */
/* -------------------------------------------------------------------------- */
/// @inheritdoc IVetoCouncil
function isCouncilMember(address member) public view override returns (bool) {
return VetoCouncilSalaryHelper._isCouncilMember(member);
}
/// @notice pulls glow from inflation for the veto council contract
function pullGlowFromInflation() public {
IGlow(address(GLOW_TOKEN)).claimGLWFromVetoCouncil();
}
/* -------------------------------------------------------------------------- */
/* private utils */
/* -------------------------------------------------------------------------- */
/**
* @dev efficiently determines if an address is the zero address
* @param a the address to check
* @return isZero if the address is the zero address
*/
function _isZeroAddress(address a) private pure returns (bool isZero) {
// solhint-disable-next-line no-inline-assembly
assembly {
isZero := iszero(a)
}
}
}
lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
if (nonceAfter != nonceBefore + 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}
lib/openzeppelin-contracts/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}
src/VetoCouncil/VetoCouncilSalaryHelper.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;
import {VestingMathLib} from "@/libraries/VestingMathLib.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IVetoCouncil} from "@/interfaces/IVetoCouncil.sol";
/// @dev we use a > 0 value as the null address
// - to avoid deleting a slot and having to reinitialize it with a cold sstore
address constant NULL_ADDRESS = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;
/// @dev since there are no more than 7 veto council members
/// - we use uint8.max as the null index
uint8 constant NULL_INDEX = type(uint8).max;
/**
* @param isActive - whether or not the member is active
* @param isSlashed - whether or not the member is slashed
* @param indexInArray - the index inside the veto council members array
*/
struct Status {
bool isActive;
bool isSlashed;
uint8 indexInArray;
}
/**
* @title VetoCouncilSalaryHelper
* @notice A library to help with the salary of the Veto Council
* - handles the salary and payout of the Veto Council
* @author DavidVorick
* @author 0xSimon(twitter) - 0xSimbo(github)
* @dev a nonce is a unique identifier for a shift and is incremented every time the salary rate changes
* - if an member is removed before the rate has changed, they will earn until their `shiftEndTimestamp`
* @dev payouts vest linearly at 1% per week.
*/
contract VetoCouncilSalaryHelper {
error HashesNotUpdated();
error CannotSetNonceToZero();
error MaxSevenVetoCouncilMembers();
error MemberNotFound();
error ShiftHasNotStarted();
error HashMismatch();
/**
* @dev The amount of GLOW that is awarded per second
* - for the entire veto council
*/
uint256 private constant REWARDS_PER_SECOND = 5000 ether / uint256(7 days);
/**
* @notice The nonce at which the current shift started
* @dev initialized as 1 to avoid cold sstore for the first payment nonce
*/
uint256 public paymentNonce = 1;
/**
* @dev (member -> Status)
*/
mapping(address => Status) private _status;
/**
* @notice an array containing all the veto council members
* @dev the null address is represented as 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF
*/
address[7] private _vetoCouncilMembers;
/**
* @notice paymentNonce -> keccak256(abi.encodePacked(vetoCouncilMembers))
* @dev used in withdrawing rewards
*/
mapping(uint256 => bytes32) public paymentNonceTomembersHash;
/**
* @dev payment nonce -> shift start timestamp
*/
mapping(uint256 => uint256) private _paymentNonceToShiftStartTimestamp;
/**
* @notice The amount of tokens that have been withdrawn from a given payment nonce for a given member
* @dev member -> payment nonce -> amount withdrawn
*/
mapping(address => mapping(uint256 => uint256)) public amountAlreadyWithdrawnFromPaymentNonce;
/**
* @dev emitted when a member claims a payout
* @param member - the address of the member that claimed the payout
* @param nonce - the nonce of the payout
* @param amount - the amount of tokens that were claimed
*/
event PayoutClaimed(address indexed member, uint256 indexed nonce, uint256 amount);
/**
* ----------------------------------------------
*/
/**
* ---------- EXTERNAL VIEW --------------
*/
/**
* ----------------------------------------------
*/
/**
* @notice Returns the (withdrawableAmount, slashableAmount) for an member for a given nonce
* @param member - the address of the members
* @param nonce - the nonce of the payout
* @return (withdrawableAmount, slashableAmount) - the amount of tokens that can be withdrawn and the amount that are still vesting
*/
function payoutData(address member, uint256 nonce, address[] memory members)
external
view
returns (uint256, uint256)
{
return _payoutData(member, nonce, members);
}
/**
* @notice returns the `Status` struct for a given member
* @param member The address of the member to get the `Status` struct for
* @return status - the `Status` struct for the given member
*/
function memberStatus(address member) public view returns (Status memory) {
return _status[member];
}
/**
* @notice returns the `shiftStartTimestamp` for a given nonce
* @param nonce The nonce to get the `shiftStartTimestamp` for
* @return shiftStartTimestamp - the `shiftStartTimestamp` for the given nonce
*/
function paymentNonceToShiftStartTimestamp(uint256 nonce) public view returns (uint256) {
return _paymentNonceToShiftStartTimestamp[nonce];
}
/**
* @notice returns the array of veto council members without null addresses
* @return sanitizedArray - all currently active veto council members
*/
function vetoCouncilMembers() external view returns (address[] memory) {
return arrayWithoutNulls(_vetoCouncilMembers);
}
/**
* ----------------------------------------------
*/
/**
* ------- INTERNAL STATE CHANGING ---------
*/
/**
* ----------------------------------------------
*/
/**
* @dev Initializes the Veto Council
* @dev should only be used in the constructor
* @param members The addresses of the starting council members
* @param genesisTimestamp The timestamp of the genesis block
*/
function initializeMembers(address[] memory members, uint256 genesisTimestamp) internal {
address[7] memory initmembers;
if (members.length > type(uint8).max) {
_revert(MaxSevenVetoCouncilMembers.selector);
}
uint8 len = uint8(members.length);
unchecked {
for (uint8 i; i < len; ++i) {
if (isZero(members[i])) {
_revert(IVetoCouncil.ZeroAddressInConstructor.selector);
}
initmembers[i] = members[i];
_status[members[i]] = Status({isActive: true, isSlashed: false, indexInArray: i});
}
for (uint8 i = len; i < 7; ++i) {
initmembers[i] = NULL_ADDRESS;
}
}
_vetoCouncilMembers = initmembers;
paymentNonceTomembersHash[1] = keccak256(abi.encodePacked(members));
_paymentNonceToShiftStartTimestamp[1] = genesisTimestamp;
}
/**
* @dev Add or remove a council member
* @param oldMember The address of the member to be slashed or removed
* @param newMember The address of the new member (0 = no new member)
* @param slashOldMember Whether to slash the member or not
* @return - true if a council member was added or removed, false if nothing was done
*/
function replaceMember(address oldMember, address newMember, bool slashOldMember) internal returns (bool) {
//Cache the old member index
uint8 memberOldIndex;
bool isoldMemberZeroAddress = isZero(oldMember);
bool isnewMemberZeroAddress = isZero(newMember);
//If the old member is the zero address,
//We need to loop until we find the first position in the array
//Until we find a null address as that's where
//we'll write the new member to
//We start from the back of the array as that's where the null address will most likely be
if (isoldMemberZeroAddress) {
for (uint256 i; i < 7;) {
uint256 index = 6 - i;
address _vetomember = _vetoCouncilMembers[index];
if (_vetomember == NULL_ADDRESS) {
memberOldIndex = uint8(index);
break;
}
unchecked {
++i;
}
}
} else {
//load in the old member status
Status memory oldMemberStatus = _status[oldMember];
//Old member cannot be inactive if they're not the zero address
if (!oldMemberStatus.isActive) {
return false;
}
//find old member index to insert the new member
memberOldIndex = oldMemberStatus.indexInArray;
}
//if the new member is not the zero address
if (!isnewMemberZeroAddress) {
Status memory newmemberStatus = _status[newMember];
//A slashed member can never become an member again
if (newmemberStatus.isSlashed) {
return false;
}
//A new member cannot already be active
if (newmemberStatus.isActive) {
return false;
}
//Update the new member status
_status[newMember] = Status({isActive: true, isSlashed: false, indexInArray: memberOldIndex});
}
if (!isoldMemberZeroAddress) {
//Set the old member to inactive as it's not the zero address
//State changes need to happen after all conditions clear,
//So we put this change after checking the new member conditions
_status[oldMember] = Status({isActive: false, isSlashed: slashOldMember, indexInArray: NULL_INDEX});
}
_vetoCouncilMembers[memberOldIndex] = isnewMemberZeroAddress ? NULL_ADDRESS : newMember;
//cache the payment nonce
uint256 paymentNonceToWriteTo = paymentNonce;
//Increment the cached payment nonce
++paymentNonceToWriteTo;
//Set the hash for the new payment nonce
paymentNonceTomembersHash[paymentNonceToWriteTo] =
keccak256(abi.encodePacked(arrayWithoutNulls(_vetoCouncilMembers)));
//Set the shift start timestamp for the new payment nonce
_paymentNonceToShiftStartTimestamp[paymentNonceToWriteTo] = block.timestamp;
//Set the new payment nonce
paymentNonce = paymentNonceToWriteTo;
return true;
}
/**
* @dev Used to payout the council member for their work at a given nonce
* @param member The address of the council member
* @param payoutNonce The payout nonce to claim from
* @param token The token to pay out (GLOW)
* @param members The addresses of the council members that were active at `nonce`
* - This is used to verify that the member was active at the nonce
* - By comparing the hash of the members at the nonce to the hash stored in the contract
*/
function claimPayout(address member, uint256 payoutNonce, IERC20 token, address[] memory members) internal {
uint256 withdrawableAmount = nextPayoutAmount(member, payoutNonce, members);
amountAlreadyWithdrawnFromPaymentNonce[member][payoutNonce] += withdrawableAmount;
SafeERC20.safeTransfer(token, member, withdrawableAmount);
emit PayoutClaimed(member, payoutNonce, withdrawableAmount);
}
/**
* ----------------------------------------------
*/
/**
* ------- INTERNAL VIEW ---------
*/
/**
* ----------------------------------------------
*/
/**
* @dev a helper function to get (rewardPerSecond, secondsActive, secondsStopped, amountAlreadyWithdrawn)
* @param member The address of the member to get the data for
* @param nonce The nonce to get the data for
* @param members The addresses of the council members that were active at `nonce`
* - This is used to verify that the member was active at the nonce
* - By comparing the hash of the members at the nonce to the hash stored in the contract
*/
function getDataToCalculatePayout(address member, uint256 nonce, address[] memory members)
internal
view
returns (uint256 rewardPerSecond, uint256 secondsActive, uint256 secondsStopped, uint256 amountAlreadyWithdrawn)
{
//Hash the members array and check if it matches the hash stored in the contract
if (keccak256(abi.encodePacked(members)) != paymentNonceTomembersHash[nonce]) {
_revert(HashMismatch.selector);
}
//Check if the member was active at the nonce
{
bool found;
unchecked {
for (uint256 i; i < members.length; ++i) {
if (members[i] == member) {
found = true;
break;
}
}
}
if (!found) {
_revert(MemberNotFound.selector);
}
}
//Should not get a divison by zero error as {found} should be true if there is at least one member
uint256 rewardPerSecond = REWARDS_PER_SECOND / members.length;
uint256 shiftStartTimestamp = _paymentNonceToShiftStartTimestamp[nonce];
//We dont need to check the shift start timestamp
//Since the hash for an uninitialized nonce will always be zero
//and there will be no data
uint256 shiftEndTimestamp = _paymentNonceToShiftStartTimestamp[nonce + 1];
//This means the shift has ended
if (shiftEndTimestamp != 0) {
secondsStopped = block.timestamp - shiftEndTimestamp;
secondsActive = shiftEndTimestamp - shiftStartTimestamp;
} else {
secondsActive = block.timestamp - shiftStartTimestamp;
}
amountAlreadyWithdrawn = amountAlreadyWithdrawnFromPaymentNonce[member][nonce];
return (rewardPerSecond, secondsActive, secondsStopped, amountAlreadyWithdrawn);
}
/**
* @dev a helper function to get (rewardPerSecond, secondsActive, secondsStopped, amountAlreadyWithdrawn)
* @param member The address of the member to get the data for
* @param nonce The nonce to get the data for
* @param members The addresses of the council members that were active at `nonce`
* - This is used to verify that the member was active at the nonce
* - By comparing the hash of the members at the nonce to the hash stored in the contract
*/
function _payoutData(address member, uint256 nonce, address[] memory members)
private
view
returns (uint256, uint256)
{
if (_status[member].isSlashed) {
return (0, 0);
}
(uint256 rewardPerSecond, uint256 secondsActive, uint256 secondsStopped, uint256 amountAlreadyWithdrawn) =
getDataToCalculatePayout(member, nonce, members);
(uint256 withdrawableAmount, uint256 slashableAmount) = VestingMathLib
.calculateWithdrawableAmountAndSlashableAmount(
rewardPerSecond, secondsActive, secondsStopped, amountAlreadyWithdrawn
);
return (withdrawableAmount, slashableAmount);
}
/**
* @dev returns the amount of tokens that can be withdrawn by an member for a given nonce
* @param member The address of the member to get the withdrawable amount for
* @param nonce The nonce to get the withdrawable amount for
* @param members The addresses of the council members that were active at `nonce`
* - This is used to verify that the member was active at the nonce
* - By comparing the hash of the members at the nonce to the hash stored in the contract
* @return withdrawableAmount - the amount of tokens that can be withdrawn by the member
*/
function nextPayoutAmount(address member, uint256 nonce, address[] memory members)
internal
view
returns (uint256)
{
(uint256 withdrawableAmount,) = _payoutData(member, nonce, members);
return withdrawableAmount;
}
/**
* @param member The address of the member to be checked
*/
function _isCouncilMember(address member) internal view returns (bool) {
return _status[member].isActive;
}
/**
* @dev efficiently determines if an address is the zero address
* @param a the address to check
* @return res - true if the address is the zero address
*/
function isZero(address a) private pure returns (bool res) {
// solhint-disable-next-line no-inline-assembly
assembly ("memory-safe") {
res := iszero(a)
}
}
/**
* @dev removes all null addresses from an array
* @param arr the array to sanitize
* @dev used to sanitize _vetoCouncilMembers before encoding and hashing
* @return sanitizedArray - the sanitized array without any null addresses
*/
function arrayWithoutNulls(address[7] memory arr) internal pure returns (address[] memory) {
address[] memory sanitizedArray = new address[](arr.length);
uint256 numNotNulls;
unchecked {
for (uint256 i; i < arr.length; ++i) {
if (!isNull(arr[i])) {
sanitizedArray[numNotNulls] = arr[i];
++numNotNulls;
}
}
}
// solhint-disable-next-line no-inline-assembly
assembly ("memory-safe") {
mstore(sanitizedArray, numNotNulls)
}
return sanitizedArray;
}
/**
* @dev efficiently determines if an address is null address
* @param a the address to check
* @return res - true if the address is the null address, false otherwise
*/
function isNull(address a) internal pure returns (bool res) {
address _null = NULL_ADDRESS;
// solhint-disable-next-line no-inline-assembly
assembly ("memory-safe") {
res := eq(a, _null)
}
}
/**
* @notice Efficiently reverts with a bytes4 selector
* @param selector The selector to revert with
*/
function _revert(bytes4 selector) internal pure {
// solhint-disable-next-line no-inline-assembly
assembly ("memory-safe") {
mstore(0x0, selector)
revert(0x0, 0x04)
}
}
}
src/interfaces/IGlow.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IGlow is IERC20 {
/* -------------------------------------------------------------------------- */
/* errors */
/* -------------------------------------------------------------------------- */
error UnstakeAmountExceedsStakedBalance();
error InsufficientClaimableBalance();
error CannotStakeZeroTokens();
error CannotUnstakeZeroTokens();
error AddressAlreadySet();
error AddressNotSet();
error CallerNotGCA();
error CallerNotVetoCouncil();
error CallerNotGrantsTreasury();
error UnstakingOnEmergencyCooldown();
error ZeroAddressNotAllowed();
error DuplicateAddressNotAllowed();
error CannotClaimZeroTokens();
/* -------------------------------------------------------------------------- */
/* events */
/* -------------------------------------------------------------------------- */
/**
* @notice Emitted when a user stakes GLOW
* @param user The address of the user that is staking
* @param amount The amount staked
*/
event Stake(address indexed user, uint256 amount);
/**
* @notice Emitted when a user unstakes GLOW
* @param user The address of the user that is unstaking
* @param amount The amount unstaked
*/
event Unstake(address indexed user, uint256 amount);
/**
* @notice Emitted when a user claims GLOW from there unstaked positions
* @param user The address of the user that is claiming
* @param amount The amount claimed
*/
event ClaimUnstakedGLW(address indexed user, uint256 amount);
/* -------------------------------------------------------------------------- */
/* structs */
/* -------------------------------------------------------------------------- */
/**
* @notice represents an unstaked position
* @param amount The amount of GLOW unstaked
* @param cooldownEnd The timestamp when the user can reclaim the tokens
*/
struct UnstakedPosition {
uint192 amount;
uint64 cooldownEnd;
}
/**
* @dev helper for managing tail and head in a mapping
* @param tail the tail of the mapping
* @param head the head of the mapping
* @dev the head is the last index with data. If we need to push, we push at head + 1
* @dev there are edge cases where head == tail and there is data,
* - and conversely, head == tail and there is no data
* - These special cases are handled in the code
*/
struct Pointers {
uint128 tail;
uint128 head;
}
/* -------------------------------------------------------------------------- */
/* staking */
/* -------------------------------------------------------------------------- */
/**
* @notice The entry point for a user to stake glow.
* @notice A user earns 1 ratify/reject vote per glw staked
* @param amount The amount of GLOW to stake
*/
function stake(uint256 amount) external;
/**
* @notice The entry point for a user to unstake glow.
* @param amount The amount of GLOW to unstake
*/
function unstake(uint256 amount) external;
/* -------------------------------------------------------------------------- */
/* inflation */
/* -------------------------------------------------------------------------- */
/**
* @notice Entry point for users to claim unstaked tokens that are no longer on cooldown
* @param amount The amount of tokens to claim
* @dev emits a ```ClaimUnstakedGLW``` event
*/
function claimUnstakedTokens(uint256 amount) external;
/**
* @notice Allows the GCA and Miner Pool Contract to claim GLW from inflation
* @notice The GCA and Miner Pool Contract receives 185,00 * 1e18 tokens per week
*/
function claimGLWFromGCAAndMinerPool() external returns (uint256);
/**
* @notice Allows the Veto Council to claim GLW from inflation
* @notice The veto council receives 5,000 * 1e18 tokens per week
*/
function claimGLWFromVetoCouncil() external returns (uint256);
/**
* @notice Allows the Grants Treasury to claim GLW from inflation
* @notice The grants treasury receives 40,000 * 1e18 tokens per week
*/
function claimGLWFromGrantsTreasury() external returns (uint256);
/* -------------------------------------------------------------------------- */
/* view unstaked positions */
/* -------------------------------------------------------------------------- */
/**
* @notice Returns the unstaked positions of a user
* @param account The address of the user
*/
function unstakedPositionsOf(address account) external view returns (UnstakedPosition[] memory);
/**
* @notice Returns the unstaked positions of a user
* @param account The address of the user
* @param start The start index of the positions to return
* @param end The end index of the positions to return
*/
function unstakedPositionsOf(address account, uint256 start, uint256 end)
external
view
returns (UnstakedPosition[] memory);
/* -------------------------------------------------------------------------- */
/* view inflation data */
/* -------------------------------------------------------------------------- */
/**
* @return lastClaimTimestamp The last time the GCA and Miner Pool Contract claimed GLW
* @return totalAlreadyClaimed The total amount of GLW already claimed by the GCA and Miner Pool Contract
* @return totalToClaim The total amount of GLW available to claim by the GCA and Miner Pool Contract
*/
function gcaInflationData()
external
view
returns (uint256 lastClaimTimestamp, uint256 totalAlreadyClaimed, uint256 totalToClaim);
/**
* @return lastClaimTimestamp The last time the Veto Council claimed GLW
* @return totalAlreadyClaimed The total amount of GLW already claimed by the Veto Council
* @return totalToClaim The total amount of GLW available to claim by the Veto Council
*/
function vetoCouncilInflationData()
external
view
returns (uint256 lastClaimTimestamp, uint256 totalAlreadyClaimed, uint256 totalToClaim);
/**
* @return lastClaimTimestamp The last time the Grants Treasury claimed GLW
* @return totalAlreadyClaimed The total amount of GLW already claimed by the Grants Treasury
* @return totalToClaim The total amount of GLW available to claim by the Grants Treasury
*/
function grantsTreasuryInflationData()
external
view
returns (uint256 lastClaimTimestamp, uint256 totalAlreadyClaimed, uint256 totalToClaim);
/* -------------------------------------------------------------------------- */
/* view */
/* -------------------------------------------------------------------------- */
/**
* @return the genesis timestamp
*/
function GENESIS_TIMESTAMP() external view returns (uint256);
/**
* @notice the total amount of GLW currently staked by {account}
* @return numStaked total amount of GLW currently staked by {account}
* @param account the address of the account to get the staked balance of
*/
function numStaked(address account) external view returns (uint256);
}
src/interfaces/IVetoCouncil.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
interface IVetoCouncil {
/* -------------------------------------------------------------------------- */
/* errors */
/* -------------------------------------------------------------------------- */
error CallerNotGovernance();
error NoRewards();
error ZeroAddressInConstructor();
error MaxCouncilMembersExceeded();
/* -------------------------------------------------------------------------- */
/* events */
/* -------------------------------------------------------------------------- */
/**
* @param oldMember The address of the member to be slashed or removed
* @param newMember The address of the new member (0 = no new member)
* @param slashOldMember Whether to slash the member or not
*/
event VetoCouncilSeatsEdited(address indexed oldMember, address indexed newMember, bool slashOldMember);
/**
* @dev emitted when a council member is paid out
* @param account The address of the council member
* @param amountNow The amount paid out now
* @param amountToBeVested The amount to be vested
*/
event CouncilMemberPayout(address indexed account, uint256 amountNow, uint256 amountToBeVested);
/* -------------------------------------------------------------------------- */
/* state-changing */
/* -------------------------------------------------------------------------- */
/**
* @notice Add or remove a council member
* @param oldMember The address of the member to be slashed or removed
* @param newMember The address of the new member (0 = no new member)
* @param slashOldMember Whether to slash the member or not
* @return - true if the council member was added or removed, false if nothing was done
* - the function should return false if the new member is already a council member
* - if the old member is not a council member, the function should return false
* - if the old member is a council member and the new member is the same as the old member, the function should return false
* - by adding a new member there would be more than 7 council members, the function should return false
*/
function addAndRemoveCouncilMember(address oldMember, address newMember, bool slashOldMember)
external
returns (bool);
/**
* @notice Payout the council member
* @param member The address of the council member
* @param nonce The payout nonce to claim from
* @param sync Whether to sync the vesting schedule or not
* @param members The addresses of the council members that were active at `nonce`
*/
function claimPayout(address member, uint256 nonce, bool sync, address[] memory members) external;
/* -------------------------------------------------------------------------- */
/* view */
/* -------------------------------------------------------------------------- */
/**
* @notice returns true if the member is a council member
* @param member The address of the member to be checked
* @return - true if the member is a council member
*/
function isCouncilMember(address member) external view returns (bool);
}
src/libraries/VestingMathLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
uint256 constant VESTING_PERIODS = 100;
/// @dev the maximum amount of seconds a second can vest for
/// @dev this is to prevent a second from over-vesting in payout
/// @dev since rewards vest at 1% per week, this is 100 weeks
uint256 constant MAX_VESTING_SECONDS = uint256(7 days) * 100;
library VestingMathLib {
/**
* @dev Find total owed now and slashable balance using the summation of an arithmetic series
* @dev formula = n/2 * (2a + (n-1)d) or n/2 * (a + l)
* @dev read more about this https://github.com/glowlabs-org/glow-docs/issues/4
* @param rewardsPerSecond - the amount of glow per second the agent earns
* @param secondsActive - the amount of seconds the agent has worked on a given shift
* @param secondsStopped - the amount of seconds since the agent has stopped working on their shift
* @param amountAlreadyWithdrawn - the amount of glow already withdrawn by the agent
* @return withdrawableAmount - the amount of glow owed now
* @return slashableAmount - the total slashable amount of glow (total owed - withdrawableAmount)
*/
function calculateWithdrawableAmountAndSlashableAmount(
uint256 rewardsPerSecond,
uint256 secondsActive,
uint256 secondsStopped,
uint256 amountAlreadyWithdrawn
) internal pure returns (uint256 withdrawableAmount, uint256 slashableAmount) {
//Placeholder for fully vested seconds.
uint256 fullyVestedSeconds;
//If (secondsActive + secondsStopped) > MAX_VESTING_SECONDS,
//That means that there are some seconds that are fully vested.
if (secondsActive + secondsStopped > MAX_VESTING_SECONDS) {
//The fully vested seconds are as follows:
fullyVestedSeconds = secondsActive + secondsStopped - MAX_VESTING_SECONDS;
}
//We make sure that the fully vested seconds are not greater than the seconds active.
//This can happen as secondsStopped grows once the agent stops working
if (fullyVestedSeconds > secondsActive) {
fullyVestedSeconds = secondsActive;
}
//The fully vested rewards are a result of the fully vested seconds * the rewards per second.
uint256 fullyVestedRewards = rewardsPerSecond * fullyVestedSeconds;
//The partially vested seconds are the seconds active minus the fully vested seconds.
uint256 partiallyVestedSeconds = secondsActive - fullyVestedSeconds;
uint256 lowestValueSecond = (1 + secondsStopped) * rewardsPerSecond / MAX_VESTING_SECONDS;
uint256 highestValueSecond = (secondsActive + secondsStopped) * rewardsPerSecond / MAX_VESTING_SECONDS;
if (highestValueSecond > rewardsPerSecond) {
highestValueSecond = rewardsPerSecond;
}
//Arithmetic series
uint256 partiallyVestedSecondsValue = partiallyVestedSeconds * (lowestValueSecond + highestValueSecond) / 2;
uint256 totalRewards = secondsActive * rewardsPerSecond;
withdrawableAmount = fullyVestedRewards + partiallyVestedSecondsValue;
slashableAmount = totalRewards - withdrawableAmount;
withdrawableAmount -= amountAlreadyWithdrawn;
return (withdrawableAmount, slashableAmount);
}
}
Настройки компилятораПоказать
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {
"src/libraries/HalfLife.sol": {
"HalfLife": "0xcf4d7552ca9f07c474d69e89a88943fabb60b199"
},
"src/libraries/HalfLifeCarbonCreditAuction.sol": {
"HalfLifeCarbonCreditAuction": "0xd178525026bafc51d045a2e98b0c79a526d446de"
}
},
"optimizer": {
"runs": 1000000,
"enabled": true
},
"evmVersion": "paris",
"remappings": [
":@/=src/",
":@clones/=lib/unifap-v2/lib/clones-with-immutable-args/src/",
":@ds/=lib/unifap-v2/lib/ds-test/src/",
":@openzeppelin/=lib/openzeppelin-contracts/contracts/",
":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
":@solady/=lib/solady/src/",
":@solmate/=lib/unifap-v2/lib/solmate/src/",
":@std/=lib/unifap-v2/lib/forge-std/src/",
":@unifapv2/=src/UnifapV2/",
":abdk-libraries-solidity/=lib/abdk-libraries-solidity/",
":clones-with-immutable-args/=lib/clones-with-immutable-args/src/",
":clones/=lib/clones-with-immutable-args/src/",
":clones/=lib/unifap-v2/lib/clones-with-immutable-args/src/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
":forge-std/=lib/forge-std/src/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/",
":solady/=lib/solady/",
":solmate/=lib/solmate/src/",
":unifap-v2/=lib/unifap-v2/src/"
]
}Исходный код и метаданные: Sourcify.
Исходный код принадлежит авторам контракта.