ETH Price: $2,999.61 (-2.37%)

Contract

0x2F0C88e935Db5A60DDA73b0B4EAEef55883896d9
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deny206925982024-09-06 15:58:59437 days ago1725638339IN
0x2F0C88e9...5883896d9
0 ETH0.000445419.12862187
Rely206925972024-09-06 15:58:47437 days ago1725638327IN
0x2F0C88e9...5883896d9
0 ETH0.0009049519.12493209

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x09b28796...973d4fC0f
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
VestedRewardsDistribution

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-FileCopyrightText: © 2023 Dai Foundation <www.daifoundation.org>
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
pragma solidity ^0.8.16;

import {IStakingRewards} from "./synthetix/interfaces/IStakingRewards.sol";
import {DssVestWithGemLike} from "./interfaces/DssVestWithGemLike.sol";
import {IERC20} from "openzeppelin-contracts/token/ERC20/IERC20.sol";

/**
 * @title VestedRewardsDistribution: A permissionless bridge between {DssVest} and {StakingRewards}.
 * @author @amusingaxl
 */
contract VestedRewardsDistribution {
    /// @notice Addresses with owner access on this contract. `wards[usr]`
    mapping(address => uint256) public wards;

    /// @notice DssVest instance for token rewards.
    DssVestWithGemLike public immutable dssVest;
    /// @notice StakingRewards instance to enable farming.
    IStakingRewards public immutable stakingRewards;
    /// @notice Token in which rewards are being paid.
    IERC20 public immutable gem;

    /// @dev Vest IDs are sequential, but they are incremented before usage, meaning `0` is not a valid vest ID.
    uint256 internal constant INVALID_VEST_ID = 0;
    /// @notice The vest ID managed by this contract.
    /// @dev It is initialized to an invalid value to prevent calls before the vest ID being set.
    /// The reason this is not a required constructor parameter is that there is a circular dependency
    /// between this contract and the creation of the vest: the address of this contract must be the vest `usr`.
    uint256 public vestId = INVALID_VEST_ID;
    /// @notice Tracks the last time a distribution was made.
    uint256 public lastDistributedAt;

    /**
     * @dev `usr` was granted owner access.
     * @param usr The user address.
     */
    event Rely(address indexed usr);
    /**
     * @notice `usr` owner access was revoked.
     * @param usr The user address.
     */
    event Deny(address indexed usr);
    /**
     * @notice A contract parameter was updated.
     * @param what The changed parameter name. Currently the supported values are: "vestID"
     * @param data The new value of the parameter.
     */
    event File(bytes32 indexed what, uint256 data);
    /**
     * @notice A distribution of tokens was made.
     * @param amount The total tokens in the current distribution.
     */
    event Distribute(uint256 amount);

    modifier auth() {
        require(wards[msg.sender] == 1, "VestedRewardsDistribution/not-authorized");
        _;
    }

    /**
     * @dev The token `gem` used in DssVest must be the same as `rewardsToken` in StakingRewards.
     * @param _dssVest The DssVest instance as the source of the funds.
     * @param _stakingRewards The farming contract.
     */
    constructor(address _dssVest, address _stakingRewards) {
        address _gem = DssVestWithGemLike(_dssVest).gem();
        require(
            _gem == address(IStakingRewards(_stakingRewards).rewardsToken()),
            "VestedRewardsDistribution/invalid-gem"
        );

        dssVest = DssVestWithGemLike(_dssVest);
        stakingRewards = IStakingRewards(_stakingRewards);
        gem = IERC20(_gem);

        wards[msg.sender] = 1;
        emit Rely(msg.sender);
    }

    // --- Administration ---

    /**
     * @notice Grants `usr` admin access to this contract.
     * @param usr The user address.
     */
    function rely(address usr) external auth {
        wards[usr] = 1;
        emit Rely(usr);
    }

    /**
     * @notice Revokes `usr` admin access from this contract.
     * @param usr The user address.
     */
    function deny(address usr) external auth {
        wards[usr] = 0;
        emit Deny(usr);
    }

    /**
     * @notice Updates a contract parameter.
     * @param what The changed parameter name. `"vestId"
     * @param data The new value of the parameter.
     */
    function file(bytes32 what, uint256 data) external auth {
        if (what == "vestId") {
            _setVestId(data);
        } else {
            revert("VestedRewardsDistribution/file-unrecognized-param");
        }

        emit File(what, data);
    }

    /**
     * @notice Updates the `vestId` managed by this contract.
     * @dev The `_vestId` must be valid, in favor of this contract.
     * @dev Vesting streams whose `clf > bgn` are not supported.
     * @dev Unrestricted vesting streams are not supported.
     * @param _vestId The new vest ID.
     */
    function _setVestId(uint256 _vestId) internal {
        require(dssVest.valid(_vestId), "VestedRewardsDistribution/invalid-vest-id");
        require(dssVest.res(_vestId) == 1, "VestedRewardsDistribution/invalid-vest-res");
        require(dssVest.usr(_vestId) == address(this), "VestedRewardsDistribution/invalid-vest-usr");
        require(dssVest.clf(_vestId) == dssVest.bgn(_vestId), "VestedRewardsDistribution/invalid-vest-cliff");

        vestId = _vestId;
        lastDistributedAt = 0;
    }

    /**
     * @notice Distributes the amount of rewards due since the last distribution.
     * @dev Notice we don't need to wait for the current distribution `periodFinish` to be over in the
     * `RewardsDistribution` contract because it can handle new rewards being sent at any given time.
     * @return amount The amount being distributed.
     */
    function distribute() external returns (uint256 amount) {
        require(vestId != INVALID_VEST_ID, "VestedRewardsDistribution/invalid-vest-id");

        amount = dssVest.unpaid(vestId);
        require(amount > 0, "VestedRewardsDistribution/no-pending-amount");

        lastDistributedAt = block.timestamp;
        dssVest.vest(vestId, amount);

        require(gem.transfer(address(stakingRewards), amount), "VestedRewardsDistribution/transfer-failed");
        stakingRewards.notifyRewardAmount(amount);

        emit Distribute(amount);
    }
}

