ETH Price: $2,622.95 (+1.08%)

Contract

0xAC01ADC15878FAe7d9b580d6FB695AA735738856
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim200600942024-06-10 7:59:1173 days ago1718006351IN
0xAC01ADC1...735738856
0 ETH0.000386635.17714144
Claim189213492024-01-02 18:01:59232 days ago1704218519IN
0xAC01ADC1...735738856
0 ETH0.0029971427.95736368
Claim184331312023-10-26 8:13:47301 days ago1698308027IN
0xAC01ADC1...735738856
0 ETH0.0016359818.15659
Claim182694092023-10-03 10:26:47324 days ago1696328807IN
0xAC01ADC1...735738856
0 ETH0.000832567.76943415
Claim182346032023-09-28 13:43:47328 days ago1695908627IN
0xAC01ADC1...735738856
0 ETH0.00103511.23736023
Claim179975532023-08-26 8:08:35362 days ago1693037315IN
0xAC01ADC1...735738856
0 ETH0.0012390911.34660155
Claim178904352023-08-11 8:24:47377 days ago1691742287IN
0xAC01ADC1...735738856
0 ETH0.0015471617.17088167
Claim177627562023-07-24 11:46:47395 days ago1690199207IN
0xAC01ADC1...735738856
0 ETH0.0025344423.64130731
Claim176917532023-07-14 12:38:59405 days ago1689338339IN
0xAC01ADC1...735738856
0 ETH0.0018162320.1571053
Claim175674472023-06-27 1:28:11422 days ago1687829291IN
0xAC01ADC1...735738856
0 ETH0.001173813.02725757
Claim174088692023-06-04 18:00:11444 days ago1685901611IN
0xAC01ADC1...735738856
0 ETH0.0029532923.75865655
Claim173460362023-05-26 21:47:47453 days ago1685137667IN
0xAC01ADC1...735738856
0 ETH0.0026868525.06296598
Claim170459332023-04-14 14:15:47495 days ago1681481747IN
0xAC01ADC1...735738856
0 ETH0.0032951830.17454963
Claim168999122023-03-24 21:04:11516 days ago1679691851IN
0xAC01ADC1...735738856
0 ETH0.0027177625.35136102
Claim168964882023-03-24 9:32:11517 days ago1679650331IN
0xAC01ADC1...735738856
0 ETH0.0018859817.5925056
Claim168881902023-03-23 5:32:11518 days ago1679549531IN
0xAC01ADC1...735738856
0 ETH0.0011800911.00796902
Claim168192112023-03-13 12:56:47528 days ago1678712207IN
0xAC01ADC1...735738856
0 ETH0.0016580818.40189031
Claim167850472023-03-08 17:33:59532 days ago1678296839IN
0xAC01ADC1...735738856
0 ETH0.0052756349.21119013
Claim167529292023-03-04 5:12:11537 days ago1677906731IN
0xAC01ADC1...735738856
0 ETH0.001745216.27928618
Claim166742422023-02-21 3:34:59548 days ago1676950499IN
0xAC01ADC1...735738856
0 ETH0.0025195723.07217223
Claim166108342023-02-12 6:17:35557 days ago1676182655IN
0xAC01ADC1...735738856
0 ETH0.0012953114.06358527
Claim165832382023-02-08 9:42:47561 days ago1675849367IN
0xAC01ADC1...735738856
0 ETH0.0024890523.21795395
Claim165796162023-02-07 21:35:11561 days ago1675805711IN
0xAC01ADC1...735738856
0 ETH0.0049990645.77728595
Claim165548872023-02-04 10:41:35565 days ago1675507295IN
0xAC01ADC1...735738856
0 ETH0.0020495719.11845731
Claim165477242023-02-03 10:41:59566 days ago1675420919IN
0xAC01ADC1...735738856
0 ETH0.0017099618.97765148
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Rewards

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 9999 runs

Other Settings:
default evmVersion
File 1 of 8 : Rewards.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IBarn.sol";

