ETH Price: $3,178.20 (+2.38%)

Contract

0xa8352fEe09f1E033AE6bF889F44F36d1794Efa4A
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw Reward201332182024-06-20 13:24:35148 days ago1718889875IN
0xa8352fEe...1794Efa4A
0 ETH0.0011724917.46083434
Withdraw Reward194618892024-03-18 13:10:35242 days ago1710767435IN
0xa8352fEe...1794Efa4A
0 ETH0.0033057849.2299319
Withdraw Reward189984362024-01-13 14:02:11307 days ago1705154531IN
0xa8352fEe...1794Efa4A
0 ETH0.0017205920.42248323
Withdraw Reward189851432024-01-11 17:23:47309 days ago1704993827IN
0xa8352fEe...1794Efa4A
0 ETH0.0030596834.96308928
Withdraw From Ma...189851232024-01-11 17:19:47309 days ago1704993587IN
0xa8352fEe...1794Efa4A
0 ETH0.0026097841.85697352
Withdraw Reward156883052022-10-06 9:55:59772 days ago1665050159IN
0xa8352fEe...1794Efa4A
0 ETH0.000662276.53454292
Withdraw Reward156880342022-10-06 9:01:11772 days ago1665046871IN
0xa8352fEe...1794Efa4A
0 ETH0.000681318.08682582
Withdraw Reward156879982022-10-06 8:53:59772 days ago1665046439IN
0xa8352fEe...1794Efa4A
0 ETH0.000576876.84712551
Withdraw Reward156879192022-10-06 8:38:11772 days ago1665045491IN
0xa8352fEe...1794Efa4A
0 ETH0.00071458.48072717
Withdraw Reward156879022022-10-06 8:34:35772 days ago1665045275IN
0xa8352fEe...1794Efa4A
0 ETH0.000743297.33392748
Withdraw Reward156878852022-10-06 8:30:59772 days ago1665045059IN
0xa8352fEe...1794Efa4A
0 ETH0.000904316.51468325
Withdraw From Ma...156878822022-10-06 8:30:23772 days ago1665045023IN
0xa8352fEe...1794Efa4A
0 ETH0.000437415.50548806
Setup150068252022-06-22 8:47:07878 days ago1655887627IN
0xa8352fEe...1794Efa4A
0 ETH0.0013209619.77160422
0x60806040150067412022-06-22 8:25:08878 days ago1655886308IN
 Contract Creation
0 ETH0.0138020420.72186702

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.