Contract
0x7F974c1E969c8201c08273b958dA646fe5d536AA
7
Contract Overview
Balance:
0 AVAX
AVAX Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x4142d1d9dae091098b280683da40693eb87f82fdaf6b367293b3bf60130a9525 | 0x60806040 | 27036153 | 86 days 2 hrs ago | 0xbcb909975715dc8fde643ee44b89e3fd6a35a259 | IN | Create: HFunds | 0 AVAX | 0.040092675 |
[ Download CSV Export ]
Contract Name:
HFunds
Compiler Version
v0.8.10+commit.fc410830
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.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)); } } /** * @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 pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Config { // function signature of "postProcess()" bytes4 public constant POSTPROCESS_SIG = 0xc2722916; // The base amount of percentage function uint256 public constant PERCENTAGE_BASE = 1 ether; // Handler post-process type. Others should not happen now. enum HandlerType { Token, Custom, Others } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./lib/LibCache.sol"; import "./lib/LibStack.sol"; /// @notice A cache structure composed by a bytes32 array contract Storage { using LibCache for mapping(bytes32 => bytes32); using LibStack for bytes32[]; bytes32[] public stack; mapping(bytes32 => bytes32) public cache; // keccak256 hash of "msg.sender" // prettier-ignore bytes32 public constant MSG_SENDER_KEY = 0xb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a; modifier isStackEmpty() { require(stack.length == 0, "Stack not empty"); _; } modifier isInitialized() { require(_getSender() != address(0), "Sender is not initialized"); _; } modifier isNotInitialized() { require(_getSender() == address(0), "Sender is initialized"); _; } function _setSender() internal isNotInitialized { cache.setAddress(MSG_SENDER_KEY, msg.sender); } function _resetSender() internal { cache.setAddress(MSG_SENDER_KEY, address(0)); } function _getSender() internal view returns (address) { return cache.getAddress(MSG_SENDER_KEY); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../interface/IERC20Usdt.sol"; import "../Config.sol"; import "../Storage.sol"; abstract contract HandlerBase is Storage, Config { using SafeERC20 for IERC20; using LibStack for bytes32[]; address public constant NATIVE_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; function postProcess() external payable virtual { revert("Invalid post process"); /* Implementation template bytes4 sig = stack.getSig(); if (sig == bytes4(keccak256(bytes("handlerFunction_1()")))) { // Do something } else if (sig == bytes4(keccak256(bytes("handlerFunction_2()")))) { bytes32 temp = stack.get(); // Do something } else revert("Invalid post process"); */ } function _updateToken(address token) internal { stack.setAddress(token); // Ignore token type to fit old handlers // stack.setHandlerType(uint256(HandlerType.Token)); } function _updatePostProcess(bytes32[] memory params) internal { for (uint256 i = params.length; i > 0; i--) { stack.set(params[i - 1]); } stack.set(msg.sig); stack.setHandlerType(HandlerType.Custom); } function getContractName() public pure virtual returns (string memory); function _revertMsg( string memory functionName, string memory reason ) internal pure { revert( string( abi.encodePacked( getContractName(), "_", functionName, ": ", reason ) ) ); } function _revertMsg(string memory functionName) internal pure { _revertMsg(functionName, "Unspecified"); } function _requireMsg( bool condition, string memory functionName, string memory reason ) internal pure { if (!condition) _revertMsg(functionName, reason); } function _uint2String(uint256 n) internal pure returns (string memory) { if (n == 0) { return "0"; } else { uint256 len = 0; for (uint256 temp = n; temp > 0; temp /= 10) { len++; } bytes memory str = new bytes(len); for (uint256 i = len; i > 0; i--) { str[i - 1] = bytes1(uint8(48 + (n % 10))); n /= 10; } return string(str); } } function _getBalance( address token, uint256 amount ) internal view returns (uint256) { if (amount != type(uint256).max) { return amount; } // ETH case if (token == address(0) || token == NATIVE_TOKEN_ADDRESS) { return address(this).balance; } // ERC20 token case return IERC20(token).balanceOf(address(this)); } function _tokenApprove( address token, address spender, uint256 amount ) internal { try IERC20Usdt(token).approve(spender, amount) {} catch { IERC20(token).safeApprove(spender, 0); IERC20(token).safeApprove(spender, amount); } } function _tokenApproveZero(address token, address spender) internal { if (IERC20Usdt(token).allowance(address(this), spender) > 0) { try IERC20Usdt(token).approve(spender, 0) {} catch { IERC20Usdt(token).approve(spender, 1); } } } function _isNotNativeToken(address token) internal pure returns (bool) { return (token != address(0) && token != NATIVE_TOKEN_ADDRESS); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../lib/LibFeeStorage.sol"; import "../HandlerBase.sol"; contract HFunds is HandlerBase { using SafeERC20 for IERC20; using LibFeeStorage for mapping(bytes32 => bytes32); event ChargeFee(address indexed tokenIn, uint256 feeAmount); function getContractName() public pure override returns (string memory) { return "HFunds"; } function updateTokens( address[] calldata tokens ) external payable returns (uint256[] memory) { uint256[] memory balances = new uint256[](tokens.length); for (uint256 i = 0; i < tokens.length; ) { address token = tokens[i]; if (token != address(0) && token != NATIVE_TOKEN_ADDRESS) { // Update involved token _updateToken(token); } balances[i] = _getBalance(token, type(uint256).max); unchecked { ++i; } } return balances; } function inject( address[] calldata tokens, uint256[] calldata amounts ) external payable returns (uint256[] memory) { return _inject(tokens, amounts); } // Same as inject() and just to make another interface for different use case function addFunds( address[] calldata tokens, uint256[] calldata amounts ) external payable returns (uint256[] memory) { return _inject(tokens, amounts); } function sendTokens( address[] calldata tokens, uint256[] calldata amounts, address payable receiver ) external payable { for (uint256 i = 0; i < tokens.length; ) { uint256 amount = _getBalance(tokens[i], amounts[i]); if (amount > 0) { // ETH case if ( tokens[i] == address(0) || tokens[i] == NATIVE_TOKEN_ADDRESS ) { (bool success, ) = receiver.call{value: amount}(""); _requireMsg(success, "sendTokens", "failed to send Ether"); } else { IERC20(tokens[i]).safeTransfer(receiver, amount); } } unchecked { ++i; } } } function sendTokenToAddresses( address token, uint256[] calldata amounts, address payable[] calldata receivers ) external payable { _requireMsg( amounts.length == receivers.length, "sendTokenToAddresses", "amount and receiver does not match" ); if (_isNotNativeToken(token)) { for (uint256 i = 0; i < amounts.length; ) { if (amounts[i] > 0) { IERC20(token).safeTransfer(receivers[i], amounts[i]); } unchecked { ++i; } } } else { for (uint256 i = 0; i < amounts.length; ) { if (amounts[i] > 0) { (bool success, ) = receivers[i].call{value: amounts[i]}(""); _requireMsg( success, "sendTokenToAddresses", "failed to send Ether" ); } unchecked { ++i; } } } } function send(uint256 amount, address payable receiver) external payable { amount = _getBalance(address(0), amount); if (amount > 0) { (bool success, ) = receiver.call{value: amount}(""); _requireMsg(success, "send", "failed to send Ether"); } } function sendToken( address token, uint256 amount, address receiver ) external payable { amount = _getBalance(token, amount); if (amount > 0) { IERC20(token).safeTransfer(receiver, amount); } } /// @notice Send ether to block miner. /// @dev Transfer with built-in 2300 gas cap is safer and acceptable for most miners. /// @param amount The ether amount. function sendEtherToMiner(uint256 amount) external payable { if (amount > 0) { (bool success, ) = block.coinbase.call{value: amount}(""); _requireMsg(success, "sendEtherToMiner", "failed to send Ether"); } } function checkSlippage( address[] calldata tokens, uint256[] calldata amounts ) external payable { _requireMsg( tokens.length == amounts.length, "checkSlippage", "token and amount do not match" ); for (uint256 i = 0; i < tokens.length; ) { if (tokens[i] == address(0)) { if (address(this).balance < amounts[i]) { string memory errMsg = string( abi.encodePacked( "error: ", _uint2String(i), "_", _uint2String(address(this).balance) ) ); _revertMsg("checkSlippage", errMsg); } } else if ( IERC20(tokens[i]).balanceOf(address(this)) < amounts[i] ) { string memory errMsg = string( abi.encodePacked( "error: ", _uint2String(i), "_", _uint2String(IERC20(tokens[i]).balanceOf(address(this))) ) ); _revertMsg("checkSlippage", errMsg); } unchecked { ++i; } } } function getBalance(address token) external payable returns (uint256) { return _getBalance(token, type(uint256).max); } function _inject( address[] calldata tokens, uint256[] calldata amounts ) internal returns (uint256[] memory) { _requireMsg( tokens.length == amounts.length, "inject", "token and amount does not match" ); address sender = _getSender(); uint256 feeRate = cache._getFeeRate(); address collector = cache._getFeeCollector(); uint256[] memory amountsInProxy = new uint256[](amounts.length); for (uint256 i = 0; i < tokens.length; ) { IERC20(tokens[i]).safeTransferFrom( sender, address(this), amounts[i] ); if (feeRate > 0) { uint256 fee = _calFee(amounts[i], feeRate); IERC20(tokens[i]).safeTransfer(collector, fee); amountsInProxy[i] = amounts[i] - fee; emit ChargeFee(tokens[i], fee); } else { amountsInProxy[i] = amounts[i]; } // Update involved token _updateToken(tokens[i]); unchecked { ++i; } } return amountsInProxy; } function _calFee( uint256 amount, uint256 feeRate ) internal pure returns (uint256) { return (amount * feeRate) / PERCENTAGE_BASE; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IERC20Usdt { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external; function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external; function transferFrom(address sender, address recipient, uint256 amount) external; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library LibCache { function set( mapping(bytes32 => bytes32) storage _cache, bytes32 _key, bytes32 _value ) internal { _cache[_key] = _value; } function setAddress( mapping(bytes32 => bytes32) storage _cache, bytes32 _key, address _value ) internal { _cache[_key] = bytes32(uint256(uint160(_value))); } function setUint256( mapping(bytes32 => bytes32) storage _cache, bytes32 _key, uint256 _value ) internal { _cache[_key] = bytes32(_value); } function getAddress( mapping(bytes32 => bytes32) storage _cache, bytes32 _key ) internal view returns (address ret) { ret = address(uint160(uint256(_cache[_key]))); } function getUint256( mapping(bytes32 => bytes32) storage _cache, bytes32 _key ) internal view returns (uint256 ret) { ret = uint256(_cache[_key]); } function get( mapping(bytes32 => bytes32) storage _cache, bytes32 _key ) internal view returns (bytes32 ret) { ret = _cache[_key]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./LibCache.sol"; import "../Storage.sol"; library LibFeeStorage { using LibCache for mapping(bytes32 => bytes32); // keccak256 hash of "furucombo.fee.rate" // prettier-ignore bytes32 public constant FEE_RATE_KEY = 0x142183525227cae0e4300fd0fc77d7f3b08ceb0fd9cb2a6c5488668fa0ea5ffa; // keccak256 hash of "furucombo.fee.collector" // prettier-ignore bytes32 public constant FEE_COLLECTOR_KEY = 0x60d7a7cc0a45d852bd613e4f527aaa2e4b81fff918a69a2aab88b6458751d614; function _setFeeRate( mapping(bytes32 => bytes32) storage _cache, uint256 _feeRate ) internal { require(_getFeeRate(_cache) == 0, "Fee rate not zero"); _cache.setUint256(FEE_RATE_KEY, _feeRate); } function _resetFeeRate( mapping(bytes32 => bytes32) storage _cache ) internal { _cache.setUint256(FEE_RATE_KEY, 0); } function _getFeeRate( mapping(bytes32 => bytes32) storage _cache ) internal view returns (uint256) { return _cache.getUint256(FEE_RATE_KEY); } function _setFeeCollector( mapping(bytes32 => bytes32) storage _cache, address _collector ) internal { require( _getFeeCollector(_cache) == address(0), "Fee collector is initialized" ); _cache.setAddress(FEE_COLLECTOR_KEY, _collector); } function _resetFeeCollector( mapping(bytes32 => bytes32) storage _cache ) internal { _cache.setAddress(FEE_COLLECTOR_KEY, address(0)); } function _getFeeCollector( mapping(bytes32 => bytes32) storage _cache ) internal view returns (address) { return _cache.getAddress(FEE_COLLECTOR_KEY); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../Config.sol"; library LibStack { function setAddress(bytes32[] storage _stack, address _input) internal { _stack.push(bytes32(uint256(uint160(_input)))); } function set(bytes32[] storage _stack, bytes32 _input) internal { _stack.push(_input); } function setHandlerType( bytes32[] storage _stack, Config.HandlerType _input ) internal { _stack.push(bytes12(uint96(_input))); } function getAddress( bytes32[] storage _stack ) internal returns (address ret) { ret = address(uint160(uint256(peek(_stack)))); _stack.pop(); } function getSig(bytes32[] storage _stack) internal returns (bytes4 ret) { ret = bytes4(peek(_stack)); _stack.pop(); } function get(bytes32[] storage _stack) internal returns (bytes32 ret) { ret = peek(_stack); _stack.pop(); } function peek( bytes32[] storage _stack ) internal view returns (bytes32 ret) { uint256 length = _stack.length; require(length > 0, "stack empty"); ret = _stack[length - 1]; } function peek( bytes32[] storage _stack, uint256 _index ) internal view returns (bytes32 ret) { uint256 length = _stack.length; require(length > 0, "stack empty"); require(length > _index, "not enough elements in stack"); ret = _stack[length - _index - 1]; } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeAmount","type":"uint256"}],"name":"ChargeFee","type":"event"},{"inputs":[],"name":"MSG_SENDER_KEY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENTAGE_BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POSTPROCESS_SIG","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"addFunds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"cache","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"checkSlippage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getContractName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"inject","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"postProcess","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"receiver","type":"address"}],"name":"send","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sendEtherToMiner","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"sendToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address payable[]","name":"receivers","type":"address[]"}],"name":"sendTokenToAddresses","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address payable","name":"receiver","type":"address"}],"name":"sendTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stack","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"updateTokens","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"payable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50611c0b806100206000396000f3fe6080604052600436106101095760003560e01c8063db71410e11610095578063df2ebdbb11610064578063df2ebdbb1461025e578063e64154d31461029e578063f5f5ba72146102b1578063f8b2cb4f146102e6578063fa2901a5146102f957600080fd5b8063db71410e14610205578063dc9031c414610218578063ddaf429d14610238578063de41691c1461024b57600080fd5b806381baf3ab116100dc57806381baf3ab146101a157806387c13943146101b457806399eb59b9146101d0578063c2722916146101fd578063d0797f841461010e57600080fd5b80630ce7df361461010e5780630f532d181461013757806318248f2a14610179578063785d04f51461018e575b600080fd5b61012161011c366004611698565b61032d565b60405161012e9190611704565b60405180910390f35b34801561014357600080fd5b5061016b7fb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a81565b60405190815260200161012e565b61018c61018736600461175d565b610344565b005b61018c61019c36600461179f565b61036f565b61018c6101af3660046117cf565b61042f565b3480156101c057600080fd5b5061016b670de0b6b3a764000081565b3480156101dc57600080fd5b5061016b6101eb366004611853565b60016020526000908152604090205481565b61018c610613565b61018c610213366004611698565b610657565b34801561022457600080fd5b5061016b610233366004611853565b610934565b61018c61024636600461186c565b610955565b6101216102593660046118ef565b610b7d565b34801561026a57600080fd5b5061028673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6040516001600160a01b03909116815260200161012e565b61018c6102ac366004611853565b610c7b565b3480156102bd57600080fd5b5060408051808201825260068152654846756e647360d01b6020820152905161012e919061195d565b61016b6102f4366004611990565b610d2e565b34801561030557600080fd5b50610314636139148b60e11b81565b6040516001600160e01b0319909116815260200161012e565b606061033b85858585610d3c565b95945050505050565b61034e8383611026565b9150811561036a5761036a6001600160a01b03841682846110e5565b505050565b61037a600083611026565b9150811561042b576000816001600160a01b03168360405160006040518083038185875af1925050503d80600081146103cf576040519150601f19603f3d011682016040523d82523d6000602084013e6103d4565b606091505b5050905061036a81604051806040016040528060048152602001631cd95b9960e21b815250604051806040016040528060148152602001733330b4b632b2103a379039b2b7321022ba3432b960611b815250611148565b5050565b60005b8481101561060b576000610484878784818110610451576104516119ad565b90506020020160208101906104669190611990565b868685818110610478576104786119ad565b90506020020135611026565b905080156106025760008787848181106104a0576104a06119ad565b90506020020160208101906104b59190611990565b6001600160a01b0316148061050c575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8787848181106104ec576104ec6119ad565b90506020020160208101906105019190611990565b6001600160a01b0316145b156105c6576000836001600160a01b03168260405160006040518083038185875af1925050503d806000811461055e576040519150601f19603f3d011682016040523d82523d6000602084013e610563565b606091505b505090506105c0816040518060400160405280600a81526020016973656e64546f6b656e7360b01b815250604051806040016040528060148152602001733330b4b632b2103a379039b2b7321022ba3432b960611b815250611148565b50610602565b61060283828989868181106105dd576105dd6119ad565b90506020020160208101906105f29190611990565b6001600160a01b031691906110e5565b50600101610432565b505050505050565b60405162461bcd60e51b8152602060048201526014602482015273496e76616c696420706f73742070726f6365737360601b60448201526064015b60405180910390fd5b604080518082018252600d81526c636865636b536c69707061676560981b6020808301919091528251808401909352601d83527f746f6b656e20616e6420616d6f756e7420646f206e6f74206d61746368000000908301526106bd918584149190611148565b60005b8381101561092d5760008585838181106106dc576106dc6119ad565b90506020020160208101906106f19190611990565b6001600160a01b0316141561078557828282818110610712576107126119ad565b9050602002013547101561078057600061072b82611157565b61073447611157565b6040516020016107459291906119c3565b60408051601f19818403018152828201909152600d82526c636865636b536c69707061676560981b6020830152915061077e9082611269565b505b610925565b828282818110610797576107976119ad565b905060200201358585838181106107b0576107b06119ad565b90506020020160208101906107c59190611990565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa15801561080b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082f9190611a12565b101561092557600061084082611157565b6108d9878785818110610855576108556119ad565b905060200201602081019061086a9190611990565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a12565b611157565b6040516020016108ea9291906119c3565b60408051601f19818403018152828201909152600d82526c636865636b536c69707061676560981b602083015291506109239082611269565b505b6001016106c0565b5050505050565b6000818154811061094457600080fd5b600091825260209091200154905081565b6109ac8282905085859050146040518060400160405280601481526020017373656e64546f6b656e546f41646472657373657360601b815250604051806060016040528060228152602001611bb460229139611148565b6109b5856112c0565b15610a505760005b83811015610a4a5760008585838181106109d9576109d96119ad565b905060200201351115610a4257610a428383838181106109fb576109fb6119ad565b9050602002016020810190610a109190611990565b868684818110610a2257610a226119ad565b90506020020135886001600160a01b03166110e59092919063ffffffff16565b6001016109bd565b5061092d565b60005b8381101561060b576000858583818110610a6f57610a6f6119ad565b905060200201351115610b75576000838383818110610a9057610a906119ad565b9050602002016020810190610aa59190611990565b6001600160a01b0316868684818110610ac057610ac06119ad565b9050602002013560405160006040518083038185875af1925050503d8060008114610b07576040519150601f19603f3d011682016040523d82523d6000602084013e610b0c565b606091505b50509050610b73816040518060400160405280601481526020017373656e64546f6b656e546f41646472657373657360601b815250604051806040016040528060148152602001733330b4b632b2103a379039b2b7321022ba3432b960611b815250611148565b505b600101610a53565b606060008267ffffffffffffffff811115610b9a57610b9a611a2b565b604051908082528060200260200182016040528015610bc3578160200160208202803683370190505b50905060005b83811015610c71576000858583818110610be557610be56119ad565b9050602002016020810190610bfa9190611990565b90506001600160a01b03811615801590610c3157506001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14155b15610c3f57610c3f816112fc565b610c4b81600019611026565b838381518110610c5d57610c5d6119ad565b602090810291909101015250600101610bc9565b5090505b92915050565b8015610d2b57604051600090419083908381818185875af1925050503d8060008114610cc3576040519150601f19603f3d011682016040523d82523d6000602084013e610cc8565b606091505b5050905061042b816040518060400160405280601081526020016f39b2b73222ba3432b92a37a6b4b732b960811b815250604051806040016040528060148152602001733330b4b632b2103a379039b2b7321022ba3432b960611b815250611148565b50565b6000610c7582600019611026565b60408051808201825260068152651a5b9a9958dd60d21b6020808301919091528251808401909352601f83527f746f6b656e20616e6420616d6f756e7420646f6573206e6f74206d617463680090830152606091610d9d9186851491611148565b6000610df07fb2f2618cecbbb6e7468cc0f2aa43858ad8d153e0280b22285e28e853bb9d453a60005260016020527fe066822ceb6294079ebca45035319f95ccb12306128dbdf5a257f0d1235733c95490565b90506000610dfe600161133b565b90506000610e0c6001611370565b905060008567ffffffffffffffff811115610e2957610e29611a2b565b604051908082528060200260200182016040528015610e52578160200160208202803683370190505b50905060005b8881101561101957610eb685308a8a85818110610e7757610e776119ad565b905060200201358d8d86818110610e9057610e906119ad565b9050602002016020810190610ea59190611990565b6001600160a01b03169291906113a5565b8315610faa576000610ee0898984818110610ed357610ed36119ad565b90506020020135866113e3565b9050610ef984828d8d868181106105dd576105dd6119ad565b80898984818110610f0c57610f0c6119ad565b90506020020135610f1d9190611a57565b838381518110610f2f57610f2f6119ad565b6020026020010181815250508a8a83818110610f4d57610f4d6119ad565b9050602002016020810190610f629190611990565b6001600160a01b03167ff842076a30ec58e71f31f5ded044f2790b403c5a75bdbfddea03130ee65e1a5882604051610f9c91815260200190565b60405180910390a250610fe2565b878782818110610fbc57610fbc6119ad565b90506020020135828281518110610fd557610fd56119ad565b6020026020010181815250505b6110118a8a83818110610ff757610ff76119ad565b905060200201602081019061100c9190611990565b6112fc565b600101610e58565b5098975050505050505050565b60006000198214611038575080610c75565b6001600160a01b038316158061106a57506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b15611076575047610c75565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa1580156110ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110de9190611a12565b9392505050565b6040516001600160a01b03831660248201526044810182905261036a90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611402565b8261036a5761036a8282611269565b60608161117b5750506040805180820190915260018152600360fc1b602082015290565b6000825b80156111a5578161118f81611a6e565b925061119e9050600a82611a9f565b905061117f565b5060008167ffffffffffffffff8111156111c1576111c1611a2b565b6040519080825280601f01601f1916602001820160405280156111eb576020820181803683370190505b509050815b801561126157611201600a86611ab3565b61120c906030611ac7565b60f81b8261121b600184611a57565b8151811061122b5761122b6119ad565b60200101906001600160f81b031916908160001a90535061124d600a86611a9f565b94508061125981611adf565b9150506111f0565b509392505050565b6040805180820190915260068152654846756e647360d01b6020820152828260405160200161129a93929190611af6565b60408051601f198184030181529082905262461bcd60e51b825261064e9160040161195d565b60006001600160a01b03821615801590610c7557506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141592915050565b600080546001810182559080526001600160a01b0382167f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5639091015550565b7f142183525227cae0e4300fd0fc77d7f3b08ceb0fd9cb2a6c5488668fa0ea5ffa600090815260208290526040812054610c75565b7f60d7a7cc0a45d852bd613e4f527aaa2e4b81fff918a69a2aab88b6458751d614600090815260208290526040812054610c75565b6040516001600160a01b03808516602483015283166044820152606481018290526113dd9085906323b872dd60e01b90608401611111565b50505050565b6000670de0b6b3a76400006113f88385611b56565b6110de9190611a9f565b6000611457826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114d49092919063ffffffff16565b80519091501561036a57808060200190518101906114759190611b75565b61036a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161064e565b60606114e384846000856114eb565b949350505050565b60608247101561154c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161064e565b843b61159a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161064e565b600080866001600160a01b031685876040516115b69190611b97565b60006040518083038185875af1925050503d80600081146115f3576040519150601f19603f3d011682016040523d82523d6000602084013e6115f8565b606091505b5091509150611608828286611613565b979650505050505050565b606083156116225750816110de565b8251156116325782518084602001fd5b8160405162461bcd60e51b815260040161064e919061195d565b60008083601f84011261165e57600080fd5b50813567ffffffffffffffff81111561167657600080fd5b6020830191508360208260051b850101111561169157600080fd5b9250929050565b600080600080604085870312156116ae57600080fd5b843567ffffffffffffffff808211156116c657600080fd5b6116d28883890161164c565b909650945060208701359150808211156116eb57600080fd5b506116f88782880161164c565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b8181101561173c57835183529284019291840191600101611720565b50909695505050505050565b6001600160a01b0381168114610d2b57600080fd5b60008060006060848603121561177257600080fd5b833561177d81611748565b925060208401359150604084013561179481611748565b809150509250925092565b600080604083850312156117b257600080fd5b8235915060208301356117c481611748565b809150509250929050565b6000806000806000606086880312156117e757600080fd5b853567ffffffffffffffff808211156117ff57600080fd5b61180b89838a0161164c565b9097509550602088013591508082111561182457600080fd5b506118318882890161164c565b909450925050604086013561184581611748565b809150509295509295909350565b60006020828403121561186557600080fd5b5035919050565b60008060008060006060868803121561188457600080fd5b853561188f81611748565b9450602086013567ffffffffffffffff808211156118ac57600080fd5b6118b889838a0161164c565b909650945060408801359150808211156118d157600080fd5b506118de8882890161164c565b969995985093965092949392505050565b6000806020838503121561190257600080fd5b823567ffffffffffffffff81111561191957600080fd5b6119258582860161164c565b90969095509350505050565b60005b8381101561194c578181015183820152602001611934565b838111156113dd5750506000910152565b602081526000825180602084015261197c816040850160208701611931565b601f01601f19169190910160400192915050565b6000602082840312156119a257600080fd5b81356110de81611748565b634e487b7160e01b600052603260045260246000fd5b66032b93937b91d160cd1b8152600083516119e5816007850160208801611931565b605f60f81b6007918401918201528351611a06816008840160208801611931565b01600801949350505050565b600060208284031215611a2457600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082821015611a6957611a69611a41565b500390565b6000600019821415611a8257611a82611a41565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611aae57611aae611a89565b500490565b600082611ac257611ac2611a89565b500690565b60008219821115611ada57611ada611a41565b500190565b600081611aee57611aee611a41565b506000190190565b60008451611b08818460208901611931565b605f60f81b9083019081528451611b26816001840160208901611931565b6101d160f51b600192909101918201528351611b49816003840160208801611931565b0160030195945050505050565b6000816000190483118215151615611b7057611b70611a41565b500290565b600060208284031215611b8757600080fd5b815180151581146110de57600080fd5b60008251611ba9818460208701611931565b919091019291505056fe616d6f756e7420616e6420726563656976657220646f6573206e6f74206d61746368a2646970667358221220bc4d695180dbe3ae43896e2faf3136e7af67abc1f401802cb3d896211810643264736f6c634300080a0033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.