contract Rewards is Ownable {
    using SafeMath for uint256;

    uint256 constant decimals = 10 ** 18; // Same as SWINGBY token's decimal
    uint256 constant oneYear = 31536000;
    struct Pull {
        address source;
        uint256 startTs;
        uint256 endTs;
        uint256 totalDuration;
    }

    Pull public pullFeature;
    bool public disabled;
    uint256 public lastPullTs;
    uint256 public apr;

    uint256 public balanceBefore;
    uint256 public currentMultiplier;

    mapping(address => uint256) public userMultiplier;
    mapping(address => uint256) public owed;

    IBarn public barn;
    IERC20 public rewardToken;

    event Claim(address indexed user, uint256 amount);

    constructor(address _owner, address _swingby, address _barn, uint256 _apr) {
        require(_swingby != address(0), "reward token must not be 0x0");
        require(_barn != address(0), "barn address must not be 0x0");

        transferOwnership(_owner);

        rewardToken = IERC20(_swingby);
        barn = IBarn(_barn);
        apr = _apr;
    }

    // registerUserAction is called by the Barn every time the user does a deposit or withdrawal in order to
    // account for the changes in reward that the user should get
    // it updates the amount owed to the user without transferring the funds
    function registerUserAction(address user) public {
        require(msg.sender == address(barn), 'only callable by barn');

        _calculateOwed(user);
    }

    // claim calculates the currently owed reward and transfers the funds to the user
    function claim() public returns (uint256){
        _calculateOwed(msg.sender);

        uint256 amount = owed[msg.sender];
        require(amount > 0, "nothing to claim");

        owed[msg.sender] = 0;

        rewardToken.transfer(msg.sender, amount);

        // acknowledge the amount that was transferred to the user
        ackFunds();

        emit Claim(msg.sender, amount);

        return amount;
    }

    // ackFunds checks the difference between the last known balance of `token` and the current one
    // if it goes up, the multiplier is re-calculated
    // if it goes down, it only updates the known balance
    function ackFunds() public {
        uint256 balanceNow = rewardToken.balanceOf(address(this));

        if (balanceNow == 0 || balanceNow <= balanceBefore) {
            balanceBefore = balanceNow;
            return;
        }

        uint256 totalStakedBond = barn.bondStaked();
        // if there's no bond staked, it doesn't make sense to ackFunds because there's nobody to distribute them to
        // and the calculation would fail anyways due to division by 0
        if (totalStakedBond == 0) {
            return;
        }

        uint256 diff = balanceNow.sub(balanceBefore);
        uint256 multiplier = currentMultiplier.add(diff.mul(decimals).div(totalStakedBond));

        balanceBefore = balanceNow;
        currentMultiplier = multiplier;
    }

    // setupPullToken is used to setup the rewards system; only callable by contract owner
    // set source to address(0) to disable the functionality
    function setupPullToken(address source, uint256 startTs, uint256 endTs) public {
        require(msg.sender == owner(), "!owner");
        require(!disabled, "contract is disabled");

        require(endTs.sub(startTs) == oneYear, "endTs.sub(startTs) != 1year");

        if (pullFeature.source != address(0)) {
            require(source == address(0), "contract is already set up, source must be 0x0");
            disabled = true;
        } else {
            require(source != address(0), "contract is not setup, source must be != 0x0");
        }

        if (source == address(0)) {
            require(startTs == 0, "disable contract: startTs must be 0");
            require(endTs == 0, "disable contract: endTs must be 0");
        } else {
            require(endTs > startTs, "setup contract: endTs must be greater than startTs");
        }
        pullFeature.source = source;
        pullFeature.startTs = startTs;
        pullFeature.endTs = endTs;
        // duration must be 1Y always. (For calculate SWINGBY APY)
        pullFeature.totalDuration = endTs.sub(startTs);

        if (lastPullTs < startTs) {
            lastPullTs = startTs;
        }
    }

    // setBarn sets the address of the BarnBridge Barn into the state variable
    function setBarn(address _barn) public {
        require(_barn != address(0), 'barn address must not be 0x0');
        require(msg.sender == owner(), '!owner');

        barn = IBarn(_barn);
    }

    function setNewAPR(uint256 _apr) public {
        require(msg.sender == owner(), "!owner");
        apr = _apr;
        if (apr == 0) {
            // send all remain tokens to owner (expected governance contract.)
            uint256 amountToPull = rewardToken.balanceOf(address(pullFeature.source));
            rewardToken.transferFrom(pullFeature.source, owner(), amountToPull);
        }
    }

    // _pullToken calculates the amount based on the time passed since the last pull relative
    // to the total amount of time that the pull functionality is active and executes a transferFrom from the
    // address supplied as `pullTokenFrom`, if enabled
    function _pullToken() internal {
        if (
            pullFeature.source == address(0) ||
            block.timestamp < pullFeature.startTs
        ) {
            return;
        }

        uint256 timestampCap = pullFeature.endTs;
        if (block.timestamp < pullFeature.endTs) {
            timestampCap = block.timestamp;
        }

        if (lastPullTs >= timestampCap) {
            return;
        }

        uint256 timeSinceLastPull = timestampCap.sub(lastPullTs);
        // extends pullFeature.totalDuration
        pullFeature.totalDuration = pullFeature.totalDuration.add(timeSinceLastPull);

        uint256 totalStakedBond = barn.bondStaked();
        // use required amount instead of pullFeature.totalAmount for calculate SWINGBY static APY for stakers
        uint256 requiredAmountFor1Y = totalStakedBond.mul(apr).div(100);

        uint256 shareToPull = timeSinceLastPull.mul(decimals).div(pullFeature.totalDuration);
        uint256 amountToPull = requiredAmountFor1Y.mul(shareToPull).div(decimals);

        lastPullTs = block.timestamp;
        rewardToken.transferFrom(pullFeature.source, address(this), amountToPull);
    }

    // _calculateOwed calculates and updates the total amount that is owed to an user and updates the user's multiplier
    // to the current value
    // it automatically attempts to pull the token from the source and acknowledge the funds
    function _calculateOwed(address user) internal {
        _pullToken();
        ackFunds();

        uint256 reward = _userPendingReward(user);

        owed[user] = owed[user].add(reward);
        userMultiplier[user] = currentMultiplier;
    }

    // _userPendingReward calculates the reward that should be based on the current multiplier / anything that's not included in the `owed[user]` value
    // it does not represent the entire reward that's due to the user unless added on top of `owed[user]`
    function _userPendingReward(address user) internal view returns (uint256) {
        uint256 multiplier = currentMultiplier.sub(userMultiplier[user]);

        return barn.balanceOf(user).mul(multiplier).div(decimals);
    }
}