// SPDX-FileCopyrightText: © 2019-2021 Synthetix
// SPDX-FileCopyrightText: © 2023 Dai Foundation <www.daifoundation.org>
// SPDX-License-Identifier: MIT AND AGPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
pragma solidity ^0.8.16;

import {IERC20} from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";

// https://docs.synthetix.io/contracts/source/interfaces/istakingrewards
interface IStakingRewards {
    // Views

    function balanceOf(address account) external view returns (uint256);

    function earned(address account) external view returns (uint256);

    function getRewardForDuration() external view returns (uint256);

    function lastTimeRewardApplicable() external view returns (uint256);

    function rewardPerToken() external view returns (uint256);

    function rewardsDistribution() external view returns (address);

    function rewardsToken() external view returns (IERC20);

    function stakingToken() external view returns (IERC20);

    function totalSupply() external view returns (uint256);

    // Mutative

    function exit() external;

    function getReward() external;

    function stake(uint256 amount) external;

    function stake(uint256 amount, uint16 referral) external;

    function withdraw(uint256 amount) external;

    function notifyRewardAmount(uint256 reward) external;

    function setRewardsDistribution(address _rewardsDistribution) external;

    function setRewardsDuration(uint256 _rewardsDuration) external;

    function recoverERC20(address tokenAddress, uint256 tokenAmount) external;
}

// SPDX-FileCopyrightText: © 2017, 2018, 2019 dbrock, rain, mrchico
// SPDX-FileCopyrightText: © 2023 Dai Foundation <www.daifoundation.org>
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
pragma solidity ^0.8.16;

interface DssVestWithGemLike {
    function valid(uint256 _id) external view returns (bool);

    function usr(uint256 id) external view returns (address);

    function bgn(uint256 id) external view returns (uint256);

    function clf(uint256 id) external view returns (uint256);

    function fin(uint256 id) external view returns (uint256);

    function mgr(uint256 id) external view returns (address);

    function res(uint256 id) external view returns (uint256);

    function tot(uint256 id) external view returns (uint256);

    function rxd(uint256 id) external view returns (uint256);

    function accrued(uint256 id) external view returns (uint256);

    function unpaid(uint256 _id) external view returns (uint256);

    // @dev This function is not part of the DssVest interface, it's only present in the concrete implementations
    // DssVestMintable and DssVestTransferable.
    function gem() external view returns (address);

    function rely(address who) external;

    function deny(address who) external;

    function file(bytes32 what, uint256 data) external;

    function create(
        address _usr,
        uint256 _tot,
        uint256 _bgn,
        uint256 _tau,
        uint256 _eta,
        address _mgr
    ) external returns (uint256 id);

    function restrict(uint256 _id) external;

    function unrestrict(uint256 _id) external;

    function vest(uint256 id) external;

