Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
HelthVault
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
interface IDankToken {
function mint(address to, uint256 amount) external;
function totalSupply() external view returns (uint256);
function transferUnderlying(address to, uint256 value) external returns (bool);
function fragmentToDank(uint256 value) external view returns (uint256);
function dankToFragment(uint256 dank) external view returns (uint256);
function balanceOfUnderlying(address who) external view returns (uint256);
function burn(uint256 amount) external;
}
interface IKalmToken {
function mint(address to, uint256 amount) external;
function totalSupply() external view returns (uint256);
}
contract HelthVault is Ownable {
using SafeERC20 for IERC20;
struct UserInfo {
uint256 amount;
uint256 lockEndedTimestamp;
uint256 lockStartTimestamp;
}
struct PoolInfo {
uint256 total;
uint256 duration;
uint256 kalmScalingFactor; // Used to calculate fraction of locked to $KALM rewards. 1,000,000 = 1:1
}
IDankToken public dank;
IKalmToken public kalm;
uint256 public total;
bool public depositsEnabled;
// {duration: {address: UserInfo}}
mapping(uint256 => mapping(address => UserInfo)) public userInfo;
PoolInfo[] public poolInfo;
// Events
event Deposit(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event LogSetLockDuration(uint256 duration);
event LogSetDepositsEnabled(bool enabled);
event LogPoolAddition(uint256 indexed pid, uint256 rate, uint256 duration);
event SetKalmAddress(IKalmToken kalmAddress);
event RewardPaid(address indexed user, uint256 indexed pid, uint256 amount);
constructor(IDankToken _dank, bool _depositsEnabled) {
dank = _dank;
depositsEnabled = _depositsEnabled;
}
/// @notice onlyOwner - enables Kalm rewards by setting address
function setKalmAddress(IKalmToken _address) external onlyOwner {
kalm = _address;
emit SetKalmAddress(_address);
}
/// @notice onlyOwner - enables Kalm rewards by setting address
function addVault(uint256 _duration, uint256 _rewardRate) external onlyOwner {
poolInfo.push(PoolInfo({
total: 0,
kalmScalingFactor: _rewardRate,
duration: _duration
}));
emit LogPoolAddition(poolInfo.length - 1, _rewardRate, _duration);
}
/// @notice onlyOwner - set new kalm reward rate
function updateRewardRate(uint256 _pid, uint256 _rewardRate) external onlyOwner {
PoolInfo storage pool = poolInfo[_pid];
pool.kalmScalingFactor = _rewardRate;
}
/// @notice onlyOwner - set new kalm reward rate
function setDepositsEnabled() external onlyOwner {
require(!depositsEnabled, "deposits already enabled");
depositsEnabled = true;
emit LogSetDepositsEnabled(true);
}
function deposit(uint256 _pid, uint256 _amount) external {
require(depositsEnabled, "deposits not enabled yet");
require(_amount > 0, "invalid amount");
PoolInfo storage pool = poolInfo[_pid];
require(pool.duration > 0, "invalid pool index");
UserInfo storage user = userInfo[_pid][msg.sender];
user.lockEndedTimestamp = block.timestamp + pool.duration;
user.lockStartTimestamp = block.timestamp;
IERC20(address(dank)).safeTransferFrom(address(msg.sender), address(this), _amount);
dank.burn(_amount);
total += _amount;
user.amount += _amount;
pool.total += _amount;
emit Deposit(msg.sender, _amount);
}
function withdraw(uint256 _pid, uint256 _amount) external {
require(_amount > 0, "invalid amount");
PoolInfo storage pool = poolInfo[_pid];
require(pool.kalmScalingFactor > 0, "invalid duration");
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.lockEndedTimestamp <= block.timestamp, "still locked");
require(user.amount >= _amount, "invalid amount");
total -= _amount;
user.amount -= _amount;
pool.total -= _amount;
user.lockEndedTimestamp = block.timestamp + pool.duration;
dank.mint(address(msg.sender), _amount);
claim(_pid);
emit Withdraw(msg.sender, _amount);
}
/// @notice - claim all available $KALM rewards
function claim(uint256 _pid) public {
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= 0, "nothing locked");
uint256 rewards = pendingRewards(_pid, address(msg.sender));
user.lockEndedTimestamp = block.timestamp + poolInfo[_pid].duration;
user.lockStartTimestamp = block.timestamp;
if (rewards > 0) {
kalm.mint(address(msg.sender), rewards);
emit RewardPaid(msg.sender, _pid, rewards);
}
}
/// @notice - kalm rewards only accumulate until end of lock period
/// @notice - need to claim to reset kalm accumulation
function pendingRewards(uint256 _pid, address _address)
public
view
returns (uint256) {
if (address(kalm) == address(0)) {
// kalm rewards not enabled yet
return 0;
}
UserInfo memory user = userInfo[_pid][_address];
if (user.amount == 0) {
return 0;
}
if (block.timestamp > user.lockEndedTimestamp) {
// maximum rewards
return (user.amount * poolInfo[_pid].kalmScalingFactor) / 1e6;
}
return (
user.amount
* poolInfo[_pid].kalmScalingFactor
* (block.timestamp - user.lockStartTimestamp)
) / (poolInfo[_pid].duration * 1e6);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^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() {
_transferOwnership(_msgSender());
}
/**
* @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 {
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 {
_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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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 v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^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 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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "london",
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IDankToken","name":"_dank","type":"address"},{"internalType":"bool","name":"_depositsEnabled","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"LogPoolAddition","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"LogSetDepositsEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"LogSetLockDuration","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":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IKalmToken","name":"kalmAddress","type":"address"}],"name":"SetKalmAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"uint256","name":"_rewardRate","type":"uint256"}],"name":"addVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dank","outputs":[{"internalType":"contract IDankToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositsEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kalm","outputs":[{"internalType":"contract IKalmToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_address","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"kalmScalingFactor","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setDepositsEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IKalmToken","name":"_address","type":"address"}],"name":"setKalmAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"total","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_rewardRate","type":"uint256"}],"name":"updateRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"lockEndedTimestamp","type":"uint256"},{"internalType":"uint256","name":"lockStartTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b506040516112d83803806112d883398101604081905261002f916100bf565b6100383361006f565b600180546001600160a01b0319166001600160a01b0393909316929092179091556004805460ff191691151591909117905561010a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100d257600080fd5b82516001600160a01b03811681146100e957600080fd5b602084015190925080151581146100ff57600080fd5b809150509250929050565b6111bf806101196000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80638da5cb5b116100a2578063b32534cf11610071578063b32534cf14610247578063ccc08ea91461025a578063d18df53c1461026d578063e2bbb15814610280578063f2fde38b1461029357600080fd5b80638da5cb5b146101c25780639293dbf5146101e757806393f1a40b146101fa5780639a81f4c11461023457600080fd5b8063470ea1d4116100de578063470ea1d4146101825780635392fd1c1461018a5780635ab4416e146101a7578063715018a6146101ba57600080fd5b80631526fe27146101105780632ddbd13a14610143578063379607f51461015a578063441a3e701461016f575b600080fd5b61012361011e366004610f84565b6102a6565b604080519384526020840192909252908201526060015b60405180910390f35b61014c60035481565b60405190815260200161013a565b61016d610168366004610f84565b6102d9565b005b61016d61017d366004610f9d565b6103f0565b61016d610601565b6004546101979060ff1681565b604051901515815260200161013a565b61016d6101b5366004610f9d565b6106a1565b61016d610798565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161013a565b6002546101cf906001600160a01b031681565b610123610208366004610fd4565b600560209081526000928352604080842090915290825290208054600182015460029092015490919083565b61016d610242366004611004565b6107ac565b61016d610255366004610f9d565b610808565b6001546101cf906001600160a01b031681565b61014c61027b366004610fd4565b610840565b61016d61028e366004610f9d565b61099c565b61016d6102a1366004611004565b610ba2565b600681815481106102b657600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b60008181526005602090815260408083203384529091529020610300565b60405180910390fd5b600061030c8333610840565b90506006838154811061032157610321611028565b9060005260206000209060030201600101544261033e9190611054565b600183015542600283015580156103eb576002546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561039b57600080fd5b505af11580156103af573d6000803e3d6000fd5b50506040518381528592503391507fd6f2c8500df5b44f11e9e48b91ff9f1b9d81bc496d55570c2b1b75bf65243f519060200160405180910390a35b505050565b600081116104105760405162461bcd60e51b81526004016102f79061106c565b60006006838154811061042557610425611028565b90600052602060002090600302019050600081600201541161047c5760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b210323ab930ba34b7b760811b60448201526064016102f7565b6000838152600560209081526040808320338452909152902060018101544210156104d85760405162461bcd60e51b815260206004820152600c60248201526b1cdd1a5b1b081b1bd8dad95960a21b60448201526064016102f7565b80548311156104f95760405162461bcd60e51b81526004016102f79061106c565b826003600082825461050b9190611094565b9091555050805483908290600090610524908490611094565b909155505081548390839060009061053d908490611094565b909155505060018201546105519042611054565b600182810191909155546040516340c10f1960e01b8152336004820152602481018590526001600160a01b03909116906340c10f1990604401600060405180830381600087803b1580156105a457600080fd5b505af11580156105b8573d6000803e3d6000fd5b505050506105c5846102d9565b60405183815233907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364906020015b60405180910390a250505050565b610609610c1b565b60045460ff161561065c5760405162461bcd60e51b815260206004820152601860248201527f6465706f7369747320616c726561647920656e61626c6564000000000000000060448201526064016102f7565b6004805460ff191660019081179091556040519081527f415447f74696881c5449538f07d24542d1f37bc3ffaacd1095313e14d7b9ce489060200160405180910390a1565b6106a9610c1b565b6040805160608101825260008082526020820185815292820184815260068054600180820183559382905293517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f60039095029485015593517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d40840155517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4190920191909155905461075b9190611094565b60408051838152602081018590527f6c4c213503cfebbee51c17202ac8c98b88342f0789373eec423946146f5fa911910160405180910390a25050565b6107a0610c1b565b6107aa6000610c75565b565b6107b4610c1b565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f1762611dedb914f78a6866bff4f14860ee39a485122e7886a1890e85300cd08a9060200160405180910390a150565b610810610c1b565b60006006838154811061082557610825611028565b60009182526020909120600260039092020101919091555050565b6002546000906001600160a01b031661085b57506000610996565b60008381526005602090815260408083206001600160a01b038616845282529182902082516060810184528154808252600183015493820193909352600290910154928101929092526108b2576000915050610996565b806020015142111561090857620f4240600685815481106108d5576108d5611028565b90600052602060002090600302016002015482600001516108f691906110ab565b61090091906110ca565b915050610996565b6006848154811061091b5761091b611028565b906000526020600020906003020160010154620f424061093b91906110ab565b604082015161094a9042611094565b6006868154811061095d5761095d611028565b906000526020600020906003020160020154836000015161097e91906110ab565b61098891906110ab565b61099291906110ca565b9150505b92915050565b60045460ff166109ee5760405162461bcd60e51b815260206004820152601860248201527f6465706f73697473206e6f7420656e61626c656420796574000000000000000060448201526064016102f7565b60008111610a0e5760405162461bcd60e51b81526004016102f79061106c565b600060068381548110610a2357610a23611028565b906000526020600020906003020190506000816001015411610a7c5760405162461bcd60e51b81526020600482015260126024820152710d2dcecc2d8d2c840e0deded840d2dcc8caf60731b60448201526064016102f7565b600083815260056020908152604080832033845290915290206001820154610aa49042611054565b60018083019190915542600283015554610ac9906001600160a01b0316333086610cc5565b600154604051630852cd8d60e31b8152600481018590526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610b0f57600080fd5b505af1158015610b23573d6000803e3d6000fd5b505050508260036000828254610b399190611054565b9091555050805483908290600090610b52908490611054565b9091555050815483908390600090610b6b908490611054565b909155505060405183815233907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c906020016105f3565b610baa610c1b565b6001600160a01b038116610c0f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f7565b610c1881610c75565b50565b6000546001600160a01b031633146107aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102f7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610d1f908590610d25565b50505050565b6000610d7a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610df79092919063ffffffff16565b8051909150156103eb5780806020019051810190610d9891906110ec565b6103eb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102f7565b6060610e068484600085610e0e565b949350505050565b606082471015610e6f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016102f7565b600080866001600160a01b03168587604051610e8b919061113a565b60006040518083038185875af1925050503d8060008114610ec8576040519150601f19603f3d011682016040523d82523d6000602084013e610ecd565b606091505b5091509150610ede87838387610ee9565b979650505050505050565b60608315610f55578251610f4e576001600160a01b0385163b610f4e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102f7565b5081610e06565b610e068383815115610f6a5781518083602001fd5b8060405162461bcd60e51b81526004016102f79190611156565b600060208284031215610f9657600080fd5b5035919050565b60008060408385031215610fb057600080fd5b50508035926020909101359150565b6001600160a01b0381168114610c1857600080fd5b60008060408385031215610fe757600080fd5b823591506020830135610ff981610fbf565b809150509250929050565b60006020828403121561101657600080fd5b813561102181610fbf565b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156110675761106761103e565b500190565b6020808252600e908201526d1a5b9d985b1a5908185b5bdd5b9d60921b604082015260600190565b6000828210156110a6576110a661103e565b500390565b60008160001904831182151516156110c5576110c561103e565b500290565b6000826110e757634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156110fe57600080fd5b8151801515811461102157600080fd5b60005b83811015611129578181015183820152602001611111565b83811115610d1f5750506000910152565b6000825161114c81846020870161110e565b9190910192915050565b602081526000825180602084015261117581604085016020870161110e565b601f01601f1916919091016040019291505056fea26469706673582212204f780b9500c28dfb7fc60da4e1babc91fa51048083c4b18ce793d02999d0145664736f6c634300080900330000000000000000000000005f419a278a06381a47972b1f1c8b6803c941cc990000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80638da5cb5b116100a2578063b32534cf11610071578063b32534cf14610247578063ccc08ea91461025a578063d18df53c1461026d578063e2bbb15814610280578063f2fde38b1461029357600080fd5b80638da5cb5b146101c25780639293dbf5146101e757806393f1a40b146101fa5780639a81f4c11461023457600080fd5b8063470ea1d4116100de578063470ea1d4146101825780635392fd1c1461018a5780635ab4416e146101a7578063715018a6146101ba57600080fd5b80631526fe27146101105780632ddbd13a14610143578063379607f51461015a578063441a3e701461016f575b600080fd5b61012361011e366004610f84565b6102a6565b604080519384526020840192909252908201526060015b60405180910390f35b61014c60035481565b60405190815260200161013a565b61016d610168366004610f84565b6102d9565b005b61016d61017d366004610f9d565b6103f0565b61016d610601565b6004546101979060ff1681565b604051901515815260200161013a565b61016d6101b5366004610f9d565b6106a1565b61016d610798565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161013a565b6002546101cf906001600160a01b031681565b610123610208366004610fd4565b600560209081526000928352604080842090915290825290208054600182015460029092015490919083565b61016d610242366004611004565b6107ac565b61016d610255366004610f9d565b610808565b6001546101cf906001600160a01b031681565b61014c61027b366004610fd4565b610840565b61016d61028e366004610f9d565b61099c565b61016d6102a1366004611004565b610ba2565b600681815481106102b657600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b60008181526005602090815260408083203384529091529020610300565b60405180910390fd5b600061030c8333610840565b90506006838154811061032157610321611028565b9060005260206000209060030201600101544261033e9190611054565b600183015542600283015580156103eb576002546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561039b57600080fd5b505af11580156103af573d6000803e3d6000fd5b50506040518381528592503391507fd6f2c8500df5b44f11e9e48b91ff9f1b9d81bc496d55570c2b1b75bf65243f519060200160405180910390a35b505050565b600081116104105760405162461bcd60e51b81526004016102f79061106c565b60006006838154811061042557610425611028565b90600052602060002090600302019050600081600201541161047c5760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b210323ab930ba34b7b760811b60448201526064016102f7565b6000838152600560209081526040808320338452909152902060018101544210156104d85760405162461bcd60e51b815260206004820152600c60248201526b1cdd1a5b1b081b1bd8dad95960a21b60448201526064016102f7565b80548311156104f95760405162461bcd60e51b81526004016102f79061106c565b826003600082825461050b9190611094565b9091555050805483908290600090610524908490611094565b909155505081548390839060009061053d908490611094565b909155505060018201546105519042611054565b600182810191909155546040516340c10f1960e01b8152336004820152602481018590526001600160a01b03909116906340c10f1990604401600060405180830381600087803b1580156105a457600080fd5b505af11580156105b8573d6000803e3d6000fd5b505050506105c5846102d9565b60405183815233907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364906020015b60405180910390a250505050565b610609610c1b565b60045460ff161561065c5760405162461bcd60e51b815260206004820152601860248201527f6465706f7369747320616c726561647920656e61626c6564000000000000000060448201526064016102f7565b6004805460ff191660019081179091556040519081527f415447f74696881c5449538f07d24542d1f37bc3ffaacd1095313e14d7b9ce489060200160405180910390a1565b6106a9610c1b565b6040805160608101825260008082526020820185815292820184815260068054600180820183559382905293517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f60039095029485015593517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d40840155517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4190920191909155905461075b9190611094565b60408051838152602081018590527f6c4c213503cfebbee51c17202ac8c98b88342f0789373eec423946146f5fa911910160405180910390a25050565b6107a0610c1b565b6107aa6000610c75565b565b6107b4610c1b565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f1762611dedb914f78a6866bff4f14860ee39a485122e7886a1890e85300cd08a9060200160405180910390a150565b610810610c1b565b60006006838154811061082557610825611028565b60009182526020909120600260039092020101919091555050565b6002546000906001600160a01b031661085b57506000610996565b60008381526005602090815260408083206001600160a01b038616845282529182902082516060810184528154808252600183015493820193909352600290910154928101929092526108b2576000915050610996565b806020015142111561090857620f4240600685815481106108d5576108d5611028565b90600052602060002090600302016002015482600001516108f691906110ab565b61090091906110ca565b915050610996565b6006848154811061091b5761091b611028565b906000526020600020906003020160010154620f424061093b91906110ab565b604082015161094a9042611094565b6006868154811061095d5761095d611028565b906000526020600020906003020160020154836000015161097e91906110ab565b61098891906110ab565b61099291906110ca565b9150505b92915050565b60045460ff166109ee5760405162461bcd60e51b815260206004820152601860248201527f6465706f73697473206e6f7420656e61626c656420796574000000000000000060448201526064016102f7565b60008111610a0e5760405162461bcd60e51b81526004016102f79061106c565b600060068381548110610a2357610a23611028565b906000526020600020906003020190506000816001015411610a7c5760405162461bcd60e51b81526020600482015260126024820152710d2dcecc2d8d2c840e0deded840d2dcc8caf60731b60448201526064016102f7565b600083815260056020908152604080832033845290915290206001820154610aa49042611054565b60018083019190915542600283015554610ac9906001600160a01b0316333086610cc5565b600154604051630852cd8d60e31b8152600481018590526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610b0f57600080fd5b505af1158015610b23573d6000803e3d6000fd5b505050508260036000828254610b399190611054565b9091555050805483908290600090610b52908490611054565b9091555050815483908390600090610b6b908490611054565b909155505060405183815233907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c906020016105f3565b610baa610c1b565b6001600160a01b038116610c0f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f7565b610c1881610c75565b50565b6000546001600160a01b031633146107aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102f7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610d1f908590610d25565b50505050565b6000610d7a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610df79092919063ffffffff16565b8051909150156103eb5780806020019051810190610d9891906110ec565b6103eb5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102f7565b6060610e068484600085610e0e565b949350505050565b606082471015610e6f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016102f7565b600080866001600160a01b03168587604051610e8b919061113a565b60006040518083038185875af1925050503d8060008114610ec8576040519150601f19603f3d011682016040523d82523d6000602084013e610ecd565b606091505b5091509150610ede87838387610ee9565b979650505050505050565b60608315610f55578251610f4e576001600160a01b0385163b610f4e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102f7565b5081610e06565b610e068383815115610f6a5781518083602001fd5b8060405162461bcd60e51b81526004016102f79190611156565b600060208284031215610f9657600080fd5b5035919050565b60008060408385031215610fb057600080fd5b50508035926020909101359150565b6001600160a01b0381168114610c1857600080fd5b60008060408385031215610fe757600080fd5b823591506020830135610ff981610fbf565b809150509250929050565b60006020828403121561101657600080fd5b813561102181610fbf565b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156110675761106761103e565b500190565b6020808252600e908201526d1a5b9d985b1a5908185b5bdd5b9d60921b604082015260600190565b6000828210156110a6576110a661103e565b500390565b60008160001904831182151516156110c5576110c561103e565b500290565b6000826110e757634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156110fe57600080fd5b8151801515811461102157600080fd5b60005b83811015611129578181015183820152602001611111565b83811115610d1f5750506000910152565b6000825161114c81846020870161110e565b9190910192915050565b602081526000825180602084015261117581604085016020870161110e565b601f01601f1916919091016040019291505056fea26469706673582212204f780b9500c28dfb7fc60da4e1babc91fa51048083c4b18ce793d02999d0145664736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005f419a278a06381a47972b1f1c8b6803c941cc990000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _dank (address): 0x5f419a278a06381A47972b1F1c8b6803C941CC99
Arg [1] : _depositsEnabled (bool): True
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000005f419a278a06381a47972b1f1c8b6803c941cc99
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.