File 2 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/Context.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 3 of 8 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 4 of 8 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

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

File 5 of 8 : IBarn.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

import "../libraries/LibBarnStorage.sol";

interface IBarn {
    // deposit allows a user to add more bond to his staked balance
    function deposit(uint256 amount) external;

    // withdraw allows a user to withdraw funds if the balance is not locked
    function withdraw(uint256 amount) external;

    // lock a user's currently staked balance until timestamp & add the bonus to his voting power
    function lock(uint256 timestamp) external;

    // delegate allows a user to delegate his voting power to another user
    function delegate(address to) external;

    // stopDelegate allows a user to take back the delegated voting power
    function stopDelegate() external;

    // lock the balance of a proposal creator until the voting ends; only callable by DAO
    function lockCreatorBalance(address user, uint256 timestamp) external;

    // balanceOf returns the current BOND balance of a user (bonus not included)
    function balanceOf(address user) external view returns (uint256);

    // balanceAtTs returns the amount of BOND that the user currently staked (bonus NOT included)
    function balanceAtTs(address user, uint256 timestamp) external view returns (uint256);

    // stakeAtTs returns the Stake object of the user that was valid at `timestamp`
    function stakeAtTs(address user, uint256 timestamp) external view returns (LibBarnStorage.Stake memory);

    // votingPower returns the voting power (bonus included) + delegated voting power for a user at the current block
    function votingPower(address user) external view returns (uint256);

    // votingPowerAtTs returns the voting power (bonus included) + delegated voting power for a user at a point in time
    function votingPowerAtTs(address user, uint256 timestamp) external view returns (uint256);

    // bondStaked returns the total raw amount of BOND staked at the current block
    function bondStaked() external view returns (uint256);

    // bondStakedAtTs returns the total raw amount of BOND users have deposited into the contract
    // it does not include any bonus
    function bondStakedAtTs(uint256 timestamp) external view returns (uint256);

    // delegatedPower returns the total voting power that a user received from other users
    function delegatedPower(address user) external view returns (uint256);

    // delegatedPowerAtTs returns the total voting power that a user received from other users at a point in time
    function delegatedPowerAtTs(address user, uint256 timestamp) external view returns (uint256);

    // multiplierAtTs calculates the multiplier at a given timestamp based on the user's stake a the given timestamp
    // it includes the decay mechanism
    function multiplierAtTs(address user, uint256 timestamp) external view returns (uint256);

    // userLockedUntil returns the timestamp until the user's balance is locked
    function userLockedUntil(address user) external view returns (uint256);

    // userDidDelegate returns the address to which a user delegated their voting power; address(0) if not delegated
    function userDelegatedTo(address user) external view returns (address);

    // bondCirculatingSupply returns the current circulating supply of BOND
    function bondCirculatingSupply() external view returns (uint256);
}

File 6 of 8 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 7 of 8 : LibBarnStorage.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

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