    function vest(uint256 id, uint256 _maxAmt) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @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 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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.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));
        }
    }

    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);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "dss-interfaces/=lib/dss-test/lib/dss-interfaces/src/",
    "dss-test/=lib/dss-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "dss-vest/=lib-0_6_x/dss-vest/src/",
    "token-tests/=lib/token-tests/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_dssVest","type":"address"},{"internalType":"address","name":"_stakingRewards","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Deny","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Distribute","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"what","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"File","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Rely","type":"event"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"deny","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distribute","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dssVest","outputs":[{"internalType":"contract DssVestWithGemLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"what","type":"bytes32"},{"internalType":"uint256","name":"data","type":"uint256"}],"name":"file","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gem","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastDistributedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"rely","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingRewards","outputs":[{"internalType":"contract IStakingRewards","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

0x60e0604052600060015534801561001557600080fd5b5060405162000f0638038062000f06833981016040819052610036916101e2565b6000826001600160a01b0316637bd2bea76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061009a919061021c565b9050816001600160a01b031663d1af0c7d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fe919061021c565b6001600160a01b0316816001600160a01b0316146101705760405162461bcd60e51b815260206004820152602560248201527f56657374656452657761726473446973747269627574696f6e2f696e76616c69604482015264642d67656d60d81b606482015260840160405180910390fd5b6001600160a01b0380841660805282811660a052811660c0523360008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a2505050610240565b6001600160a01b03811681146101df57600080fd5b50565b600080604083850312156101f557600080fd5b8251610200816101ca565b6020840151909250610211816101ca565b809150509250929050565b60006020828403121561022e57600080fd5b8151610239816101ca565b9392505050565b60805160a05160c051610c51620002b56000396000818161012b015261057701526000818160d901528181610548015261065a015260008181610152015281816103d1015281816104cf01528181610710015281816107b5015281816108980152818161097001526109f90152610c516000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80637bd399db116100665780637bd399db1461014d5780639c52a7f114610174578063bf353dbb14610187578063e4fc6b6d146101a7578063feb04f7c146101af57600080fd5b806329ae8114146100a35780633a56573b146100b857806364b87a70146100d457806365fae35e146101135780637bd2bea714610126575b600080fd5b6100b66100b1366004610ac6565b6101b8565b005b6100c160015481565b6040519081526020015b60405180910390f35b6100fb7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100cb565b6100b6610121366004610b00565b6102ae565b6100fb7f000000000000000000000000000000000000000000000000000000000000000081565b6100fb7f000000000000000000000000000000000000000000000000000000000000000081565b6100b6610182366004610b00565b610322565b6100c1610195366004610b00565b60006020819052908152604090205481565b6100c1610395565b6100c160025481565b336000908152602081905260409020546001146101f05760405162461bcd60e51b81526004016101e790610b24565b60405180910390fd5b81651d995cdd125960d21b0361020e57610209816106fa565b610270565b60405162461bcd60e51b815260206004820152603160248201527f56657374656452657761726473446973747269627574696f6e2f66696c652d756044820152706e7265636f676e697a65642d706172616d60781b60648201526084016101e7565b817fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7826040516102a291815260200190565b60405180910390a25050565b336000908152602081905260409020546001146102dd5760405162461bcd60e51b81526004016101e790610b24565b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b336000908152602081905260409020546001146103515760405162461bcd60e51b81526004016101e790610b24565b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b6001546000906103b75760405162461bcd60e51b81526004016101e790610b6c565b6001546040516353e8863d60e01b815260048101919091527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906353e8863d90602401602060405180830381865afa158015610420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104449190610ba3565b9050600081116104aa5760405162461bcd60e51b815260206004820152602b60248201527f56657374656452657761726473446973747269627574696f6e2f6e6f2d70656e60448201526a191a5b99cb585b5bdd5b9d60aa1b60648201526084016101e7565b4260025560015460405163bb7c46f360e01b81526004810191909152602481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bb7c46f390604401600060405180830381600087803b15801561051b57600080fd5b505af115801561052f573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018590527f000000000000000000000000000000000000000000000000000000000000000016925063a9059cbb91506044016020604051808303816000875af11580156105c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e69190610bbc565b6106445760405162461bcd60e51b815260206004820152602960248201527f56657374656452657761726473446973747269627574696f6e2f7472616e7366604482015268195c8b59985a5b195960ba1b60648201526084016101e7565b604051633c6b16ab60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690633c6b16ab90602401600060405180830381600087803b1580156106a657600080fd5b505af11580156106ba573d6000803e3d6000fd5b505050507f4def474aca53bf221d07d9ab0f675b3f6d8d2494b8427271bcf43c018ef1eead816040516106ef91815260200190565b60405180910390a190565b60405163bf8712c560e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bf8712c590602401602060405180830381865afa15801561075f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107839190610bbc565b61079f5760405162461bcd60e51b81526004016101e790610b6c565b604051636a747e9760e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d4e8fd2e90602401602060405180830381865afa158015610804573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108289190610ba3565b6001146108785760405162461bcd60e51b815260206004820152602a6024820152600080516020610bfc833981519152604482015269642d766573742d72657360b01b60648201526084016101e7565b60405163c659cd4560e01b81526004810182905230906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c659cd4590602401602060405180830381865afa1580156108df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109039190610bde565b6001600160a01b03161461095a5760405162461bcd60e51b815260206004820152602a6024820152600080516020610bfc8339815191526044820152693216bb32b9ba16bab9b960b11b60648201526084016101e7565b6040516321f6c0cf60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906321f6c0cf90602401602060405180830381865afa1580156109bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e39190610ba3565b60405163cdf4349760e01b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdf4349790602401602060405180830381865afa158015610a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6c9190610ba3565b14610abc5760405162461bcd60e51b815260206004820152602c6024820152600080516020610bfc83398151915260448201526b3216bb32b9ba16b1b634b33360a11b60648201526084016101e7565b6001556000600255565b60008060408385031215610ad957600080fd5b50508035926020909101359150565b6001600160a01b0381168114610afd57600080fd5b50565b600060208284031215610b1257600080fd5b8135610b1d81610ae8565b9392505050565b60208082526028908201527f56657374656452657761726473446973747269627574696f6e2f6e6f742d61756040820152671d1a1bdc9a5e995960c21b606082015260800190565b6020808252602990820152600080516020610bfc833981519152604082015268190b5d995cdd0b5a5960ba1b606082015260800190565b600060208284031215610bb557600080fd5b5051919050565b600060208284031215610bce57600080fd5b81518015158114610b1d57600080fd5b600060208284031215610bf057600080fd5b8151610b1d81610ae856fe56657374656452657761726473446973747269627574696f6e2f696e76616c69a264697066735822122066deda86028a26bfbf984e75451c68a5cc5ae0bd49f5668ae268a68d5bcc4c8b64736f6c63430008100033000000000000000000000000b313eab3fde99b2bb4ba9750c2ddfbe2729d1ce90000000000000000000000000650caf159c5a49f711e8169d4336ecb9b950275

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80637bd399db116100665780637bd399db1461014d5780639c52a7f114610174578063bf353dbb14610187578063e4fc6b6d146101a7578063feb04f7c146101af57600080fd5b806329ae8114146100a35780633a56573b146100b857806364b87a70146100d457806365fae35e146101135780637bd2bea714610126575b600080fd5b6100b66100b1366004610ac6565b6101b8565b005b6100c160015481565b6040519081526020015b60405180910390f35b6100fb7f0000000000000000000000000650caf159c5a49f711e8169d4336ecb9b95027581565b6040516001600160a01b0390911681526020016100cb565b6100b6610121366004610b00565b6102ae565b6100fb7f00000000000000000000000056072c95faa701256059aa122697b133aded927981565b6100fb7f000000000000000000000000b313eab3fde99b2bb4ba9750c2ddfbe2729d1ce981565b6100b6610182366004610b00565b610322565b6100c1610195366004610b00565b60006020819052908152604090205481565b6100c1610395565b6100c160025481565b336000908152602081905260409020546001146101f05760405162461bcd60e51b81526004016101e790610b24565b60405180910390fd5b81651d995cdd125960d21b0361020e57610209816106fa565b610270565b60405162461bcd60e51b815260206004820152603160248201527f56657374656452657761726473446973747269627574696f6e2f66696c652d756044820152706e7265636f676e697a65642d706172616d60781b60648201526084016101e7565b817fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7826040516102a291815260200190565b60405180910390a25050565b336000908152602081905260409020546001146102dd5760405162461bcd60e51b81526004016101e790610b24565b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b336000908152602081905260409020546001146103515760405162461bcd60e51b81526004016101e790610b24565b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b6001546000906103b75760405162461bcd60e51b81526004016101e790610b6c565b6001546040516353e8863d60e01b815260048101919091527f000000000000000000000000b313eab3fde99b2bb4ba9750c2ddfbe2729d1ce96001600160a01b0316906353e8863d90602401602060405180830381865afa158015610420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104449190610ba3565b9050600081116104aa5760405162461bcd60e51b815260206004820152602b60248201527f56657374656452657761726473446973747269627574696f6e2f6e6f2d70656e60448201526a191a5b99cb585b5bdd5b9d60aa1b60648201526084016101e7565b4260025560015460405163bb7c46f360e01b81526004810191909152602481018290527f000000000000000000000000b313eab3fde99b2bb4ba9750c2ddfbe2729d1ce96001600160a01b03169063bb7c46f390604401600060405180830381600087803b15801561051b57600080fd5b505af115801561052f573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000650caf159c5a49f711e8169d4336ecb9b95027581166004830152602482018590527f00000000000000000000000056072c95faa701256059aa122697b133aded927916925063a9059cbb91506044016020604051808303816000875af11580156105c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e69190610bbc565b6106445760405162461bcd60e51b815260206004820152602960248201527f56657374656452657761726473446973747269627574696f6e2f7472616e7366604482015268195c8b59985a5b195960ba1b60648201526084016101e7565b604051633c6b16ab60e01b8152600481018290527f0000000000000000000000000650caf159c5a49f711e8169d4336ecb9b9502756001600160a01b031690633c6b16ab90602401600060405180830381600087803b1580156106a657600080fd5b505af11580156106ba573d6000803e3d6000fd5b505050507f4def474aca53bf221d07d9ab0f675b3f6d8d2494b8427271bcf43c018ef1eead816040516106ef91815260200190565b60405180910390a190565b60405163bf8712c560e01b8152600481018290527f000000000000000000000000b313eab3fde99b2bb4ba9750c2ddfbe2729d1ce96001600160a01b03169063bf8712c590602401602060405180830381865afa15801561075f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107839190610bbc565b61079f5760405162461bcd60e51b81526004016101e790610b6c565b604051636a747e9760e11b8152600481018290527f000000000000000000000000b313eab3fde99b2bb4ba9750c2ddfbe2729d1ce96001600160a01b03169063d4e8fd2e90602401602060405180830381865afa158015610804573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108289190610ba3565b6001146108785760405162461bcd60e51b815260206004820152602a6024820152600080516020610bfc833981519152604482015269642d766573742d72657360b01b60648201526084016101e7565b60405163c659cd4560e01b81526004810182905230906001600160a01b037f000000000000000000000000b313eab3fde99b2bb4ba9750c2ddfbe2729d1ce9169063c659cd4590602401602060405180830381865afa1580156108df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109039190610bde565b6001600160a01b03161461095a5760405162461bcd60e51b815260206004820152602a6024820152600080516020610bfc8339815191526044820152693216bb32b9ba16bab9b960b11b60648201526084016101e7565b6040516321f6c0cf60e01b8152600481018290527f000000000000000000000000b313eab3fde99b2bb4ba9750c2ddfbe2729d1ce96001600160a01b0316906321f6c0cf90602401602060405180830381865afa1580156109bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e39190610ba3565b60405163cdf4349760e01b8152600481018390527f000000000000000000000000b313eab3fde99b2bb4ba9750c2ddfbe2729d1ce96001600160a01b03169063cdf4349790602401602060405180830381865afa158015610a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6c9190610ba3565b14610abc5760405162461bcd60e51b815260206004820152602c6024820152600080516020610bfc83398151915260448201526b3216bb32b9ba16b1b634b33360a11b60648201526084016101e7565b6001556000600255565b60008060408385031215610ad957600080fd5b50508035926020909101359150565b6001600160a01b0381168114610afd57600080fd5b50565b600060208284031215610b1257600080fd5b8135610b1d81610ae8565b9392505050565b60208082526028908201527f56657374656452657761726473446973747269627574696f6e2f6e6f742d61756040820152671d1a1bdc9a5e995960c21b606082015260800190565b6020808252602990820152600080516020610bfc833981519152604082015268190b5d995cdd0b5a5960ba1b606082015260800190565b600060208284031215610bb557600080fd5b5051919050565b600060208284031215610bce57600080fd5b81518015158114610b1d57600080fd5b600060208284031215610bf057600080fd5b8151610b1d81610ae856fe56657374656452657761726473446973747269627574696f6e2f696e76616c69a264697066735822122066deda86028a26bfbf984e75451c68a5cc5ae0bd49f5668ae268a68d5bcc4c8b64736f6c63430008100033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.