Source Code
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Staking
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 10 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import './interfaces/HMTokenInterface.sol';
import './interfaces/IEscrow.sol';
import './interfaces/IStaking.sol';
import './libs/Stakes.sol';
/**
* @title Staking contract
* @dev The Staking contract allows to stake.
*/
contract Staking is IStaking, Ownable, ReentrancyGuard {
using Stakes for Stakes.Staker;
// Token address
address public token;
// Minimum amount of tokens a staker needs to stake
uint256 public minimumStake;
// Time in blocks to unstake
uint32 public lockPeriod;
// Staker stakes: staker => Stake
mapping(address => Stakes.Staker) public stakes;
// List of stakers
address[] public stakers;
// Fee percentage
uint8 public feePercentage;
// Accumulated fee balance in the contract
uint256 public feeBalance;
mapping(address => bool) public slashers;
/**
* @dev Emitted when `staker` stake `tokens` amount.
*/
event StakeDeposited(address indexed staker, uint256 tokens);
/**
* @dev Emitted when `staker` unstaked and locked `tokens` amount `until` block.
*/
event StakeLocked(address indexed staker, uint256 tokens, uint256 until);
/**
* @dev Emitted when `staker` withdraws `tokens` staked.
*/
event StakeWithdrawn(address indexed staker, uint256 tokens);
/**
* @dev Emitted when `staker` was slashed for a total of `tokens` amount.
*/
event StakeSlashed(
address indexed staker,
uint256 tokens,
address indexed escrowAddress,
address slashRequester
);
/**
* @dev Emitted when `owner` withdraws the total `amount` of fees.
*/
event FeeWithdrawn(uint256 amount);
constructor(
address _token,
uint256 _minimumStake,
uint32 _lockPeriod,
uint8 _feePercentage
) Ownable(msg.sender) {
token = _token;
_setMinimumStake(_minimumStake);
_setLockPeriod(_lockPeriod);
_setFeePercentage(_feePercentage);
slashers[owner()] = true;
}
/**
* @dev Set the minimum stake amount.
* @param _minimumStake Minimum stake
*/
function setMinimumStake(
uint256 _minimumStake
) external override onlyOwner {
_setMinimumStake(_minimumStake);
}
function _setMinimumStake(uint256 _minimumStake) private {
require(_minimumStake > 0, 'Must be a positive number');
minimumStake = _minimumStake;
}
/**
* @dev Set the lock period for unstaking.
* @param _lockPeriod Period in blocks to wait for token withdrawals after unstaking
*/
function setLockPeriod(uint32 _lockPeriod) external override onlyOwner {
_setLockPeriod(_lockPeriod);
}
function _setLockPeriod(uint32 _lockPeriod) private {
require(_lockPeriod > 0, 'Must be a positive number');
lockPeriod = _lockPeriod;
}
/**
* @dev Set the fee percentage for slashing.
* @param _feePercentage Fee percentage for slashing
*/
function setFeePercentage(uint8 _feePercentage) external onlyOwner {
_setFeePercentage(_feePercentage);
}
function _setFeePercentage(uint8 _feePercentage) private {
require(_feePercentage <= 100, 'Fee cannot exceed 100%');
feePercentage = _feePercentage;
}
/**
* @dev Getter that returns whether a staker has any available stake.
* @param _staker Address of the staker
* @return True if staker has available tokens staked
*/
function getAvailableStake(
address _staker
) external view override returns (uint256) {
return stakes[_staker].tokensAvailable();
}
/**
* @dev Get the total amount of tokens staked by the staker.
* @param _staker Address of the staker
* @return Amount of tokens staked by the staker
*/
function getStakedTokens(
address _staker
) external view override returns (uint256) {
return stakes[_staker].tokensStaked;
}
/**
* @dev Get list of stakers
* @param _startIndex Index of the first staker to return.
* @param _limit Maximum number of stakers to return.
* @return List of staker's addresses, and stake data
*/
function getListOfStakers(
uint256 _startIndex,
uint256 _limit
) external view returns (address[] memory, Stakes.Staker[] memory) {
uint256 _stakersCount = stakers.length;
require(_startIndex < _stakersCount, 'Start index out of bounds');
uint256 endIndex = _startIndex + _limit > _stakersCount
? _stakersCount
: _startIndex + _limit;
address[] memory _stakerAddresses = new address[](
endIndex - _startIndex
);
Stakes.Staker[] memory _stakers = new Stakes.Staker[](
endIndex - _startIndex
);
for (uint256 i = _startIndex; i < endIndex; i++) {
_stakerAddresses[i - _startIndex] = stakers[i];
_stakers[i - _startIndex] = stakes[stakers[i]];
}
return (_stakerAddresses, _stakers);
}
/**
* @dev Deposit tokens on the staker stake.
* @param _tokens Amount of tokens to stake
*/
function stake(uint256 _tokens) external override {
require(_tokens > 0, 'Must be a positive number');
Stakes.Staker storage staker = stakes[msg.sender];
require(
staker.tokensAvailable() + _tokens >= minimumStake,
'Total stake is below the minimum threshold'
);
if (staker.tokensStaked == 0) {
stakers.push(msg.sender);
}
_safeTransferFrom(token, msg.sender, address(this), _tokens);
staker.deposit(_tokens);
emit StakeDeposited(msg.sender, _tokens);
}
/**
* @dev Unstake tokens from the staker's stake, locking them until lock period expires.
* @param _tokens Amount of tokens to unstake
*/
function unstake(uint256 _tokens) external override nonReentrant {
require(_tokens > 0, 'Must be a positive number');
Stakes.Staker storage staker = stakes[msg.sender];
require(
staker.tokensLocked == 0 ||
staker.tokensLockedUntil <= block.number,
'Unstake in progress, complete it first'
);
uint256 stakeAvailable = staker.tokensAvailable();
require(stakeAvailable >= _tokens, 'Insufficient amount to unstake');
uint256 tokensToWithdraw = staker.tokensWithdrawable();
if (tokensToWithdraw > 0) {
_withdraw(msg.sender);
}
staker.lockTokens(_tokens, lockPeriod);
emit StakeLocked(
msg.sender,
staker.tokensLocked,
staker.tokensLockedUntil
);
}
/**
* @dev Withdraw staker tokens once the lock period has passed.
*/
function withdraw() external override nonReentrant {
_withdraw(msg.sender);
}
function _withdraw(address _staker) private {
uint256 tokensToWithdraw = stakes[_staker].withdrawTokens();
require(
tokensToWithdraw > 0,
'Stake has no available tokens for withdrawal'
);
_safeTransfer(token, _staker, tokensToWithdraw);
emit StakeWithdrawn(_staker, tokensToWithdraw);
}
/**
* @dev Slash the staker's stake.
* @param _staker Address of staker to slash
* @param _escrowAddress Escrow address
* @param _tokens Amount of tokens to slash from the staker's stake
*/
function slash(
address _slashRequester,
address _staker,
address _escrowAddress,
uint256 _tokens
) external override onlySlasher nonReentrant {
require(
_slashRequester != address(0),
'Must be a valid slash requester address'
);
require(_escrowAddress != address(0), 'Must be a valid escrow address');
Stakes.Staker storage staker = stakes[_staker];
require(_tokens > 0, 'Must be a positive number');
require(
_tokens <= staker.tokensStaked,
'Slash amount exceeds staked amount'
);
uint256 feeAmount = (_tokens * feePercentage) / 100;
uint256 tokensToSlash = _tokens - feeAmount;
staker.release(tokensToSlash);
feeBalance += feeAmount;
_safeTransfer(token, _slashRequester, tokensToSlash);
emit StakeSlashed(
_staker,
tokensToSlash,
_escrowAddress,
_slashRequester
);
}
/**
* @dev Withdraw the total amount of fees accumulated.
*/
function withdrawFees() external override onlyOwner nonReentrant {
require(feeBalance > 0, 'No fees to withdraw');
uint256 amount = feeBalance;
feeBalance = 0;
_safeTransfer(token, msg.sender, amount);
emit FeeWithdrawn(amount);
}
/**
* @dev Add a new slasher address.
*/
function addSlasher(address _slasher) external override onlyOwner {
require(_slasher != address(0), 'Invalid slasher address');
require(!slashers[_slasher], 'Address is already a slasher');
slashers[_slasher] = true;
}
/**
* @dev Remove an existing slasher address.
*/
function removeSlasher(address _slasher) external override onlyOwner {
require(slashers[_slasher], 'Address is not a slasher');
delete slashers[_slasher];
}
modifier onlySlasher() {
require(slashers[msg.sender], 'Caller is not a slasher');
_;
}
/**
* @dev Safe transfer helper
*/
function _safeTransfer(
address _token,
address _to,
uint256 _value
) private {
SafeERC20.safeTransfer(IERC20(_token), _to, _value);
}
/**
* @dev Safe transferFrom helper
*/
function _safeTransferFrom(
address _token,
address _from,
address _to,
uint256 _value
) private {
SafeERC20.safeTransferFrom(IERC20(_token), _from, _to, _value);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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 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) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
interface HMTokenInterface {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
/// @param _owner The address from which the balance will be retrieved
/// @return balance The balance
function balanceOf(address _owner) external view returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return success Whether the transfer was successful or not
function transfer(
address _to,
uint256 _value
) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return success Whether the transfer was successful or not
function transferFrom(
address _from,
address _to,
uint256 _value
) external returns (bool success);
function transferBulk(
address[] calldata _tos,
uint256[] calldata _values,
uint256 _txId
) external returns (uint256 _bulkCount);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return success Whether the approval was successful or not
function approve(
address _spender,
uint256 _value
) external returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return remaining Amount of remaining tokens allowed to spent
function allowance(
address _owner,
address _spender
) external view returns (uint256 remaining);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IEscrow {
enum EscrowStatuses {
Launched,
Pending,
Partial,
Paid,
Complete,
Cancelled
}
function status() external view returns (EscrowStatuses);
function addTrustedHandlers(address[] memory _handlers) external;
function setup(
address _reputationOracle,
address _recordingOracle,
address _exchangeOracle,
uint8 _reputationOracleFeePercentage,
uint8 _recordingOracleFeePercentage,
uint8 _exchangeOracleFeePercentage,
string memory _url,
string memory _hash
) external;
function cancel() external returns (bool);
function withdraw(address _token) external returns (bool);
function complete() external;
function storeResults(string memory _url, string memory _hash) external;
function bulkPayOut(
address[] memory _recipients,
uint256[] memory _amounts,
string memory _url,
string memory _hash,
uint256 _txId,
bool forceComplete
) external;
function bulkPayOut(
address[] memory _recipients,
uint256[] memory _amounts,
string memory _url,
string memory _hash,
uint256 _txId
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '../libs/Stakes.sol';
interface IStaking {
function setMinimumStake(uint256 _minimumStake) external;
function setLockPeriod(uint32 _lockPeriod) external;
function getAvailableStake(address _staker) external view returns (uint256);
function getStakedTokens(address _staker) external view returns (uint256);
function stake(uint256 _tokens) external;
function unstake(uint256 _tokens) external;
function withdraw() external;
function slash(
address _slasher,
address _staker,
address _escrowAddress,
uint256 _tokens
) external;
function getListOfStakers(
uint256 _startIndex,
uint256 _limit
) external view returns (address[] memory, Stakes.Staker[] memory);
function withdrawFees() external;
function addSlasher(address _slasher) external;
function removeSlasher(address _slasher) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Structures, methods and data are available to manage the staker state.
*/
library Stakes {
struct Staker {
uint256 tokensStaked; // Tokens staked by the Staker
uint256 tokensLocked; // Tokens locked for withdrawal
uint256 tokensLockedUntil; // Tokens locked until time
}
/**
* @dev Deposit tokens to the staker stake.
* @param stake Staker struct
* @param _tokens Amount of tokens to deposit
*/
function deposit(Stakes.Staker storage stake, uint256 _tokens) internal {
stake.tokensStaked += _tokens;
}
/**
* @dev Release tokens from the staker stake.
* @param stake Staker struct
* @param _tokens Amount of tokens to release
*/
function release(Stakes.Staker storage stake, uint256 _tokens) internal {
stake.tokensStaked -= _tokens;
}
/**
* @dev Lock tokens until a lock period pass.
* @param stake Staker struct
* @param _tokens Amount of tokens to unstake
* @param _period Period in blocks that need to pass before withdrawal
*/
function lockTokens(
Stakes.Staker storage stake,
uint256 _tokens,
uint256 _period
) internal {
stake.tokensLocked += _tokens;
stake.tokensLockedUntil = block.number + _period;
}
/**
* @dev Unlock tokens.
* @param stake Staker struct
* @param _tokens Amount of tokens to unlock
*/
function unlockTokens(
Stakes.Staker storage stake,
uint256 _tokens
) internal {
stake.tokensLocked -= _tokens;
stake.tokensLockedUntil = 0;
}
/**
* @dev Return all tokens available for withdrawal.
* @param stake Staker struct
* @return Amount of tokens available for withdrawal
*/
function withdrawTokens(
Stakes.Staker storage stake
) internal returns (uint256) {
uint256 tokensToWithdraw = tokensWithdrawable(stake);
if (tokensToWithdraw > 0) {
unlockTokens(stake, tokensToWithdraw);
release(stake, tokensToWithdraw);
}
return tokensToWithdraw;
}
/**
* @dev Return all tokens available in stake.
* @param stake Staker struct
* @return Token amount
*/
function tokensAvailable(
Stakes.Staker memory stake
) internal pure returns (uint256) {
return stake.tokensStaked - stake.tokensLocked;
}
/**
* @dev Tokens available for withdrawal after lock period.
* @param stake Staker struct
* @return Token amount
*/
function tokensWithdrawable(
Stakes.Staker memory stake
) internal view returns (uint256) {
if (
stake.tokensLockedUntil == 0 ||
block.number < stake.tokensLockedUntil
) {
return 0;
}
return stake.tokensLocked;
}
}{
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 10
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_minimumStake","type":"uint256"},{"internalType":"uint32","name":"_lockPeriod","type":"uint32"},{"internalType":"uint8","name":"_feePercentage","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeeWithdrawn","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"StakeDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"until","type":"uint256"}],"name":"StakeLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"},{"indexed":true,"internalType":"address","name":"escrowAddress","type":"address"},{"indexed":false,"internalType":"address","name":"slashRequester","type":"address"}],"name":"StakeSlashed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"StakeWithdrawn","type":"event"},{"inputs":[{"internalType":"address","name":"_slasher","type":"address"}],"name":"addSlasher","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePercentage","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"}],"name":"getAvailableStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startIndex","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"getListOfStakers","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"components":[{"internalType":"uint256","name":"tokensStaked","type":"uint256"},{"internalType":"uint256","name":"tokensLocked","type":"uint256"},{"internalType":"uint256","name":"tokensLockedUntil","type":"uint256"}],"internalType":"struct Stakes.Staker[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"}],"name":"getStakedTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockPeriod","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_slasher","type":"address"}],"name":"removeSlasher","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_feePercentage","type":"uint8"}],"name":"setFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_lockPeriod","type":"uint32"}],"name":"setLockPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minimumStake","type":"uint256"}],"name":"setMinimumStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_slashRequester","type":"address"},{"internalType":"address","name":"_staker","type":"address"},{"internalType":"address","name":"_escrowAddress","type":"address"},{"internalType":"uint256","name":"_tokens","type":"uint256"}],"name":"slash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"slashers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokens","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakes","outputs":[{"internalType":"uint256","name":"tokensStaked","type":"uint256"},{"internalType":"uint256","name":"tokensLocked","type":"uint256"},{"internalType":"uint256","name":"tokensLockedUntil","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokens","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6080346200019857601f620015d238819003918201601f191683019291906001600160401b038411838510176200019d578160809284926040968752833981010312620001985780516001600160a01b0380821692909183900362000198576020810151848201519163ffffffff83168093036200019857606001519360ff851680950362000198573315620001805760008054336001600160a01b03198083168217845592969091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08780a3600180556002541617600255620000e6811515620001b3565b600355620000f6811515620001b3565b63ffffffff196004541617600455606482116200013c578260019160ff199384600754161760075533815260096020522091825416179055516113d19081620002018239f35b825162461bcd60e51b815260206004820152601660248201527f4665652063616e6e6f74206578636565642031303025000000000000000000006044820152606490fd5b8551631e4fbdf760e01b815260006004820152602490fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b15620001bb57565b60405162461bcd60e51b815260206004820152601960248201527f4d757374206265206120706f736974697665206e756d626572000000000000006044820152606490fdfe6040608081526004908136101561001557600080fd5b600091823560e01c806314f6b19014610ec357806316934fc414610e75578063233e990314610e485780632e17de7814610cca5780633aa63c6114610a825780633ccfd60b14610a595780633fd8b02f14610a35578063476343ee1461098557806360b71d4e1461096657806363c28db11461092e57806368a9f19c14610852578063715018a61461080a5780638da5cb5b146107e2578063a001ecdd146107c0578063a5766aa614610740578063a694fc3a14610598578063aac6aa9c14610503578063b87fcbff146104c5578063ec5ffac2146104a6578063f2fde38b14610432578063f489f23b146103ed578063fc0c546a146103c0578063fd5e6dd11461037d5763ff07751d1461012957600080fd5b34610379578160031936011261037957803590602435600654918284101561033a5750816101578285611046565b1115610328575091905b61016b8184611023565b9261018d61017885611053565b9461018585519687610f90565b808652611053565b9260209182860193601f198096013686376101a88183611023565b956101ca6101b588611053565b976101c28651998a610f90565b808952611053565b01885b8181106102f4575050805b82811061026c575050508051948186019082875251809152606090606087019490885b81811061024f5750505085840383870152828086519586815201950196915b8483106102275786860387f35b875180518752808501518786015281015186820152968301969481019460019092019161021a565b82516001600160a01b0316875295850195918501916001016101fb565b806102806001929a9697989a999599610f2e565b838060a01b03809254600392831b1c166102a361029d8786611023565b8961106a565b526102ad83610f2e565b9054911b1c168652600587526102e56102d88b6102de8c8a206102d08887611023565b938491610fb3565b9261106a565b528b61106a565b500197959493979692966101d8565b9480969799958599955161030781610f5f565b8781528783820152878b82015282828d0101520198969594989793976101cd565b610333915082611046565b9190610161565b606490602086519162461bcd60e51b83528201526019602482015278537461727420696e646578206f7574206f6620626f756e647360381b6044820152fd5b8280fd5b50346103795760203660031901126103795735916006548310156103bd57506103a7602092610f2e565b905491519160018060a01b039160031b1c168152f35b80fd5b5050346103e957816003193601126103e95760025490516001600160a01b039091168152602090f35b5080fd5b8382346103e95760203660031901126103e957803563ffffffff81168091036103795761041861107e565b610423811515610fdb565b815463ffffffff191617905580f35b50346103795760203660031901126103795761044c610f13565b9061045561107e565b6001600160a01b0391821692831561049057505082546001600160a01b03198116831784551660008051602061137c8339815191528380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b5050346103e957816003193601126103e9576020906003549051908152f35b5050346103e95760203660031901126103e95760209160ff9082906001600160a01b036104f0610f13565b1681526009855220541690519015158152f35b50346103795760203660031901126103795761051d610f13565b61052561107e565b6001600160a01b031680845260096020528284205490919060ff161561055a5750825260096020528120805460ff1916905580f35b606490602084519162461bcd60e51b8352820152601860248201527720b2323932b9b99034b9903737ba10309039b630b9b432b960411b6044820152fd5b509190346103e957602080600319360112610379578335916105bb831515610fdb565b338452600582528084206105e6846105e16105d584610fb3565b86815191015190611023565b611046565b600354116106ea57805415610697575b60025482516323b872dd60e01b8582015233602482015230604482015260648082018790528152906001600160a01b031660a082016001600160401b038111838210176106845784527f0a7bb2e28cc4698aac06db79cf9163bfcc20719286cf59fa7d492ceda1b8edc29493929161066d91611245565b610678858254611046565b9055519283523392a280f35b634e487b7160e01b885260418952602488fd5b600654600160401b8110156106d7578060016106b69201600655610f2e565b81546001600160a01b0360039290921b91821b19163390911b1790556105f6565b634e487b7160e01b865260418752602486fd5b815162461bcd60e51b8152808701849052602a60248201527f546f74616c207374616b652069732062656c6f7720746865206d696e696d756d604482015269081d1a1c995cda1bdb1960b21b6064820152608490fd5b50346103795760203660031901126103795780359160ff83168093036107bc5761076861107e565b6064831161078057505060ff19600754161760075580f35b906020606492519162461bcd60e51b835282015260166024820152754665652063616e6e6f7420657863656564203130302560501b6044820152fd5b8380fd5b5050346103e957816003193601126103e95760209060ff600754169051908152f35b5050346103e957816003193601126103e957905490516001600160a01b039091168152602090f35b83346103bd57806003193601126103bd5761082361107e565b80546001600160a01b03198116825581906001600160a01b031660008051602061137c8339815191528280a380f35b50346103795760203660031901126103795761086c610f13565b61087461107e565b6001600160a01b03169081156108f157818452600960205260ff83852054166108af5750825260096020528120805460ff1916600117905580f35b606490602084519162461bcd60e51b8352820152601c60248201527b20b2323932b9b99034b99030b63932b0b23c90309039b630b9b432b960211b6044820152fd5b606490602084519162461bcd60e51b83528201526017602482015276496e76616c696420736c6173686572206164647265737360481b6044820152fd5b5050346103e95760203660031901126103e95760209181906001600160a01b03610956610f13565b1681526005845220549051908152f35b5050346103e957816003193601126103e9576020906008549051908152f35b50903461037957826003193601126103795761099f61107e565b6109a76110aa565b6008549182156109fd57507fb7eeacba6b133788365610e83d3f130d07b6ef6e78877961f25b3f61fcba075291602091846008556109f18260018060a01b036002541633906111f1565b51908152a16001805580f35b6020606492519162461bcd60e51b835282015260136024820152724e6f206665657320746f20776974686472617760681b6044820152fd5b5091346103bd57806003193601126103bd575063ffffffff60209254169051908152f35b83346103bd57806003193601126103bd57610a726110aa565b610a7b336110f8565b6001805580f35b503461037957608036600319011261037957610a9c610f13565b916001600160a01b03602480358281169490859003610cc65760443595838716809703610cc2576064938435338a526020946009865260ff888c20541615610c8857610ae66110aa565b828416968715610c38578a15610bf957898c5260058752888c2091831590610b0e8215610fdb565b835497888611610bae5760ff600754169283870293878504141715610b9d5750507f71a8c830f4b619fc8248691f28f33646d6d9553a9fe6f7ba80e179fd391779ba99989693610b77989693610b6e610b8d9794610b8194048093611023565b998a8097611023565b9055600854611046565b600855600254166111f1565b8351928352820152a36001805580f35b634e487b7160e01b8f52601190528dfd5b611b9d60f21b8460226084948f8e90519562461bcd60e51b87528601528401527f536c61736820616d6f756e742065786365656473207374616b656420616d6f756044840152820152fd5b885162461bcd60e51b8152808701889052601e818401527f4d75737420626520612076616c696420657363726f77206164647265737300006044820152fd5b666164647265737360c81b869160276084948a8d519562461bcd60e51b87528601528401527f4d75737420626520612076616c696420736c61736820726571756573746572206044840152820152fd5b8460178892888b519362461bcd60e51b85528401528201527621b0b63632b91034b9903737ba10309039b630b9b432b960491b6044820152fd5b8780fd5b8680fd5b509034610379576020806003193601126107bc578235610ce86110aa565b610cf3811515610fdb565b338552600582528285209060018201948554158015610e3a575b15610de85781610d1f6105d585610fb3565b10610da55791610d807fa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01959492610d7763ffffffff600296610d68610d6387610fb3565b6110cd565b610d97575b5416918954611046565b80985543611046565b928391015582519485528401523392a26001805580f35b610da0336110f8565b610d6d565b845162461bcd60e51b8152908101849052601e60248201527f496e73756666696369656e7420616d6f756e7420746f20756e7374616b6500006044820152606490fd5b845162461bcd60e51b8152908101849052602660248201527f556e7374616b6520696e2070726f67726573732c20636f6d706c65746520697460448201526508199a5c9cdd60d21b6064820152608490fd5b506002830154431015610d0d565b8382346103e95760203660031901126103e95735610e6461107e565b610e6f811515610fdb565b60035580f35b5050346103e95760203660031901126103e95760609181906001600160a01b03610e9d610f13565b168152600560205220805491600260018301549201549181519384526020840152820152f35b5050346103e95760203660031901126103e957602091610f0c90610f009083906001600160a01b03610ef3610f13565b1681526005865220610fb3565b83815191015190611023565b9051908152f35b600435906001600160a01b0382168203610f2957565b600080fd5b600654811015610f4957600660005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b606081019081106001600160401b03821117610f7a57604052565b634e487b7160e01b600052604160045260246000fd5b601f909101601f19168101906001600160401b03821190821017610f7a57604052565b90604051610fc081610f5f565b60406002829480548452600181015460208501520154910152565b15610fe257565b60405162461bcd60e51b815260206004820152601960248201527826bab9ba1031329030903837b9b4ba34bb3290373ab6b132b960391b6044820152606490fd5b9190820391821161103057565b634e487b7160e01b600052601160045260246000fd5b9190820180921161103057565b6001600160401b038111610f7a5760051b60200190565b8051821015610f495760209160051b010190565b6000546001600160a01b0316330361109257565b60405163118cdaa760e01b8152336004820152602490fd5b6002600154146110bb576002600155565b604051633ee5aeb560e01b8152600490fd5b604081015180159081156110ee575b506110e8576020015190565b50600090565b90504310386110dc565b6001600160a01b03818116600081815260056020526040902090929190611121610d6382610fb3565b9081159081156111c6575b5061116c57611163817f8108595eb6bad3acefa9da467d90cc2217686d5c5ac85460f8b7849c840645fc94602094600254166111f1565b604051908152a2565b60405162461bcd60e51b815260206004820152602c60248201527f5374616b6520686173206e6f20617661696c61626c6520746f6b656e7320666f60448201526b1c881dda5d1a191c985dd85b60a21b6064820152608490fd5b600181016111d5848254611023565b9055600060028201556111e9838254611023565b90553861112c565b60405163a9059cbb60e01b60208201526001600160a01b039283166024820152604480820194909452928352608083019291906001600160401b03841183851017610f7a576112439360405216611245565b565b60018060a01b031690600080826020829451910182865af13d1561130c573d906001600160401b0382116112f857906112a091604051916112906020601f19601f8401160184610f90565b82523d84602084013e5b84611318565b9081519182151592836112d0575b5050506112b85750565b60249060405190635274afe760e01b82526004820152fd5b8192935090602091810103126103e95760200151908115918215036103bd57503880806112ae565b634e487b7160e01b83526041600452602483fd5b6112a09060609061129a565b9061133f575080511561132d57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580611372575b611350575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561134856fe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a26469706673582212209725f3baabd14c4d275ce4c63bf6a2b5e1187b065afa87071f73cee68fce4e5564736f6c63430008170033000000000000000000000000d1ba9bac957322d6e8c07a160a3a8da11a0d2867000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x6040608081526004908136101561001557600080fd5b600091823560e01c806314f6b19014610ec357806316934fc414610e75578063233e990314610e485780632e17de7814610cca5780633aa63c6114610a825780633ccfd60b14610a595780633fd8b02f14610a35578063476343ee1461098557806360b71d4e1461096657806363c28db11461092e57806368a9f19c14610852578063715018a61461080a5780638da5cb5b146107e2578063a001ecdd146107c0578063a5766aa614610740578063a694fc3a14610598578063aac6aa9c14610503578063b87fcbff146104c5578063ec5ffac2146104a6578063f2fde38b14610432578063f489f23b146103ed578063fc0c546a146103c0578063fd5e6dd11461037d5763ff07751d1461012957600080fd5b34610379578160031936011261037957803590602435600654918284101561033a5750816101578285611046565b1115610328575091905b61016b8184611023565b9261018d61017885611053565b9461018585519687610f90565b808652611053565b9260209182860193601f198096013686376101a88183611023565b956101ca6101b588611053565b976101c28651998a610f90565b808952611053565b01885b8181106102f4575050805b82811061026c575050508051948186019082875251809152606090606087019490885b81811061024f5750505085840383870152828086519586815201950196915b8483106102275786860387f35b875180518752808501518786015281015186820152968301969481019460019092019161021a565b82516001600160a01b0316875295850195918501916001016101fb565b806102806001929a9697989a999599610f2e565b838060a01b03809254600392831b1c166102a361029d8786611023565b8961106a565b526102ad83610f2e565b9054911b1c168652600587526102e56102d88b6102de8c8a206102d08887611023565b938491610fb3565b9261106a565b528b61106a565b500197959493979692966101d8565b9480969799958599955161030781610f5f565b8781528783820152878b82015282828d0101520198969594989793976101cd565b610333915082611046565b9190610161565b606490602086519162461bcd60e51b83528201526019602482015278537461727420696e646578206f7574206f6620626f756e647360381b6044820152fd5b8280fd5b50346103795760203660031901126103795735916006548310156103bd57506103a7602092610f2e565b905491519160018060a01b039160031b1c168152f35b80fd5b5050346103e957816003193601126103e95760025490516001600160a01b039091168152602090f35b5080fd5b8382346103e95760203660031901126103e957803563ffffffff81168091036103795761041861107e565b610423811515610fdb565b815463ffffffff191617905580f35b50346103795760203660031901126103795761044c610f13565b9061045561107e565b6001600160a01b0391821692831561049057505082546001600160a01b03198116831784551660008051602061137c8339815191528380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b5050346103e957816003193601126103e9576020906003549051908152f35b5050346103e95760203660031901126103e95760209160ff9082906001600160a01b036104f0610f13565b1681526009855220541690519015158152f35b50346103795760203660031901126103795761051d610f13565b61052561107e565b6001600160a01b031680845260096020528284205490919060ff161561055a5750825260096020528120805460ff1916905580f35b606490602084519162461bcd60e51b8352820152601860248201527720b2323932b9b99034b9903737ba10309039b630b9b432b960411b6044820152fd5b509190346103e957602080600319360112610379578335916105bb831515610fdb565b338452600582528084206105e6846105e16105d584610fb3565b86815191015190611023565b611046565b600354116106ea57805415610697575b60025482516323b872dd60e01b8582015233602482015230604482015260648082018790528152906001600160a01b031660a082016001600160401b038111838210176106845784527f0a7bb2e28cc4698aac06db79cf9163bfcc20719286cf59fa7d492ceda1b8edc29493929161066d91611245565b610678858254611046565b9055519283523392a280f35b634e487b7160e01b885260418952602488fd5b600654600160401b8110156106d7578060016106b69201600655610f2e565b81546001600160a01b0360039290921b91821b19163390911b1790556105f6565b634e487b7160e01b865260418752602486fd5b815162461bcd60e51b8152808701849052602a60248201527f546f74616c207374616b652069732062656c6f7720746865206d696e696d756d604482015269081d1a1c995cda1bdb1960b21b6064820152608490fd5b50346103795760203660031901126103795780359160ff83168093036107bc5761076861107e565b6064831161078057505060ff19600754161760075580f35b906020606492519162461bcd60e51b835282015260166024820152754665652063616e6e6f7420657863656564203130302560501b6044820152fd5b8380fd5b5050346103e957816003193601126103e95760209060ff600754169051908152f35b5050346103e957816003193601126103e957905490516001600160a01b039091168152602090f35b83346103bd57806003193601126103bd5761082361107e565b80546001600160a01b03198116825581906001600160a01b031660008051602061137c8339815191528280a380f35b50346103795760203660031901126103795761086c610f13565b61087461107e565b6001600160a01b03169081156108f157818452600960205260ff83852054166108af5750825260096020528120805460ff1916600117905580f35b606490602084519162461bcd60e51b8352820152601c60248201527b20b2323932b9b99034b99030b63932b0b23c90309039b630b9b432b960211b6044820152fd5b606490602084519162461bcd60e51b83528201526017602482015276496e76616c696420736c6173686572206164647265737360481b6044820152fd5b5050346103e95760203660031901126103e95760209181906001600160a01b03610956610f13565b1681526005845220549051908152f35b5050346103e957816003193601126103e9576020906008549051908152f35b50903461037957826003193601126103795761099f61107e565b6109a76110aa565b6008549182156109fd57507fb7eeacba6b133788365610e83d3f130d07b6ef6e78877961f25b3f61fcba075291602091846008556109f18260018060a01b036002541633906111f1565b51908152a16001805580f35b6020606492519162461bcd60e51b835282015260136024820152724e6f206665657320746f20776974686472617760681b6044820152fd5b5091346103bd57806003193601126103bd575063ffffffff60209254169051908152f35b83346103bd57806003193601126103bd57610a726110aa565b610a7b336110f8565b6001805580f35b503461037957608036600319011261037957610a9c610f13565b916001600160a01b03602480358281169490859003610cc65760443595838716809703610cc2576064938435338a526020946009865260ff888c20541615610c8857610ae66110aa565b828416968715610c38578a15610bf957898c5260058752888c2091831590610b0e8215610fdb565b835497888611610bae5760ff600754169283870293878504141715610b9d5750507f71a8c830f4b619fc8248691f28f33646d6d9553a9fe6f7ba80e179fd391779ba99989693610b77989693610b6e610b8d9794610b8194048093611023565b998a8097611023565b9055600854611046565b600855600254166111f1565b8351928352820152a36001805580f35b634e487b7160e01b8f52601190528dfd5b611b9d60f21b8460226084948f8e90519562461bcd60e51b87528601528401527f536c61736820616d6f756e742065786365656473207374616b656420616d6f756044840152820152fd5b885162461bcd60e51b8152808701889052601e818401527f4d75737420626520612076616c696420657363726f77206164647265737300006044820152fd5b666164647265737360c81b869160276084948a8d519562461bcd60e51b87528601528401527f4d75737420626520612076616c696420736c61736820726571756573746572206044840152820152fd5b8460178892888b519362461bcd60e51b85528401528201527621b0b63632b91034b9903737ba10309039b630b9b432b960491b6044820152fd5b8780fd5b8680fd5b509034610379576020806003193601126107bc578235610ce86110aa565b610cf3811515610fdb565b338552600582528285209060018201948554158015610e3a575b15610de85781610d1f6105d585610fb3565b10610da55791610d807fa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01959492610d7763ffffffff600296610d68610d6387610fb3565b6110cd565b610d97575b5416918954611046565b80985543611046565b928391015582519485528401523392a26001805580f35b610da0336110f8565b610d6d565b845162461bcd60e51b8152908101849052601e60248201527f496e73756666696369656e7420616d6f756e7420746f20756e7374616b6500006044820152606490fd5b845162461bcd60e51b8152908101849052602660248201527f556e7374616b6520696e2070726f67726573732c20636f6d706c65746520697460448201526508199a5c9cdd60d21b6064820152608490fd5b506002830154431015610d0d565b8382346103e95760203660031901126103e95735610e6461107e565b610e6f811515610fdb565b60035580f35b5050346103e95760203660031901126103e95760609181906001600160a01b03610e9d610f13565b168152600560205220805491600260018301549201549181519384526020840152820152f35b5050346103e95760203660031901126103e957602091610f0c90610f009083906001600160a01b03610ef3610f13565b1681526005865220610fb3565b83815191015190611023565b9051908152f35b600435906001600160a01b0382168203610f2957565b600080fd5b600654811015610f4957600660005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b606081019081106001600160401b03821117610f7a57604052565b634e487b7160e01b600052604160045260246000fd5b601f909101601f19168101906001600160401b03821190821017610f7a57604052565b90604051610fc081610f5f565b60406002829480548452600181015460208501520154910152565b15610fe257565b60405162461bcd60e51b815260206004820152601960248201527826bab9ba1031329030903837b9b4ba34bb3290373ab6b132b960391b6044820152606490fd5b9190820391821161103057565b634e487b7160e01b600052601160045260246000fd5b9190820180921161103057565b6001600160401b038111610f7a5760051b60200190565b8051821015610f495760209160051b010190565b6000546001600160a01b0316330361109257565b60405163118cdaa760e01b8152336004820152602490fd5b6002600154146110bb576002600155565b604051633ee5aeb560e01b8152600490fd5b604081015180159081156110ee575b506110e8576020015190565b50600090565b90504310386110dc565b6001600160a01b03818116600081815260056020526040902090929190611121610d6382610fb3565b9081159081156111c6575b5061116c57611163817f8108595eb6bad3acefa9da467d90cc2217686d5c5ac85460f8b7849c840645fc94602094600254166111f1565b604051908152a2565b60405162461bcd60e51b815260206004820152602c60248201527f5374616b6520686173206e6f20617661696c61626c6520746f6b656e7320666f60448201526b1c881dda5d1a191c985dd85b60a21b6064820152608490fd5b600181016111d5848254611023565b9055600060028201556111e9838254611023565b90553861112c565b60405163a9059cbb60e01b60208201526001600160a01b039283166024820152604480820194909452928352608083019291906001600160401b03841183851017610f7a576112439360405216611245565b565b60018060a01b031690600080826020829451910182865af13d1561130c573d906001600160401b0382116112f857906112a091604051916112906020601f19601f8401160184610f90565b82523d84602084013e5b84611318565b9081519182151592836112d0575b5050506112b85750565b60249060405190635274afe760e01b82526004820152fd5b8192935090602091810103126103e95760200151908115918215036103bd57503880806112ae565b634e487b7160e01b83526041600452602483fd5b6112a09060609061129a565b9061133f575080511561132d57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580611372575b611350575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561134856fe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a26469706673582212209725f3baabd14c4d275ce4c63bf6a2b5e1187b065afa87071f73cee68fce4e5564736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d1ba9bac957322d6e8c07a160a3a8da11a0d2867000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _token (address): 0xd1ba9BAC957322D6e8c07a160a3A8dA11A0d2867
Arg [1] : _minimumStake (uint256): 1
Arg [2] : _lockPeriod (uint32): 1000
Arg [3] : _feePercentage (uint8): 1
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000d1ba9bac957322d6e8c07a160a3a8da11a0d2867
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [2] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Net Worth in USD
$11.47
Net Worth in ETH
0.005919
Token Allocations
HMT
100.00%
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 100.00% | $0.004882 | 2,349.21 | $11.47 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.