library LibBarnStorage {
    bytes32 constant STORAGE_POSITION = keccak256("com.barnbridge.barn.storage");

    struct Checkpoint {
        uint256 timestamp;
        uint256 amount;
    }

    struct Stake {
        uint256 timestamp;
        uint256 amount;
        uint256 expiryTimestamp;
        address delegatedTo;
    }

    struct NodeInfo {
        bytes32 p2pkey;
        uint8   dataType;
    }

    struct Storage {
        bool initialized;

        // mapping of user address to history of Stake objects
        // every user action creates a new object in the history
        mapping(address => Stake[]) userStakeHistory;

        // array of bond staked Checkpoint
        // deposits/withdrawals create a new object in the history (max one per block)
        Checkpoint[] bondStakedHistory;

        // mapping of user address to history of delegated power
        // every delegate/stopDelegate call create a new checkpoint (max one per block)
        mapping(address => Checkpoint[]) delegatedPowerHistory;

        // mapping of user address to <p2pkey,dataType> for swingby node. (no history)
        mapping(address => NodeInfo) nodeInfo;

        IERC20 bond;
        IRewards rewards;
    }

    function barnStorage() internal pure returns (Storage storage ds) {
        bytes32 position = STORAGE_POSITION;
        assembly {
            ds.slot := position
        }
    }
}

File 8 of 8 : IRewards.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

interface IRewards {
    function registerUserAction(address user) external;

