ETH Price: $3,214.39 (+0.56%)

Contract

0x1804213586A95C23b62C19873b3afF8266b0A381
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw Reward201547932024-06-23 13:49:35211 days ago1719150575IN
0x18042135...266b0A381
0 ETH0.000279473.31715485
Withdraw Reward199247222024-05-22 10:07:23243 days ago1716372443IN
0x18042135...266b0A381
0 ETH0.000651647.7346127
Withdraw Reward198674302024-05-14 9:42:59251 days ago1715679779IN
0x18042135...266b0A381
0 ETH0.000443276.60122372
Withdraw Reward198597392024-05-13 7:55:35252 days ago1715586935IN
0x18042135...266b0A381
0 ETH0.000524426.22463803
Withdraw Reward197556182024-04-28 18:30:59267 days ago1714329059IN
0x18042135...266b0A381
0 ETH0.000588966.73005624
Withdraw From Ma...197556082024-04-28 18:28:59267 days ago1714328939IN
0x18042135...266b0A381
0 ETH0.000540757.51567966
Withdraw Reward196811702024-04-18 8:31:47277 days ago1713429107IN
0x18042135...266b0A381
0 ETH0.0008949613.32791641
Withdraw Reward195878572024-04-05 6:48:11290 days ago1712299691IN
0x18042135...266b0A381
0 ETH0.0011799314.00520792
Withdraw Reward195035102024-03-24 9:26:47302 days ago1711272407IN
0x18042135...266b0A381
0 ETH0.0011134616.58176109
Withdraw Reward194771992024-03-20 16:48:23306 days ago1710953303IN
0x18042135...266b0A381
0 ETH0.0033384539.62560508
Withdraw Reward194770732024-03-20 16:22:35306 days ago1710951755IN
0x18042135...266b0A381
0 ETH0.0035692540.78592464
Withdraw From Ma...194770652024-03-20 16:20:59306 days ago1710951659IN
0x18042135...266b0A381
0 ETH0.0025131633.47312441
Withdraw Reward189703792024-01-09 15:44:35377 days ago1704815075IN
0x18042135...266b0A381
0 ETH0.0014440521.50497673
Withdraw Reward188837372023-12-28 11:13:11389 days ago1703761991IN
0x18042135...266b0A381
0 ETH0.0017510326.07651485
Withdraw Reward188475232023-12-23 9:08:47394 days ago1703322527IN
0x18042135...266b0A381
0 ETH0.0012672218.87156439
Withdraw Reward188406442023-12-22 9:59:11395 days ago1703239151IN
0x18042135...266b0A381
0 ETH0.0033014639.18652204
Withdraw Reward188132982023-12-18 13:54:11399 days ago1702907651IN
0x18042135...266b0A381
0 ETH0.0054478264.66266327
Withdraw Reward187947732023-12-15 23:26:23402 days ago1702682783IN
0x18042135...266b0A381
0 ETH0.0036177742.94099703
Withdraw Reward187772732023-12-13 12:32:47404 days ago1702470767IN
0x18042135...266b0A381
0 ETH0.0029378134.87015585
Withdraw Reward187555442023-12-10 11:34:59407 days ago1702208099IN
0x18042135...266b0A381
0 ETH0.0017969725.5208995
Withdraw From Ma...187555422023-12-10 11:34:35407 days ago1702208075IN
0x18042135...266b0A381
0 ETH0.0019863826.45694705
Withdraw Reward186842642023-11-30 11:56:23417 days ago1701345383IN
0x18042135...266b0A381
0 ETH0.0029588435.11976674
Withdraw Reward186196462023-11-21 10:48:59426 days ago1700563739IN
0x18042135...266b0A381
0 ETH0.0018028626.84830099
Withdraw Reward186125802023-11-20 11:04:11427 days ago1700478251IN
0x18042135...266b0A381
0 ETH0.001811821.50509568
Withdraw Reward186055352023-11-19 11:23:23428 days ago1700393003IN
0x18042135...266b0A381
0 ETH0.0012028817.08345905
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

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

Contract Name:
SubDevFund

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
Yes with 2 runs

