Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- VotersDistributor
- Optimization enabled
- true
- Compiler version
- v0.8.20+commit.a1b79de6
- Optimization runs
- 200
- EVM Version
- paris
- Verified at
- 2025-06-25T06:17:29.924097Z
contracts/VotersDistributor.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./Utilities.sol";
contract VotersDistributor is ReentrancyGuard {
using SafeERC20 for IERC20;
INetworkProposal public networkProposal;
address public vplsTokenAddress;
address public vouchTokenAddress;
uint256 public plsDistributionThreshold = 100000e18;
uint256 public vplsDistributionThreshold = 100000e18;
uint256 public vouchDistributionThreshold = 100000e18;
event PlsDistributionFailed(address indexed voter, uint256 amount);
event ThresholdsUpdated(
uint256 plsDistributionThreshold,
uint256 vplsDistributionThreshold,
uint256 vouchDistributionThreshold
);
modifier onlyAdmin() {
require(networkProposal.isAdmin(msg.sender), "Caller must be admin");
_;
}
constructor() {
networkProposal = INetworkProposal(0x7783D7040423f75aeF82a3Ec32ed366ca460Fa6c);
vplsTokenAddress = 0x79BB3A0Ee435f957ce4f54eE8c3CFADc7278da0C;
}
function setVouchAddress(address _vouchTokenAddress) external {
require(_vouchTokenAddress != address(0), "invalid address");
if (vouchTokenAddress != address(0)) {
require(networkProposal.isAdmin(msg.sender), "Caller must be admin");
}
vouchTokenAddress = _vouchTokenAddress;
}
function setDistributionThresholds(
uint256 _plsDistributionThreshold,
uint256 _vplsDistributionThreshold,
uint256 _vouchDistributionThreshold
) external onlyAdmin {
require(_plsDistributionThreshold > 0, "PLS threshold must be greater than zero");
require(_vplsDistributionThreshold > 0, "VPLS threshold must be greater than zero");
require(_vouchDistributionThreshold > 0, "VOUCH threshold must be greater than zero");
plsDistributionThreshold = _plsDistributionThreshold;
vplsDistributionThreshold = _vplsDistributionThreshold;
vouchDistributionThreshold = _vouchDistributionThreshold;
emit ThresholdsUpdated(_plsDistributionThreshold, _vplsDistributionThreshold, _vouchDistributionThreshold);
}
receive() external payable {
IERC20 vouch = IERC20(vouchTokenAddress);
IERC20 vpls = IERC20(vplsTokenAddress);
address[] memory voters = networkProposal.getVoters();
uint256 numVoters = voters.length;
if (numVoters == 0) return;
uint256 amountPlsPerVoter = 0;
uint256 amountVplsPerVoter = 0;
uint256 amountVouchPerVoter = 0;
if (address(this).balance >= plsDistributionThreshold) {
amountPlsPerVoter = address(this).balance / numVoters;
}
if (vpls.balanceOf(address(this)) >= vplsDistributionThreshold) {
amountVplsPerVoter = vpls.balanceOf(address(this)) / numVoters;
}
if (vouch.balanceOf(address(this)) >= vouchDistributionThreshold) {
amountVouchPerVoter = vouch.balanceOf(address(this)) / numVoters;
}
for (uint256 i = 0; i < numVoters; i++) {
if (amountPlsPerVoter > 0) {
(bool success, ) = voters[i].call{value: amountPlsPerVoter}("");
if (!success) {
emit PlsDistributionFailed(voters[i], amountPlsPerVoter);
}
}
if (amountVplsPerVoter > 0) {
IERC20(vplsTokenAddress).safeTransfer(voters[i], amountVplsPerVoter);
}
if (amountVouchPerVoter > 0) {
IERC20(vouchTokenAddress).safeTransfer(voters[i], amountVouchPerVoter);
}
}
}
function triggerTokenSends() public nonReentrant {
IERC20 vouch = IERC20(vouchTokenAddress);
IERC20 vpls = IERC20(vplsTokenAddress);
address[] memory voters = networkProposal.getVoters();
uint256 numVoters = voters.length;
if (numVoters == 0) return;
uint256 amountPlsPerVoter = 0;
uint256 amountVplsPerVoter = 0;
uint256 amountVouchPerVoter = 0;
if (address(this).balance >= plsDistributionThreshold) {
amountPlsPerVoter = address(this).balance / numVoters;
}
if (vpls.balanceOf(address(this)) >= vplsDistributionThreshold) {
amountVplsPerVoter = vpls.balanceOf(address(this)) / numVoters;
}
if (vouch.balanceOf(address(this)) >= vouchDistributionThreshold) {
amountVouchPerVoter = vouch.balanceOf(address(this)) / numVoters;
}
for (uint256 i = 0; i < numVoters; i++) {
if (amountPlsPerVoter > 0) {
(bool success, ) = voters[i].call{value: amountPlsPerVoter}("");
if (!success) {
emit PlsDistributionFailed(voters[i], amountPlsPerVoter);
}
}
if (amountVplsPerVoter > 0) {
IERC20(vplsTokenAddress).safeTransfer(voters[i], amountVplsPerVoter);
}
if (amountVouchPerVoter > 0) {
IERC20(vouchTokenAddress).safeTransfer(voters[i], amountVouchPerVoter);
}
}
}
}
@openzeppelin/contracts/security/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @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;
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
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// 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;
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}
@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/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.
*
* ==== 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);
}
@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/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;
/**
* @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.encodeWithSelector(token.transfer.selector, 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.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));
}
/**
* @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);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
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");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @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.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
*
* 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.isContract(address(token));
}
}
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://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.0/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);
}
}
}
contracts/Utilities.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
interface IDEXRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function WPLS() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable returns (uint256[] memory amounts);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);
}
interface IDEXPair {
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to) external returns (uint256 amount0, uint256 amount1);
function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IDEXFactory {
function createPair(address tokenA, address tokenB) external returns (address pair);
function getPair(address tokenA, address tokenB) external view returns (address pair);
}
/**
* Standard SafeMath, stripped down to just add/sub/mul/div
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
}
interface ILPTOKEN {
function burn(uint256 amount) external;
}
interface INetworkProposal {
function isAdmin(address adminAddress) external view returns (bool);
function admin() external view returns (address);
function getVoters() external view returns (address[] memory);
}
interface VPLSMinter {
function deposit() external payable;
function minDeposit() external returns (uint256);
}
interface IWPLS {
function deposit() external payable;
function withdraw(uint wad) external;
}
interface IVPLS {
function burn(uint256 amount) external;
}
interface IVouch {
function totalSupply() external view returns (uint256);
function burn(uint256 amount) external;
}
interface IDaoDistributor {
function setDistributionCriteria(
uint256 _minVouchPeriod,
uint256 _minVouchDistribution,
uint256 _minVplsPeriod,
uint256 _minVplsDistribution,
uint256 _minPlsPeriod,
uint256 _minPlsDistribution
) external;
function setDistributionThresholds(
uint256 _vouchForDistributionThreshold,
uint256 _vplsForDistributionThreshold,
uint256 _plsForDistributionThreshold,
uint256 _swapThresholdForTokens,
uint256 _plsSendThreshold,
uint256 _liquidityDistributionThreshold
) external;
function setDistributionAmounts(
uint256[9] calldata feeParams
) external;
function setVouchRewards(
uint256 _vouchHoldersPercent,
uint256 _validatorsPercent,
uint256 _votersPercent,
uint256 _stakersPercent,
uint256 _burnPercent
) external;
function setVplsRewards(
uint256 _vouchHoldersPercent,
uint256 _validatorsPercent,
uint256 _votersPercent,
uint256 _stakersPercent,
uint256 _burnPercent
) external;
function setPlsRewards(
uint256 _vouchHoldersPercent,
uint256 _validatorsPercent,
uint256 _votersPercent,
uint256 _stakersPercent
) external;
function setRecipientAddresses(
address _validators,
address _masterValidator,
address _feePool,
address _safu,
address _daoTreasury,
address _voters,
address _stakers
) external;
function setDistributorSettings(uint256 _vouchGas, uint256 _vplsGas, uint256 _plsGas) external;
function setShare(address shareholder, uint256 amount) external;
function processVouch(uint256 gas) external;
function processVpls(uint256 gas) external;
function processPls(uint256 gas) external;
function claimDividend() external;
function getUnpaidVouchEarnings(address shareholder) external view returns (uint256);
function getUnpaidVplsEarnings(address shareholder) external view returns (uint256);
function getUnpaidPlsEarnings(address shareholder) external view returns (uint256);
function setVouchAddress(address _vouchAddress) external;
function depositFromVouch() external payable;
function depositFromValidators() external payable;
}
library Utilities {
address public constant pulseRouterV1Address = 0x98bf93ebf5c380C0e6Ae8e192A7e2AE08edAcc02;
address public constant pulseRouterV2Address = 0x165C3410fC91EF562C50559f7d2289fEbed552d9;
address public constant nineinchRouterAddress = 0xeB45a3c4aedd0F47F345fB4c8A1802BB5740d725;
function getBestRouter(uint256 amountIn, address[] memory path) public view returns (address bestRouter) {
address[] memory routers = new address[](3);
routers[0] = pulseRouterV1Address;
routers[1] = pulseRouterV2Address;
routers[2] = nineinchRouterAddress;
uint256 bestAmountOut = 0;
bestRouter = pulseRouterV2Address;
for (uint256 i = 0; i < routers.length; i++) {
try IDEXRouter(routers[i]).getAmountsOut(amountIn, path) returns (uint256[] memory amountsOut) {
uint256 amountOut = amountsOut[amountsOut.length - 1];
if (amountOut > bestAmountOut) {
bestAmountOut = amountOut;
bestRouter = routers[i];
}
} catch {
continue;
}
}
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"paris"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"PlsDistributionFailed","inputs":[{"type":"address","name":"voter","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ThresholdsUpdated","inputs":[{"type":"uint256","name":"plsDistributionThreshold","internalType":"uint256","indexed":false},{"type":"uint256","name":"vplsDistributionThreshold","internalType":"uint256","indexed":false},{"type":"uint256","name":"vouchDistributionThreshold","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract INetworkProposal"}],"name":"networkProposal","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"plsDistributionThreshold","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDistributionThresholds","inputs":[{"type":"uint256","name":"_plsDistributionThreshold","internalType":"uint256"},{"type":"uint256","name":"_vplsDistributionThreshold","internalType":"uint256"},{"type":"uint256","name":"_vouchDistributionThreshold","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setVouchAddress","inputs":[{"type":"address","name":"_vouchTokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"triggerTokenSends","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"vouchDistributionThreshold","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"vouchTokenAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"vplsDistributionThreshold","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"vplsTokenAddress","inputs":[]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x608060405269152d02c7e14af680000060045569152d02c7e14af680000060055569152d02c7e14af680000060065534801561003a57600080fd5b506001600081905580546001600160a01b0319908116737783d7040423f75aef82a3ec32ed366ca460fa6c17909155600280549091167379bb3a0ee435f957ce4f54ee8c3cfadc7278da0c179055611261806100976000396000f3fe60806040526004361061008a5760003560e01c80638ace1836116100595780638ace18361461050c578063b1f7c90014610522578063c0b4647014610542578063d72158f814610562578063ea2c0d451461057857600080fd5b8063211d6a35146104765780632d21a02c1461049f578063529ab3d6146104b457806376597037146104d457600080fd5b36610471576003546002546001546040805163cdd7225360e01b815290516001600160a01b039485169493841693600093169163cdd7225391600480830192869291908290030181865afa1580156100e6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261010e9190810190611009565b8051909150600081900361011e57005b600080600060045447106101395761013684476110ce565b92505b6005546040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa158015610180573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a491906110f0565b10610220576040516370a0823160e01b815230600482015284906001600160a01b038816906370a0823190602401602060405180830381865afa1580156101ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021391906110f0565b61021d91906110ce565b91505b6006546040516370a0823160e01b81523060048201526001600160a01b038916906370a0823190602401602060405180830381865afa158015610267573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028b91906110f0565b10610307576040516370a0823160e01b815230600482015284906001600160a01b038916906370a0823190602401602060405180830381865afa1580156102d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102fa91906110f0565b61030491906110ce565b90505b60005b8481101561046f5783156103eb57600086828151811061032c5761032c611109565b60200260200101516001600160a01b03168560405160006040518083038185875af1925050503d806000811461037e576040519150601f19603f3d011682016040523d82523d6000602084013e610383565b606091505b50509050806103e95786828151811061039e5761039e611109565b60200260200101516001600160a01b03167f04f006af0e65e4ea78adaa71293c2b168d5aab0a45ce9a88d522ce8bdf0f237c866040516103e091815260200190565b60405180910390a25b505b82156104245761042486828151811061040657610406611109565b60209081029190910101516002546001600160a01b03169085610598565b811561045d5761045d86828151811061043f5761043f611109565b60209081029190910101516003546001600160a01b03169084610598565b806104678161111f565b91505061030a565b005b600080fd5b34801561048257600080fd5b5061048c60055481565b6040519081526020015b60405180910390f35b3480156104ab57600080fd5b5061046f6105ef565b3480156104c057600080fd5b5061046f6104cf366004611146565b6109b7565b3480156104e057600080fd5b506003546104f4906001600160a01b031681565b6040516001600160a01b039091168152602001610496565b34801561051857600080fd5b5061048c60045481565b34801561052e57600080fd5b506002546104f4906001600160a01b031681565b34801561054e57600080fd5b506001546104f4906001600160a01b031681565b34801561056e57600080fd5b5061048c60065481565b34801561058457600080fd5b5061046f610593366004611172565b610be3565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526105ea908490610d0d565b505050565b6105f7610de2565b6003546002546001546040805163cdd7225360e01b815290516001600160a01b039485169493841693600093169163cdd7225391600480830192869291908290030181865afa15801561064e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106769190810190611009565b8051909150600081900361068d57505050506109ab565b600080600060045447106106a8576106a584476110ce565b92505b6005546040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa1580156106ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071391906110f0565b1061078f576040516370a0823160e01b815230600482015284906001600160a01b038816906370a0823190602401602060405180830381865afa15801561075e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078291906110f0565b61078c91906110ce565b91505b6006546040516370a0823160e01b81523060048201526001600160a01b038916906370a0823190602401602060405180830381865afa1580156107d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fa91906110f0565b10610876576040516370a0823160e01b815230600482015284906001600160a01b038916906370a0823190602401602060405180830381865afa158015610845573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086991906110f0565b61087391906110ce565b90505b60005b848110156109a257831561095a57600086828151811061089b5761089b611109565b60200260200101516001600160a01b03168560405160006040518083038185875af1925050503d80600081146108ed576040519150601f19603f3d011682016040523d82523d6000602084013e6108f2565b606091505b50509050806109585786828151811061090d5761090d611109565b60200260200101516001600160a01b03167f04f006af0e65e4ea78adaa71293c2b168d5aab0a45ce9a88d522ce8bdf0f237c8660405161094f91815260200190565b60405180910390a25b505b82156109755761097586828151811061040657610406611109565b81156109905761099086828151811061043f5761043f611109565b8061099a8161111f565b915050610879565b50505050505050505b6109b56001600055565b565b600154604051630935e01b60e21b81523360048201526001600160a01b03909116906324d7806c90602401602060405180830381865afa1580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190611196565b610a6b5760405162461bcd60e51b815260206004820152601460248201527321b0b63632b91036bab9ba1031329030b236b4b760611b60448201526064015b60405180910390fd5b60008311610acb5760405162461bcd60e51b815260206004820152602760248201527f504c53207468726573686f6c64206d7573742062652067726561746572207468604482015266616e207a65726f60c81b6064820152608401610a62565b60008211610b2c5760405162461bcd60e51b815260206004820152602860248201527f56504c53207468726573686f6c64206d7573742062652067726561746572207460448201526768616e207a65726f60c01b6064820152608401610a62565b60008111610b8e5760405162461bcd60e51b815260206004820152602960248201527f564f554348207468726573686f6c64206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610a62565b60048390556005829055600681905560408051848152602081018490529081018290527f5c18dc8d95da80ea715f2473abe6f01199d4bfa87d2ed1ef051058a60dcce2589060600160405180910390a1505050565b6001600160a01b038116610c2b5760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b6044820152606401610a62565b6003546001600160a01b031615610ceb57600154604051630935e01b60e21b81523360048201526001600160a01b03909116906324d7806c90602401602060405180830381865afa158015610c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca89190611196565b610ceb5760405162461bcd60e51b815260206004820152601460248201527321b0b63632b91036bab9ba1031329030b236b4b760611b6044820152606401610a62565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610d62826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e3b9092919063ffffffff16565b9050805160001480610d83575080806020019051810190610d839190611196565b6105ea5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a62565b600260005403610e345760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a62565b6002600055565b6060610e4a8484600085610e52565b949350505050565b606082471015610eb35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a62565b600080866001600160a01b03168587604051610ecf91906111dc565b60006040518083038185875af1925050503d8060008114610f0c576040519150601f19603f3d011682016040523d82523d6000602084013e610f11565b606091505b5091509150610f2287838387610f2d565b979650505050505050565b60608315610f9c578251600003610f95576001600160a01b0385163b610f955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a62565b5081610e4a565b610e4a8383815115610fb15781518083602001fd5b8060405162461bcd60e51b8152600401610a6291906111f8565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610ff657600080fd5b50565b805161100481610fe1565b919050565b6000602080838503121561101c57600080fd5b825167ffffffffffffffff8082111561103457600080fd5b818501915085601f83011261104857600080fd5b81518181111561105a5761105a610fcb565b8060051b604051601f19603f8301168101818110858211171561107f5761107f610fcb565b60405291825284820192508381018501918883111561109d57600080fd5b938501935b828510156110c2576110b385610ff9565b845293850193928501926110a2565b98975050505050505050565b6000826110eb57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561110257600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001820161113f57634e487b7160e01b600052601160045260246000fd5b5060010190565b60008060006060848603121561115b57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561118457600080fd5b813561118f81610fe1565b9392505050565b6000602082840312156111a857600080fd5b8151801515811461118f57600080fd5b60005b838110156111d35781810151838201526020016111bb565b50506000910152565b600082516111ee8184602087016111b8565b9190910192915050565b60208152600082518060208401526112178160408501602087016111b8565b601f01601f1916919091016040019291505056fea2646970667358221220bab262f0b46b1ac97ff07a4be61927c75cedf4049dafad513a8212df1daac3ed64736f6c63430008140033
Deployed ByteCode
0x60806040526004361061008a5760003560e01c80638ace1836116100595780638ace18361461050c578063b1f7c90014610522578063c0b4647014610542578063d72158f814610562578063ea2c0d451461057857600080fd5b8063211d6a35146104765780632d21a02c1461049f578063529ab3d6146104b457806376597037146104d457600080fd5b36610471576003546002546001546040805163cdd7225360e01b815290516001600160a01b039485169493841693600093169163cdd7225391600480830192869291908290030181865afa1580156100e6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261010e9190810190611009565b8051909150600081900361011e57005b600080600060045447106101395761013684476110ce565b92505b6005546040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa158015610180573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a491906110f0565b10610220576040516370a0823160e01b815230600482015284906001600160a01b038816906370a0823190602401602060405180830381865afa1580156101ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021391906110f0565b61021d91906110ce565b91505b6006546040516370a0823160e01b81523060048201526001600160a01b038916906370a0823190602401602060405180830381865afa158015610267573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028b91906110f0565b10610307576040516370a0823160e01b815230600482015284906001600160a01b038916906370a0823190602401602060405180830381865afa1580156102d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102fa91906110f0565b61030491906110ce565b90505b60005b8481101561046f5783156103eb57600086828151811061032c5761032c611109565b60200260200101516001600160a01b03168560405160006040518083038185875af1925050503d806000811461037e576040519150601f19603f3d011682016040523d82523d6000602084013e610383565b606091505b50509050806103e95786828151811061039e5761039e611109565b60200260200101516001600160a01b03167f04f006af0e65e4ea78adaa71293c2b168d5aab0a45ce9a88d522ce8bdf0f237c866040516103e091815260200190565b60405180910390a25b505b82156104245761042486828151811061040657610406611109565b60209081029190910101516002546001600160a01b03169085610598565b811561045d5761045d86828151811061043f5761043f611109565b60209081029190910101516003546001600160a01b03169084610598565b806104678161111f565b91505061030a565b005b600080fd5b34801561048257600080fd5b5061048c60055481565b6040519081526020015b60405180910390f35b3480156104ab57600080fd5b5061046f6105ef565b3480156104c057600080fd5b5061046f6104cf366004611146565b6109b7565b3480156104e057600080fd5b506003546104f4906001600160a01b031681565b6040516001600160a01b039091168152602001610496565b34801561051857600080fd5b5061048c60045481565b34801561052e57600080fd5b506002546104f4906001600160a01b031681565b34801561054e57600080fd5b506001546104f4906001600160a01b031681565b34801561056e57600080fd5b5061048c60065481565b34801561058457600080fd5b5061046f610593366004611172565b610be3565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526105ea908490610d0d565b505050565b6105f7610de2565b6003546002546001546040805163cdd7225360e01b815290516001600160a01b039485169493841693600093169163cdd7225391600480830192869291908290030181865afa15801561064e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106769190810190611009565b8051909150600081900361068d57505050506109ab565b600080600060045447106106a8576106a584476110ce565b92505b6005546040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa1580156106ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071391906110f0565b1061078f576040516370a0823160e01b815230600482015284906001600160a01b038816906370a0823190602401602060405180830381865afa15801561075e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078291906110f0565b61078c91906110ce565b91505b6006546040516370a0823160e01b81523060048201526001600160a01b038916906370a0823190602401602060405180830381865afa1580156107d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fa91906110f0565b10610876576040516370a0823160e01b815230600482015284906001600160a01b038916906370a0823190602401602060405180830381865afa158015610845573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086991906110f0565b61087391906110ce565b90505b60005b848110156109a257831561095a57600086828151811061089b5761089b611109565b60200260200101516001600160a01b03168560405160006040518083038185875af1925050503d80600081146108ed576040519150601f19603f3d011682016040523d82523d6000602084013e6108f2565b606091505b50509050806109585786828151811061090d5761090d611109565b60200260200101516001600160a01b03167f04f006af0e65e4ea78adaa71293c2b168d5aab0a45ce9a88d522ce8bdf0f237c8660405161094f91815260200190565b60405180910390a25b505b82156109755761097586828151811061040657610406611109565b81156109905761099086828151811061043f5761043f611109565b8061099a8161111f565b915050610879565b50505050505050505b6109b56001600055565b565b600154604051630935e01b60e21b81523360048201526001600160a01b03909116906324d7806c90602401602060405180830381865afa1580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190611196565b610a6b5760405162461bcd60e51b815260206004820152601460248201527321b0b63632b91036bab9ba1031329030b236b4b760611b60448201526064015b60405180910390fd5b60008311610acb5760405162461bcd60e51b815260206004820152602760248201527f504c53207468726573686f6c64206d7573742062652067726561746572207468604482015266616e207a65726f60c81b6064820152608401610a62565b60008211610b2c5760405162461bcd60e51b815260206004820152602860248201527f56504c53207468726573686f6c64206d7573742062652067726561746572207460448201526768616e207a65726f60c01b6064820152608401610a62565b60008111610b8e5760405162461bcd60e51b815260206004820152602960248201527f564f554348207468726573686f6c64206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610a62565b60048390556005829055600681905560408051848152602081018490529081018290527f5c18dc8d95da80ea715f2473abe6f01199d4bfa87d2ed1ef051058a60dcce2589060600160405180910390a1505050565b6001600160a01b038116610c2b5760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b6044820152606401610a62565b6003546001600160a01b031615610ceb57600154604051630935e01b60e21b81523360048201526001600160a01b03909116906324d7806c90602401602060405180830381865afa158015610c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca89190611196565b610ceb5760405162461bcd60e51b815260206004820152601460248201527321b0b63632b91036bab9ba1031329030b236b4b760611b6044820152606401610a62565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610d62826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e3b9092919063ffffffff16565b9050805160001480610d83575080806020019051810190610d839190611196565b6105ea5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a62565b600260005403610e345760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a62565b6002600055565b6060610e4a8484600085610e52565b949350505050565b606082471015610eb35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a62565b600080866001600160a01b03168587604051610ecf91906111dc565b60006040518083038185875af1925050503d8060008114610f0c576040519150601f19603f3d011682016040523d82523d6000602084013e610f11565b606091505b5091509150610f2287838387610f2d565b979650505050505050565b60608315610f9c578251600003610f95576001600160a01b0385163b610f955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a62565b5081610e4a565b610e4a8383815115610fb15781518083602001fd5b8060405162461bcd60e51b8152600401610a6291906111f8565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610ff657600080fd5b50565b805161100481610fe1565b919050565b6000602080838503121561101c57600080fd5b825167ffffffffffffffff8082111561103457600080fd5b818501915085601f83011261104857600080fd5b81518181111561105a5761105a610fcb565b8060051b604051601f19603f8301168101818110858211171561107f5761107f610fcb565b60405291825284820192508381018501918883111561109d57600080fd5b938501935b828510156110c2576110b385610ff9565b845293850193928501926110a2565b98975050505050505050565b6000826110eb57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561110257600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001820161113f57634e487b7160e01b600052601160045260246000fd5b5060010190565b60008060006060848603121561115b57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561118457600080fd5b813561118f81610fe1565b9392505050565b6000602082840312156111a857600080fd5b8151801515811461118f57600080fd5b60005b838110156111d35781810151838201526020016111bb565b50506000910152565b600082516111ee8184602087016111b8565b9190910192915050565b60208152600082518060208401526112178160408501602087016111b8565b601f01601f1916919091016040019291505056fea2646970667358221220bab262f0b46b1ac97ff07a4be61927c75cedf4049dafad513a8212df1daac3ed64736f6c63430008140033