    function setNewAPR(uint256 _apr) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_swingby","type":"address"},{"internalType":"address","name":"_barn","type":"address"},{"internalType":"uint256","name":"_apr","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"ackFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"apr","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balanceBefore","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"barn","outputs":[{"internalType":"contract IBarn","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"disabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPullTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"owed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pullFeature","outputs":[{"internalType":"address","name":"source","type":"address"},{"internalType":"uint256","name":"startTs","type":"uint256"},{"internalType":"uint256","name":"endTs","type":"uint256"},{"internalType":"uint256","name":"totalDuration","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"registerUserAction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_barn","type":"address"}],"name":"setBarn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_apr","type":"uint256"}],"name":"setNewAPR","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"source","type":"address"},{"internalType":"uint256","name":"startTs","type":"uint256"},{"internalType":"uint256","name":"endTs","type":"uint256"}],"name":"setupPullToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b5060405162001b8438038062001b84833981016040819052620000349162000253565b60006200004062000119565b600080546001600160a01b0319166001600160a01b03831690811782556040519293509160008051602062001b64833981519152908290a3506001600160a01b038316620000ab5760405162461bcd60e51b8152600401620000a290620002a4565b60405180910390fd5b6001600160a01b038216620000d45760405162461bcd60e51b8152600401620000a290620002db565b620000df846200011d565b600d80546001600160a01b039485166001600160a01b031991821617909155600c8054939094169216919091179091556007555062000312565b3390565b6200012762000119565b6001600160a01b03166200013a62000227565b6001600160a01b03161462000196576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116620001dd5760405162461bcd60e51b815260040180806020018281038252602681526020018062001b3e6026913960400191505060405180910390fd5b600080546040516001600160a01b038085169392169160008051602062001b6483398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b80516001600160a01b03811681146200024e57600080fd5b919050565b6000806000806080858703121562000269578384fd5b620002748562000236565b9350620002846020860162000236565b9250620002946040860162000236565b6060959095015193969295505050565b6020808252601c908201527f72657761726420746f6b656e206d757374206e6f742062652030783000000000604082015260600190565b6020808252601c908201527f6261726e2061646472657373206d757374206e6f742062652030783000000000604082015260600190565b61181c80620003226000396000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c8063715018a6116100cd578063b1a03b6b11610081578063ee07080511610066578063ee0708051461024d578063f2fde38b14610262578063f7c618c11461027557610151565b8063b1a03b6b14610227578063df18e0471461023a57610151565b80638da5cb5b116100b25780638da5cb5b1461020f57806394b5798a14610217578063acfd93251461021f57610151565b8063715018a6146101f45780638a8a6f59146101fc57610151565b80634e71d92d1161012457806357ded9c91161010957806357ded9c9146101d157806366a7d821146101d95780636fbaaa1e146101ec57610151565b80634e71d92d146101b65780635168e544146101be57610151565b8063100223bb14610156578063194f480e146101745780633b342a85146101895780634831976c1461019e575b600080fd5b61015e61027d565b60405161016b9190611796565b60405180910390f35b61017c610283565b60405161016b91906113c5565b61019c610197366004611329565b61029f565b005b6101a6610374565b60405161016b949392919061143d565b61015e61039c565b61019c6101cc366004611395565b6104ec565b61015e61069e565b61019c6101e7366004611329565b6106a4565b61015e6106e4565b61019c6106ea565b61019c61020a366004611343565b6107e7565b61017c610a20565b61015e610a3c565b61019c610a42565b61015e610235366004611329565b610c0a565b61015e610248366004611329565b610c1c565b610255610c2e565b60405161016b9190611470565b61019c610270366004611329565b610c37565b61017c610da4565b60065481565b600c5473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff81166102db5760405162461bcd60e51b81526004016102d29061166e565b60405180910390fd5b6102e3610a20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461032d5760405162461bcd60e51b81526004016102d29061175f565b600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015460025460035460045473ffffffffffffffffffffffffffffffffffffffff9093169284565b60006103a733610dc0565b336000908152600b6020526040902054806103d45760405162461bcd60e51b81526004016102d2906115a3565b336000818152600b602052604080822091909155600d5490517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169163a9059cbb9161043e919085906004016113e6565b602060405180830381600087803b15801561045857600080fd5b505af115801561046c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104909190611375565b50610499610a42565b3373ffffffffffffffffffffffffffffffffffffffff167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4826040516104df9190611796565b60405180910390a2905090565b6104f4610a20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461053e5760405162461bcd60e51b81526004016102d29061175f565b60078190558061069b57600d546001546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009273ffffffffffffffffffffffffffffffffffffffff908116926370a08231926105a692909116906004016113c5565b60206040518083038186803b1580156105be57600080fd5b505afa1580156105d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f691906113ad565b600d5460015491925073ffffffffffffffffffffffffffffffffffffffff908116916323b872dd9116610627610a20565b846040518463ffffffff1660e01b81526004016106469392919061140c565b602060405180830381600087803b15801561066057600080fd5b505af1158015610674573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106989190611375565b50505b50565b60075481565b600c5473ffffffffffffffffffffffffffffffffffffffff1633146106db5760405162461bcd60e51b81526004016102d29061147b565b61069b81610dc0565b60095481565b6106f2610e4d565b73ffffffffffffffffffffffffffffffffffffffff16610710610a20565b73ffffffffffffffffffffffffffffffffffffffff1614610778576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6107ef610a20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108395760405162461bcd60e51b81526004016102d29061175f565b60055460ff161561085c5760405162461bcd60e51b81526004016102d2906115da565b6301e1338061086b8284610e51565b146108885760405162461bcd60e51b81526004016102d29061156c565b60015473ffffffffffffffffffffffffffffffffffffffff161561090a5773ffffffffffffffffffffffffffffffffffffffff8316156108da5760405162461bcd60e51b81526004016102d2906114b2565b600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561093d565b73ffffffffffffffffffffffffffffffffffffffff831661093d5760405162461bcd60e51b81526004016102d29061150f565b73ffffffffffffffffffffffffffffffffffffffff83166109995781156109765760405162461bcd60e51b81526004016102d2906116a5565b80156109945760405162461bcd60e51b81526004016102d290611702565b6109b8565b8181116109b85760405162461bcd60e51b81526004016102d290611611565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851617905560028290556003819055610a0c8183610e51565b600455600654821115610698575060065550565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60085481565b600d546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a999030906004016113c5565b60206040518083038186803b158015610ab157600080fd5b505afa158015610ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae991906113ad565b9050801580610afa57506008548111155b15610b0757600855610c08565b600c54604080517fc2077e81000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163c2077e81916004808301926020929190829003018186803b158015610b7257600080fd5b505afa158015610b86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610baa91906113ad565b905080610bb8575050610c08565b6000610bcf60085484610e5190919063ffffffff16565b90506000610bfb610bf284610bec85670de0b6b3a7640000610eb3565b90610f13565b60095490610f7a565b6008949094555050506009555b565b600a6020526000908152604090205481565b600b6020526000908152604090205481565b60055460ff1681565b610c3f610e4d565b73ffffffffffffffffffffffffffffffffffffffff16610c5d610a20565b73ffffffffffffffffffffffffffffffffffffffff1614610cc5576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610d175760405162461bcd60e51b81526004018080602001828103825260268152602001806117a06026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600d5473ffffffffffffffffffffffffffffffffffffffff1681565b610dc8610fd4565b610dd0610a42565b6000610ddb82611206565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600b6020526040902054909150610e0e9082610f7a565b73ffffffffffffffffffffffffffffffffffffffff9092166000908152600b6020908152604080832094909455600954600a9091529290209190915550565b3390565b600082821115610ea8576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b600082610ec257506000610ead565b82820282848281610ecf57fe5b0414610f0c5760405162461bcd60e51b81526004018080602001828103825260218152602001806117c66021913960400191505060405180910390fd5b9392505050565b6000808211610f69576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381610f7257fe5b049392505050565b600082820183811015610f0c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60015473ffffffffffffffffffffffffffffffffffffffff161580610ffa575060025442105b1561100457610c08565b600354428111156110125750425b80600654106110215750610c08565b600061103860065483610e5190919063ffffffff16565b6004549091506110489082610f7a565b6004908155600c54604080517fc2077e81000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff9093169263c2077e8192808201926020929091829003018186803b1580156110b857600080fd5b505afa1580156110cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f091906113ad565b9050600061110e6064610bec60075485610eb390919063ffffffff16565b60045490915060009061112d90610bec86670de0b6b3a7640000610eb3565b90506000611147670de0b6b3a7640000610bec8585610eb3565b42600655600d546001546040517f23b872dd00000000000000000000000000000000000000000000000000000000815292935073ffffffffffffffffffffffffffffffffffffffff918216926323b872dd926111ab9216903090869060040161140c565b602060405180830381600087803b1580156111c557600080fd5b505af11580156111d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fd9190611375565b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600a6020526040812054600954829161123b9190610e51565b600c546040517f70a082310000000000000000000000000000000000000000000000000000000081529192506112fc91670de0b6b3a764000091610bec91859173ffffffffffffffffffffffffffffffffffffffff16906370a08231906112a6908a906004016113c5565b60206040518083038186803b1580156112be57600080fd5b505afa1580156112d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f691906113ad565b90610eb3565b9150505b919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461130057600080fd5b60006020828403121561133a578081fd5b610f0c82611305565b600080600060608486031215611357578182fd5b61136084611305565b95602085013595506040909401359392505050565b600060208284031215611386578081fd5b81518015158114610f0c578182fd5b6000602082840312156113a6578081fd5b5035919050565b6000602082840312156113be578081fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff94909416845260208401929092526040830152606082015260800190565b901515815260200190565b60208082526015908201527f6f6e6c792063616c6c61626c65206279206261726e0000000000000000000000604082015260600190565b6020808252602e908201527f636f6e747261637420697320616c7265616479207365742075702c20736f757260408201527f6365206d75737420626520307830000000000000000000000000000000000000606082015260800190565b6020808252602c908201527f636f6e7472616374206973206e6f742073657475702c20736f75726365206d7560408201527f737420626520213d203078300000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f656e6454732e73756228737461727454732920213d2031796561720000000000604082015260600190565b60208082526010908201527f6e6f7468696e6720746f20636c61696d00000000000000000000000000000000604082015260600190565b60208082526014908201527f636f6e74726163742069732064697361626c6564000000000000000000000000604082015260600190565b60208082526032908201527f736574757020636f6e74726163743a20656e645473206d75737420626520677260408201527f6561746572207468616e20737461727454730000000000000000000000000000606082015260800190565b6020808252601c908201527f6261726e2061646472657373206d757374206e6f742062652030783000000000604082015260600190565b60208082526023908201527f64697361626c6520636f6e74726163743a2073746172745473206d757374206260408201527f6520300000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526021908201527f64697361626c6520636f6e74726163743a20656e645473206d7573742062652060408201527f3000000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526006908201527f216f776e65720000000000000000000000000000000000000000000000000000604082015260600190565b9081526020019056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122061ea30f9e90735b57f2fa5dc45df607a42a9e5e55353dc9cbf5996b8fc71d33864736f6c634300070600334f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573738be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0000000000000000000000000bd8332654deff42ee2e7ec3e927e58b4e9c6ccf40000000000000000000000008287c7b963b405b7b8d467db9d79eec40625b13a000000000000000000000000b4200c8c44b05a342a9f7fd0d27647c4bf9533e7000000000000000000000000000000000000000000000000000000000000000f

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101515760003560e01c8063715018a6116100cd578063b1a03b6b11610081578063ee07080511610066578063ee0708051461024d578063f2fde38b14610262578063f7c618c11461027557610151565b8063b1a03b6b14610227578063df18e0471461023a57610151565b80638da5cb5b116100b25780638da5cb5b1461020f57806394b5798a14610217578063acfd93251461021f57610151565b8063715018a6146101f45780638a8a6f59146101fc57610151565b80634e71d92d1161012457806357ded9c91161010957806357ded9c9146101d157806366a7d821146101d95780636fbaaa1e146101ec57610151565b80634e71d92d146101b65780635168e544146101be57610151565b8063100223bb14610156578063194f480e146101745780633b342a85146101895780634831976c1461019e575b600080fd5b61015e61027d565b60405161016b9190611796565b60405180910390f35b61017c610283565b60405161016b91906113c5565b61019c610197366004611329565b61029f565b005b6101a6610374565b60405161016b949392919061143d565b61015e61039c565b61019c6101cc366004611395565b6104ec565b61015e61069e565b61019c6101e7366004611329565b6106a4565b61015e6106e4565b61019c6106ea565b61019c61020a366004611343565b6107e7565b61017c610a20565b61015e610a3c565b61019c610a42565b61015e610235366004611329565b610c0a565b61015e610248366004611329565b610c1c565b610255610c2e565b60405161016b9190611470565b61019c610270366004611329565b610c37565b61017c610da4565b60065481565b600c5473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff81166102db5760405162461bcd60e51b81526004016102d29061166e565b60405180910390fd5b6102e3610a20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461032d5760405162461bcd60e51b81526004016102d29061175f565b600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015460025460035460045473ffffffffffffffffffffffffffffffffffffffff9093169284565b60006103a733610dc0565b336000908152600b6020526040902054806103d45760405162461bcd60e51b81526004016102d2906115a3565b336000818152600b602052604080822091909155600d5490517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169163a9059cbb9161043e919085906004016113e6565b602060405180830381600087803b15801561045857600080fd5b505af115801561046c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104909190611375565b50610499610a42565b3373ffffffffffffffffffffffffffffffffffffffff167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4826040516104df9190611796565b60405180910390a2905090565b6104f4610a20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461053e5760405162461bcd60e51b81526004016102d29061175f565b60078190558061069b57600d546001546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009273ffffffffffffffffffffffffffffffffffffffff908116926370a08231926105a692909116906004016113c5565b60206040518083038186803b1580156105be57600080fd5b505afa1580156105d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f691906113ad565b600d5460015491925073ffffffffffffffffffffffffffffffffffffffff908116916323b872dd9116610627610a20565b846040518463ffffffff1660e01b81526004016106469392919061140c565b602060405180830381600087803b15801561066057600080fd5b505af1158015610674573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106989190611375565b50505b50565b60075481565b600c5473ffffffffffffffffffffffffffffffffffffffff1633146106db5760405162461bcd60e51b81526004016102d29061147b565b61069b81610dc0565b60095481565b6106f2610e4d565b73ffffffffffffffffffffffffffffffffffffffff16610710610a20565b73ffffffffffffffffffffffffffffffffffffffff1614610778576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6107ef610a20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108395760405162461bcd60e51b81526004016102d29061175f565b60055460ff161561085c5760405162461bcd60e51b81526004016102d2906115da565b6301e1338061086b8284610e51565b146108885760405162461bcd60e51b81526004016102d29061156c565b60015473ffffffffffffffffffffffffffffffffffffffff161561090a5773ffffffffffffffffffffffffffffffffffffffff8316156108da5760405162461bcd60e51b81526004016102d2906114b2565b600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561093d565b73ffffffffffffffffffffffffffffffffffffffff831661093d5760405162461bcd60e51b81526004016102d29061150f565b73ffffffffffffffffffffffffffffffffffffffff83166109995781156109765760405162461bcd60e51b81526004016102d2906116a5565b80156109945760405162461bcd60e51b81526004016102d290611702565b6109b8565b8181116109b85760405162461bcd60e51b81526004016102d290611611565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851617905560028290556003819055610a0c8183610e51565b600455600654821115610698575060065550565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60085481565b600d546040517f70a0823100000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff16906370a0823190610a999030906004016113c5565b60206040518083038186803b158015610ab157600080fd5b505afa158015610ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae991906113ad565b9050801580610afa57506008548111155b15610b0757600855610c08565b600c54604080517fc2077e81000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163c2077e81916004808301926020929190829003018186803b158015610b7257600080fd5b505afa158015610b86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610baa91906113ad565b905080610bb8575050610c08565b6000610bcf60085484610e5190919063ffffffff16565b90506000610bfb610bf284610bec85670de0b6b3a7640000610eb3565b90610f13565b60095490610f7a565b6008949094555050506009555b565b600a6020526000908152604090205481565b600b6020526000908152604090205481565b60055460ff1681565b610c3f610e4d565b73ffffffffffffffffffffffffffffffffffffffff16610c5d610a20565b73ffffffffffffffffffffffffffffffffffffffff1614610cc5576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610d175760405162461bcd60e51b81526004018080602001828103825260268152602001806117a06026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600d5473ffffffffffffffffffffffffffffffffffffffff1681565b610dc8610fd4565b610dd0610a42565b6000610ddb82611206565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600b6020526040902054909150610e0e9082610f7a565b73ffffffffffffffffffffffffffffffffffffffff9092166000908152600b6020908152604080832094909455600954600a9091529290209190915550565b3390565b600082821115610ea8576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b600082610ec257506000610ead565b82820282848281610ecf57fe5b0414610f0c5760405162461bcd60e51b81526004018080602001828103825260218152602001806117c66021913960400191505060405180910390fd5b9392505050565b6000808211610f69576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381610f7257fe5b049392505050565b600082820183811015610f0c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60015473ffffffffffffffffffffffffffffffffffffffff161580610ffa575060025442105b1561100457610c08565b600354428111156110125750425b80600654106110215750610c08565b600061103860065483610e5190919063ffffffff16565b6004549091506110489082610f7a565b6004908155600c54604080517fc2077e81000000000000000000000000000000000000000000000000000000008152905160009373ffffffffffffffffffffffffffffffffffffffff9093169263c2077e8192808201926020929091829003018186803b1580156110b857600080fd5b505afa1580156110cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f091906113ad565b9050600061110e6064610bec60075485610eb390919063ffffffff16565b60045490915060009061112d90610bec86670de0b6b3a7640000610eb3565b90506000611147670de0b6b3a7640000610bec8585610eb3565b42600655600d546001546040517f23b872dd00000000000000000000000000000000000000000000000000000000815292935073ffffffffffffffffffffffffffffffffffffffff918216926323b872dd926111ab9216903090869060040161140c565b602060405180830381600087803b1580156111c557600080fd5b505af11580156111d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fd9190611375565b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600a6020526040812054600954829161123b9190610e51565b600c546040517f70a082310000000000000000000000000000000000000000000000000000000081529192506112fc91670de0b6b3a764000091610bec91859173ffffffffffffffffffffffffffffffffffffffff16906370a08231906112a6908a906004016113c5565b60206040518083038186803b1580156112be57600080fd5b505afa1580156112d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f691906113ad565b90610eb3565b9150505b919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461130057600080fd5b60006020828403121561133a578081fd5b610f0c82611305565b600080600060608486031215611357578182fd5b61136084611305565b95602085013595506040909401359392505050565b600060208284031215611386578081fd5b81518015158114610f0c578182fd5b6000602082840312156113a6578081fd5b5035919050565b6000602082840312156113be578081fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff94909416845260208401929092526040830152606082015260800190565b901515815260200190565b60208082526015908201527f6f6e6c792063616c6c61626c65206279206261726e0000000000000000000000604082015260600190565b6020808252602e908201527f636f6e747261637420697320616c7265616479207365742075702c20736f757260408201527f6365206d75737420626520307830000000000000000000000000000000000000606082015260800190565b6020808252602c908201527f636f6e7472616374206973206e6f742073657475702c20736f75726365206d7560408201527f737420626520213d203078300000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f656e6454732e73756228737461727454732920213d2031796561720000000000604082015260600190565b60208082526010908201527f6e6f7468696e6720746f20636c61696d00000000000000000000000000000000604082015260600190565b60208082526014908201527f636f6e74726163742069732064697361626c6564000000000000000000000000604082015260600190565b60208082526032908201527f736574757020636f6e74726163743a20656e645473206d75737420626520677260408201527f6561746572207468616e20737461727454730000000000000000000000000000606082015260800190565b6020808252601c908201527f6261726e2061646472657373206d757374206e6f742062652030783000000000604082015260600190565b60208082526023908201527f64697361626c6520636f6e74726163743a2073746172745473206d757374206260408201527f6520300000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526021908201527f64697361626c6520636f6e74726163743a20656e645473206d7573742062652060408201527f3000000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526006908201527f216f776e65720000000000000000000000000000000000000000000000000000604082015260600190565b9081526020019056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122061ea30f9e90735b57f2fa5dc45df607a42a9e5e55353dc9cbf5996b8fc71d33864736f6c63430007060033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000bd8332654deff42ee2e7ec3e927e58b4e9c6ccf40000000000000000000000008287c7b963b405b7b8d467db9d79eec40625b13a000000000000000000000000b4200c8c44b05a342a9f7fd0d27647c4bf9533e7000000000000000000000000000000000000000000000000000000000000000f

-----Decoded View---------------
Arg [0] : _owner (address): 0xbD8332654deFf42Ee2E7ec3E927e58b4e9c6CCF4
Arg [1] : _swingby (address): 0x8287C7b963b405b7B8D467DB9d79eEC40625b13A
Arg [2] : _barn (address): 0xb4200c8c44b05a342A9f7FD0d27647C4bf9533e7
Arg [3] : _apr (uint256): 15

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000bd8332654deff42ee2e7ec3e927e58b4e9c6ccf4
Arg [1] : 0000000000000000000000008287c7b963b405b7b8d467db9d79eec40625b13a
Arg [2] : 000000000000000000000000b4200c8c44b05a342a9f7fd0d27647c4bf9533e7
Arg [3] : 000000000000000000000000000000000000000000000000000000000000000f


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.