Other Settings:
default evmVersion
File 1 of 3 : SubDevFund.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.14;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./DevFund.sol";

contract SubDevFund {
    /// --- External contracts

    // token to be awarded as reward to holders
    IERC20 public rewardToken;

    // token to claim rewards
    IERC20 public holderToken;

    DevFund public mainDevFund;

    /// --- Storage

    // total reward on contract
    uint256 public totalReward;

    // previously seen reward balance on contract
    uint256 public prevBalance;

    // User's address => Reward at time of withdraw
    mapping(address => uint256) public rewardAtTimeOfWithdraw;

    // User's address => Reward which can be withdrawn
    mapping(address => uint256) public owed;

    /**
     * @dev Contract constructor sets reward token address.
     */
    constructor(address _rewardToken) {
        rewardToken = IERC20(_rewardToken);
    }

    /**
     * @dev Setup function sets dev holder token address and owner, callable only once.
     * @param _holderToken Dev holder Token address.
     * @param _mainDevFund Address of the main dev fund from which it must withdraw rewards
     */
    function setup(address _holderToken, address _mainDevFund) external returns (bool) {
        require(address(holderToken) == address(0), "SubDevFund: already setup");
        require(_holderToken != address(0), "SubDevFund: invalid _holderToken");
        require(_mainDevFund != address(0), "SubDevFund: invalid _mainDevFund");

        holderToken = IERC20(_holderToken);
        mainDevFund = DevFund(_mainDevFund);

        return true;
    }

    /// --- Contract functions

    /**
     * @dev Withdraw reward from the main dev fund.
     */
    function withdrawFromMain() public {
        mainDevFund.withdrawReward();
    }

    /**
     * @dev Withdraws reward for holder. Returns reward.
     */
    function withdrawReward() public returns (uint256) {
        updateTotalReward();

        uint256 value = calcReward(msg.sender) + owed[msg.sender];
        rewardAtTimeOfWithdraw[msg.sender] = totalReward;
        owed[msg.sender] = 0;

        require(value > 0, "SubDevFund: withdrawReward nothing to transfer");

        rewardToken.transfer(msg.sender, value);

        prevBalance = rewardToken.balanceOf(address(this));

        return value;
    }

    /**
     * @dev Credits reward to owed balance.
     * @param forAddress holder's address.
     */
    function softWithdrawRewardFor(address forAddress) external returns (uint256){
        updateTotalReward();
        uint256 value = calcReward(forAddress);
        rewardAtTimeOfWithdraw[forAddress] = totalReward;
        owed[forAddress] += value;

        return value;
    }

    /**
     * @dev View remaining reward for an address.
     * @param forAddress holder's address.
     */
    function rewardFor(address forAddress) public view returns (uint256) {
        uint256 _currentBalance = rewardToken.balanceOf(address(this));
        uint256 _totalReward = totalReward +
        (_currentBalance > prevBalance ? _currentBalance - prevBalance : 0);
        return
        owed[forAddress] +
        (holderToken.balanceOf(forAddress) *
        (_totalReward - rewardAtTimeOfWithdraw[forAddress])) /
        holderToken.totalSupply();
    }

    /**
     * @dev if we got some tokens update the totalReward, has to be called on every withdraw
     */
    function updateTotalReward() internal returns (uint256) {
        uint256 currentBalance = rewardToken.balanceOf(address(this));
        if (currentBalance > prevBalance) {
            totalReward += currentBalance - prevBalance;
        }
        return totalReward;
    }

    /**
     * @dev Compute reward for holder. Returns reward.
     * @param forAddress holder address.
     */
    function calcReward(address forAddress) internal view returns (uint256) {
        return
        (holderToken.balanceOf(forAddress) *
        (totalReward - rewardAtTimeOfWithdraw[forAddress])) /
        holderToken.totalSupply();
    }

    // 0 ETH transfers to trigger withdrawReward
    fallback() external {withdrawReward();}
}

File 2 of 3 : IERC20.sol
// 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);
}

File 3 of 3 : DevFund.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.14;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract DevFund {
    /// --- External contracts

    // token to be awarded as reward to holders
    IERC20 public rewardToken;

    // token to claim rewards
    IERC20 public holderToken;

    /// --- Storage

    // total reward on contract
    uint256 public totalReward;

    // previously seen reward balance on contract
    uint256 public prevBalance;

    // User's address => Reward at time of withdraw
    mapping(address => uint256) public rewardAtTimeOfWithdraw;

    // User's address => Reward which can be withdrawn
    mapping(address => uint256) public owed;

    /**
     * @dev Contract constructor sets reward token address.
     */
    constructor(address _rewardToken) {
        rewardToken = IERC20(_rewardToken);
    }

    /**
     * @dev Setup function sets dev holder token address and owner, callable only once.
     * @param _holderToken Dev holder Token address.
     */
    function setup(address _holderToken) external returns (bool){
        require(address(holderToken) == address(0), "DevFund: already setup");

        holderToken = IERC20(_holderToken);

        return true;
    }

    /// --- Contract functions

    /**
     * @dev Withdraws reward for holder. Returns reward.
     */
    function withdrawReward() public returns (uint256) {
        updateTotalReward();
        uint256 value = calcReward(msg.sender) + owed[msg.sender];
        rewardAtTimeOfWithdraw[msg.sender] = totalReward;
        owed[msg.sender] = 0;

        require(value > 0, "DevFund: withdrawReward nothing to transfer");

        rewardToken.transfer(msg.sender, value);

        prevBalance = rewardToken.balanceOf(address(this));

        return value;
    }

    /**
     * @dev Credits reward to owed balance.
     * @param forAddress holder's address.
     */
    function softWithdrawRewardFor(address forAddress) external returns (uint256){
        updateTotalReward();
        uint256 value = calcReward(forAddress);
        rewardAtTimeOfWithdraw[forAddress] = totalReward;
        owed[forAddress] += value;

        return value;
    }

    /**
     * @dev View remaining reward for an address.
     * @param forAddress holder's address.
     */
    function rewardFor(address forAddress) public view returns (uint256) {
        uint256 _currentBalance = rewardToken.balanceOf(address(this));
        uint256 _totalReward = totalReward +
        (_currentBalance > prevBalance ? _currentBalance - prevBalance : 0);
        return
        owed[forAddress] +
        (holderToken.balanceOf(forAddress) *
        (_totalReward - rewardAtTimeOfWithdraw[forAddress])) /
        holderToken.totalSupply();
    }

    /**
     * @dev if we got some tokens update the totalReward, has to be called on every withdraw
     */
    function updateTotalReward() internal returns (uint256) {
        uint256 currentBalance = rewardToken.balanceOf(address(this));
        if (currentBalance > prevBalance) {
            totalReward += currentBalance - prevBalance;
        }
        return totalReward;
    }

    /**
     * @dev Compute reward for holder. Returns reward.
     * @param forAddress holder address.
     */
    function calcReward(address forAddress) internal view returns (uint256) {
        return
        (holderToken.balanceOf(forAddress) *
        (totalReward - rewardAtTimeOfWithdraw[forAddress])) /
        holderToken.totalSupply();
    }

    // 0 ETH transfers to trigger withdrawReward
    fallback() external {withdrawReward();}
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 2
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"holderToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mainDevFund","outputs":[{"internalType":"contract DevFund","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"owed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prevBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardAtTimeOfWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forAddress","type":"address"}],"name":"rewardFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_holderToken","type":"address"},{"internalType":"address","name":"_mainDevFund","type":"address"}],"name":"setup","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"forAddress","type":"address"}],"name":"softWithdrawRewardFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawFromMain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100a45760003560e01c806307150a90146100ae57806312cdcf84146100d75780632d34ba79146100ea5780633d103b6d1461010d578063661edfee1461013b578063750142e61461014e5780638949df8514610157578063b16228181461015f578063c885bc5814610172578063df18e0471461017a578063f7c618c11461019a578063faca7cfa146101ad575b6100ac6101b6565b005b6002546100c1906001600160a01b031681565b6040516100ce9190610929565b60405180910390f35b6001546100c1906001600160a01b031681565b6100fd6100f8366004610959565b610361565b60405190151581526020016100ce565b61012d61011b36600461098c565b60056020526000908152604090205481565b6040519081526020016100ce565b61012d61014936600461098c565b610498565b61012d60035481565b6100ac610684565b61012d61016d36600461098c565b610700565b61012d6101b6565b61012d61018836600461098c565b60066020526000908152604090205481565b6000546100c1906001600160a01b031681565b61012d60045481565b60006101c0610760565b503360008181526006602052604081205490916101dc9061080a565b6101e691906109c4565b6003543360009081526005602090815260408083209390935560069052908120559050806102725760405162461bcd60e51b815260206004820152602e60248201527f53756244657646756e643a207769746864726177526577617264206e6f74686960448201526d3733903a37903a3930b739b332b960911b60648201526084015b60405180910390fd5b60005460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb906044016020604051808303816000875af11580156102c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e791906109dc565b506000546040516370a0823160e01b81526001600160a01b03909116906370a0823190610318903090600401610929565b602060405180830381865afa158015610335573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035991906109fe565b600455919050565b6001546000906001600160a01b0316156103b95760405162461bcd60e51b8152602060048201526019602482015278053756244657646756e643a20616c726561647920736574757603c1b6044820152606401610269565b6001600160a01b03831661040f5760405162461bcd60e51b815260206004820181905260248201527f53756244657646756e643a20696e76616c6964205f686f6c646572546f6b656e6044820152606401610269565b6001600160a01b0382166104655760405162461bcd60e51b815260206004820181905260248201527f53756244657646756e643a20696e76616c6964205f6d61696e44657646756e646044820152606401610269565b50600180546001600160a01b038085166001600160a01b0319928316178355600280549185169190921617905592915050565b600080546040516370a0823160e01b815282916001600160a01b0316906370a08231906104c9903090600401610929565b602060405180830381865afa1580156104e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050a91906109fe565b90506000600454821161051e57600061052b565b60045461052b9083610a17565b60035461053891906109c4565b9050600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561058d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b191906109fe565b6001600160a01b0385166000908152600560205260409020546105d49083610a17565b6001546040516370a0823160e01b81526001600160a01b03909116906370a0823190610604908990600401610929565b602060405180830381865afa158015610621573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064591906109fe565b61064f9190610a2e565b6106599190610a4d565b6001600160a01b03851660009081526006602052604090205461067c91906109c4565b949350505050565b600260009054906101000a90046001600160a01b03166001600160a01b031663c885bc586040518163ffffffff1660e01b81526004016020604051808303816000875af11580156106d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fd91906109fe565b50565b600061070a610760565b5060006107168361080a565b6003546001600160a01b03851660009081526005602090815260408083209390935560069052908120805492935083929091906107549084906109c4565b90915550909392505050565b600080546040516370a0823160e01b815282916001600160a01b0316906370a0823190610791903090600401610929565b602060405180830381865afa1580156107ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d291906109fe565b9050600454811115610802576004546107eb9082610a17565b600360008282546107fc91906109c4565b90915550505b505060035490565b600154604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015610854573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087891906109fe565b6001600160a01b03831660009081526005602052604090205460035461089e9190610a17565b6001546040516370a0823160e01b81526001600160a01b03909116906370a08231906108ce908790600401610929565b602060405180830381865afa1580156108eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090f91906109fe565b6109199190610a2e565b6109239190610a4d565b92915050565b6001600160a01b0391909116815260200190565b80356001600160a01b038116811461095457600080fd5b919050565b6000806040838503121561096c57600080fd5b6109758361093d565b91506109836020840161093d565b90509250929050565b60006020828403121561099e57600080fd5b6109a78261093d565b9392505050565b634e487b7160e01b600052601160045260246000fd5b600082198211156109d7576109d76109ae565b500190565b6000602082840312156109ee57600080fd5b815180151581146109a757600080fd5b600060208284031215610a1057600080fd5b5051919050565b600082821015610a2957610a296109ae565b500390565b6000816000190483118215151615610a4857610a486109ae565b500290565b600082610a6a57634e487b7160e01b600052601260045260246000fd5b50049056fea26469706673582212209473e7354cbbe89da341e231f1ca8e09b18c84903d2310db0225a5c29d87d8f464736f6c634300080e0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.