Source Code
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 107558266 | 835 days ago | 0 ETH | ||||
| 107558218 | 835 days ago | 0 ETH | ||||
| 107558178 | 835 days ago | 0 ETH | ||||
| 107558071 | 835 days ago | 0 ETH | ||||
| 107558013 | 835 days ago | 0 ETH | ||||
| 107557997 | 835 days ago | 0 ETH | ||||
| 107557969 | 835 days ago | 0 ETH | ||||
| 107557811 | 835 days ago | 0 ETH | ||||
| 107557794 | 835 days ago | 0 ETH | ||||
| 107557600 | 835 days ago | 0 ETH | ||||
| 107557596 | 835 days ago | 0 ETH | ||||
| 107557588 | 835 days ago | 0 ETH | ||||
| 107557454 | 835 days ago | 0 ETH | ||||
| 107557276 | 835 days ago | 0 ETH | ||||
| 107557235 | 835 days ago | 0 ETH | ||||
| 107557214 | 835 days ago | 0 ETH | ||||
| 107557064 | 835 days ago | 0 ETH | ||||
| 107556982 | 835 days ago | 0 ETH | ||||
| 107556842 | 835 days ago | 0 ETH | ||||
| 107556603 | 835 days ago | 0 ETH | ||||
| 107556586 | 835 days ago | 0 ETH | ||||
| 107556531 | 835 days ago | 0 ETH | ||||
| 107556500 | 835 days ago | 0 ETH | ||||
| 107556500 | 835 days ago | 0 ETH | ||||
| 107556470 | 835 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
WidgetSwap
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
pragma abicoder v2;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IStargateRouter.sol";
import "../interfaces/IStargateRouterETH.sol";
import "../interfaces/IStargateFactory.sol";
import "../interfaces/IStargateWidget.sol";
contract WidgetSwap is ReentrancyGuard, IStargateWidget {
using SafeERC20 for IERC20;
IStargateRouter public immutable stargateRouter;
IStargateRouterETH public immutable stargateRouterETH;
IStargateFactory public immutable stargateFactory;
uint256 public constant TENTH_BPS_DENOMINATOR = 100000;
constructor(address _stargateRouter, address _stargateRouterETH, address _stargateFactory) {
stargateRouter = IStargateRouter(_stargateRouter);
stargateRouterETH = IStargateRouterETH(_stargateRouterETH);
stargateFactory = IStargateFactory(_stargateFactory);
}
// allow anyone to emit this msg alongside their stargate tx so they can get credited for their referral
// to get credit this event must be emitted in the same tx as a stargate swap event
function partnerSwap(bytes2 _partnerId) external override {
emit PartnerSwap(_partnerId);
}
function swapTokens(
uint16 _dstChainId,
uint16 _srcPoolId,
uint16 _dstPoolId,
uint256 _amountLD,
uint256 _minAmountLD,
IStargateRouter.lzTxObj calldata _lzTxParams,
bytes calldata _to,
bytes2 _partnerId,
FeeObj calldata _feeObj
) external override nonReentrant payable {
uint256 widgetFee = _getAndPayWidgetFee(_srcPoolId, _amountLD, _feeObj);
stargateRouter.swap{value:msg.value}(
_dstChainId,
_srcPoolId,
_dstPoolId,
payable(msg.sender),
_amountLD - widgetFee,
_minAmountLD,
_lzTxParams,
_to,
"0x"
);
emit WidgetSwapped(_partnerId, _feeObj.tenthBps, widgetFee);
}
function swapETH(
uint16 _dstChainId,
uint256 _amountLD,
uint256 _minAmountLD,
bytes calldata _to,
bytes2 _partnerId,
FeeObj calldata _feeObj
) external override nonReentrant payable {
// allows us to deploy same contract on non eth chains
require(address(stargateRouterETH) != address(0x0), "WidgetSwap: func not available");
uint256 widgetFee = _getAndPayWidgetFeeETH(_amountLD, _feeObj);
// "value:" contains the amount of eth to swap and the stargate/layerZero fees, minus the widget fee
stargateRouterETH.swapETH{value:msg.value - widgetFee}(
_dstChainId,
payable(msg.sender),
_to,
_amountLD - widgetFee,
_minAmountLD
);
emit WidgetSwapped(_partnerId, _feeObj.tenthBps, widgetFee);
}
function _getAndPayWidgetFee(
uint16 _srcPoolId,
uint256 _amountLD,
FeeObj calldata _feeObj
) internal returns (uint256 widgetFee) {
// corresponding token to the poolId
address token = stargateFactory.getPool(_srcPoolId).token();
// move all the tokens to this contract
IERC20(token).safeTransferFrom(msg.sender, address(this), _amountLD);
// calculate the widgetFee
widgetFee = _amountLD * _feeObj.tenthBps / TENTH_BPS_DENOMINATOR;
// pay the widget fee
IERC20(token).safeTransfer(_feeObj.feeCollector, widgetFee);
// allow stargateRouter to spend the tokens to be transferred
IERC20(token).approve(address(stargateRouter), _amountLD - widgetFee);
return widgetFee;
}
function _getAndPayWidgetFeeETH(
uint256 _amountLD,
FeeObj calldata _feeObj
) internal returns (uint256 widgetFee) {
// calculate the widgetFee
widgetFee = _amountLD * _feeObj.tenthBps / TENTH_BPS_DENOMINATOR;
require(msg.value > widgetFee, "WidgetSwap: not enough eth for widgetFee");
// verify theres enough eth to cover the amount to swap
require(msg.value - widgetFee > _amountLD, "WidgetSwap: not enough eth for swap");
// pay the widget fee
(bool success, ) = _feeObj.feeCollector.call{value: widgetFee}("");
require(success, "WidgetSwap: failed to transfer widgetFee");
return widgetFee;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
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.4;
pragma abicoder v2;
interface IStargateRouter {
struct lzTxObj {
uint256 dstGasForCall;
uint256 dstNativeAmount;
bytes dstNativeAddr;
}
function addLiquidity(
uint256 _poolId,
uint256 _amountLD,
address _to
) external;
function swap(
uint16 _dstChainId,
uint256 _srcPoolId,
uint256 _dstPoolId,
address payable _refundAddress,
uint256 _amountLD,
uint256 _minAmountLD,
lzTxObj memory _lzTxParams,
bytes calldata _to,
bytes calldata _payload
) external payable;
function redeemRemote(
uint16 _dstChainId,
uint256 _srcPoolId,
uint256 _dstPoolId,
address payable _refundAddress,
uint256 _amountLP,
uint256 _minAmountLD,
bytes calldata _to,
lzTxObj memory _lzTxParams
) external payable;
function instantRedeemLocal(
uint16 _srcPoolId,
uint256 _amountLP,
address _to
) external returns (uint256);
function redeemLocal(
uint16 _dstChainId,
uint256 _srcPoolId,
uint256 _dstPoolId,
address payable _refundAddress,
uint256 _amountLP,
bytes calldata _to,
lzTxObj memory _lzTxParams
) external payable;
function sendCredits(
uint16 _dstChainId,
uint256 _srcPoolId,
uint256 _dstPoolId,
address payable _refundAddress
) external payable;
function quoteLayerZeroFee(
uint16 _dstChainId,
uint8 _functionType,
bytes calldata _toAddress,
bytes calldata _transferAndCallPayload,
lzTxObj memory _lzTxParams
) external view returns (uint256, uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
pragma abicoder v2;
interface IStargateRouterETH {
function addLiquidityETH() external payable;
function swapETH(
uint16 dstChainId,
address payable refundAddress,
bytes calldata to,
uint256 amountLD,
uint256 minAmountLD
) external payable;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;
import "./IStargatePool.sol";
interface IStargateFactory {
function getPool(uint256 _srcPoolId) external returns (IStargatePool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
pragma abicoder v2;
import "../interfaces/IStargateRouter.sol";
interface IStargateWidget {
struct FeeObj {
uint256 tenthBps; // bps is to an extra decimal place
address feeCollector;
}
event WidgetSwapped(bytes2 indexed partnerId, uint256 tenthBps, uint256 widgetFee);
event PartnerSwap(bytes2 indexed partnerId);
function partnerSwap(bytes2 _partnerId) external;
function swapTokens(
uint16 _dstChainId,
uint16 _srcPoolId,
uint16 _dstPoolId,
uint256 _amountLD,
uint256 _minAmountLD,
IStargateRouter.lzTxObj calldata _lzTxParams,
bytes calldata _to,
bytes2 _partnerId,
FeeObj calldata _feeObj
) external payable;
function swapETH(
uint16 _dstChainId,
uint256 _amountLD,
uint256 _minAmountLD,
bytes calldata _to,
bytes2 _partnerId,
FeeObj calldata _feeObj
) external payable;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
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 `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);
/**
* @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
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return 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: BUSL-1.1
pragma solidity ^0.8.4;
interface IStargatePool {
function token() external returns (address);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_stargateRouter","type":"address"},{"internalType":"address","name":"_stargateRouterETH","type":"address"},{"internalType":"address","name":"_stargateFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"name":"PartnerSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes2","name":"partnerId","type":"bytes2"},{"indexed":false,"internalType":"uint256","name":"tenthBps","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"widgetFee","type":"uint256"}],"name":"WidgetSwapped","type":"event"},{"inputs":[],"name":"TENTH_BPS_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes2","name":"_partnerId","type":"bytes2"}],"name":"partnerSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stargateFactory","outputs":[{"internalType":"contract IStargateFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stargateRouter","outputs":[{"internalType":"contract IStargateRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stargateRouterETH","outputs":[{"internalType":"contract IStargateRouterETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_amountLD","type":"uint256"},{"internalType":"uint256","name":"_minAmountLD","type":"uint256"},{"internalType":"bytes","name":"_to","type":"bytes"},{"internalType":"bytes2","name":"_partnerId","type":"bytes2"},{"components":[{"internalType":"uint256","name":"tenthBps","type":"uint256"},{"internalType":"address","name":"feeCollector","type":"address"}],"internalType":"struct IStargateWidget.FeeObj","name":"_feeObj","type":"tuple"}],"name":"swapETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_srcPoolId","type":"uint16"},{"internalType":"uint16","name":"_dstPoolId","type":"uint16"},{"internalType":"uint256","name":"_amountLD","type":"uint256"},{"internalType":"uint256","name":"_minAmountLD","type":"uint256"},{"components":[{"internalType":"uint256","name":"dstGasForCall","type":"uint256"},{"internalType":"uint256","name":"dstNativeAmount","type":"uint256"},{"internalType":"bytes","name":"dstNativeAddr","type":"bytes"}],"internalType":"struct IStargateRouter.lzTxObj","name":"_lzTxParams","type":"tuple"},{"internalType":"bytes","name":"_to","type":"bytes"},{"internalType":"bytes2","name":"_partnerId","type":"bytes2"},{"components":[{"internalType":"uint256","name":"tenthBps","type":"uint256"},{"internalType":"address","name":"feeCollector","type":"address"}],"internalType":"struct IStargateWidget.FeeObj","name":"_feeObj","type":"tuple"}],"name":"swapTokens","outputs":[],"stateMutability":"payable","type":"function"}]Contract Creation Code
60e060405234801561001057600080fd5b506040516111cb3803806111cb83398101604081905261002f91610077565b60016000556001600160601b0319606093841b811660805291831b821660a05290911b1660c0526100b9565b80516001600160a01b038116811461007257600080fd5b919050565b60008060006060848603121561008b578283fd5b6100948461005b565b92506100a26020850161005b565b91506100b06040850161005b565b90509250925092565b60805160601c60a05160601c60c05160601c6110b961011260003960008181609c015261052501526000818160ed0152818161035401526103e001526000818161015401528181610209015261067a01526110b96000f3fe6080604052600436106100705760003560e01c8063919d76371161004e578063919d76371461010f578063a87376e914610122578063a9e56f3c14610142578063beaeb55a1461017657600080fd5b80632d62fc1a1461007557806330e7a49b1461008a5780638e0f64d3146100db575b600080fd5b610088610083366004610cce565b61019b565b005b34801561009657600080fd5b506100be7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100e757600080fd5b506100be7f000000000000000000000000000000000000000000000000000000000000000081565b61008861011d366004610da5565b6102fa565b34801561012e57600080fd5b5061008861013d366004610cb4565b6104c7565b34801561014e57600080fd5b506100be7f000000000000000000000000000000000000000000000000000000000000000081565b34801561018257600080fd5b5061018d620186a081565b6040519081526020016100d2565b600260005414156101f35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260009081556102058a89846104ff565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639fbf10fc348d8d8d33878f6102479190611012565b8e8e8e8e6040518b63ffffffff1660e01b815260040161026f99989796959493929190610ee9565b6000604051808303818588803b15801561028857600080fd5b505af115801561029c573d6000803e3d6000fd5b50506040805186358152602081018690526001600160f01b0319881694507fe005092a469280dafcad91e38921cc6f96eac91d73413489fd8719634163345e935001905060405180910390a250506001600055505050505050505050565b6002600054141561034d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ea565b60026000557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166103c85760405162461bcd60e51b815260206004820152601e60248201527f576964676574537761703a2066756e63206e6f7420617661696c61626c65000060448201526064016101ea565b60006103d4878361072b565b90506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016631114cd2a61040f8334611012565b8a33898961041d888f611012565b8d6040518863ffffffff1660e01b815260040161043f96959493929190610ea5565b6000604051808303818588803b15801561045857600080fd5b505af115801561046c573d6000803e3d6000fd5b50506040805186358152602081018690526001600160f01b0319881694507fe005092a469280dafcad91e38921cc6f96eac91d73413489fd8719634163345e935001905060405180910390a250506001600055505050505050565b6040516001600160f01b03198216907f85ce809fd9fd62b920fadc9d3a3a8e642d3969bf635276bfbdde866acce409fc90600090a250565b60405163068bcd8d60e01b815261ffff8416600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063068bcd8d90602401602060405180830381600087803b15801561056957600080fd5b505af115801561057d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a19190610c78565b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156105db57600080fd5b505af11580156105ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106139190610c78565b905061062a6001600160a01b0382163330876108d6565b620186a0610639843586610ff3565b6106439190610fd3565b91506106696106586040850160208601610c5c565b6001600160a01b0383169084610947565b6001600160a01b03811663095ea7b37f00000000000000000000000000000000000000000000000000000000000000006106a38588611012565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156106e957600080fd5b505af11580156106fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107219190610c94565b50505b9392505050565b6000620186a061073c833585610ff3565b6107469190610fd3565b90508034116107a85760405162461bcd60e51b815260206004820152602860248201527f576964676574537761703a206e6f7420656e6f7567682065746820666f722077604482015267696467657446656560c01b60648201526084016101ea565b826107b38234611012565b1161080c5760405162461bcd60e51b815260206004820152602360248201527f576964676574537761703a206e6f7420656e6f7567682065746820666f72207360448201526207761760ec1b60648201526084016101ea565b600061081e6040840160208501610c5c565b6001600160a01b03168260405160006040518083038185875af1925050503d8060008114610868576040519150601f19603f3d011682016040523d82523d6000602084013e61086d565b606091505b50509050806108cf5760405162461bcd60e51b815260206004820152602860248201527f576964676574537761703a206661696c656420746f207472616e736665722077604482015267696467657446656560c01b60648201526084016101ea565b5092915050565b6040516001600160a01b03808516602483015283166044820152606481018290526109419085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261097c565b50505050565b6040516001600160a01b03831660248201526044810182905261097790849063a9059cbb60e01b9060640161090a565b505050565b60006109d1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610a4e9092919063ffffffff16565b80519091501561097757808060200190518101906109ef9190610c94565b6109775760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ea565b6060610a5d8484600085610a65565b949350505050565b606082471015610ac65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ea565b6001600160a01b0385163b610b1d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ea565b600080866001600160a01b03168587604051610b399190610e56565b60006040518083038185875af1925050503d8060008114610b76576040519150601f19603f3d011682016040523d82523d6000602084013e610b7b565b606091505b5091509150610b8b828286610b96565b979650505050505050565b60608315610ba5575081610724565b825115610bb55782518084602001fd5b8160405162461bcd60e51b81526004016101ea9190610e72565b80356001600160f01b031981168114610be757600080fd5b919050565b60008083601f840112610bfd578182fd5b50813567ffffffffffffffff811115610c14578182fd5b602083019150836020828501011115610c2c57600080fd5b9250929050565b600060408284031215610c44578081fd5b50919050565b803561ffff81168114610be757600080fd5b600060208284031215610c6d578081fd5b81356107248161106b565b600060208284031215610c89578081fd5b81516107248161106b565b600060208284031215610ca5578081fd5b81518015158114610724578182fd5b600060208284031215610cc5578081fd5b61072482610bcf565b6000806000806000806000806000806101408b8d031215610ced578586fd5b610cf68b610c4a565b9950610d0460208c01610c4a565b9850610d1260408c01610c4a565b975060608b0135965060808b0135955060a08b013567ffffffffffffffff80821115610d3c578687fd5b908c01906060828f031215610d4f578687fd5b90955060c08c01359080821115610d64578586fd5b50610d718d828e01610bec565b9095509350610d84905060e08c01610bcf565b9150610d948c6101008d01610c33565b90509295989b9194979a5092959850565b600080600080600080600060e0888a031215610dbf578283fd5b610dc888610c4a565b96506020880135955060408801359450606088013567ffffffffffffffff811115610df1578384fd5b610dfd8a828b01610bec565b9095509350610e10905060808901610bcf565b9150610e1f8960a08a01610c33565b905092959891949750929550565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008251610e68818460208701611029565b9190910192915050565b6020815260008251806020840152610e91816040850160208701611029565b601f01601f19169190910160400192915050565b61ffff871681526001600160a01b038616602082015260a060408201819052600090610ed49083018688610e2d565b60608301949094525060800152949350505050565b600061012061ffff808d168452808c166020850152808b1660408501525060018060a01b03891660608401528760808401528660a08401528060c08401528535818401525060208501356101408301526040850135601e19863603018112610f4f578182fd5b8501803567ffffffffffffffff811115610f67578283fd5b803603871315610f75578283fd5b6060610160850152610f8f61018085018260208501610e2d565b91505082810360e0840152610fa5818587610e2d565b8381036101008501526002815261060f60f31b60208201529050604081019c9b505050505050505050505050565b600082610fee57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561100d5761100d611055565b500290565b60008282101561102457611024611055565b500390565b60005b8381101561104457818101518382015260200161102c565b838111156109415750506000910152565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461108057600080fd5b5056fea26469706673582212206de9399256b1ded278c005d985fab531c678b670113b63c8447f08f32eccdce464736f6c63430008040033000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b000000000000000000000000b49c4e680174e331cb0a7ff3ab58afc9738d5f8b000000000000000000000000e3b53af74a4bf62ae5511055290838050bf764df
Deployed Bytecode
0x6080604052600436106100705760003560e01c8063919d76371161004e578063919d76371461010f578063a87376e914610122578063a9e56f3c14610142578063beaeb55a1461017657600080fd5b80632d62fc1a1461007557806330e7a49b1461008a5780638e0f64d3146100db575b600080fd5b610088610083366004610cce565b61019b565b005b34801561009657600080fd5b506100be7f000000000000000000000000e3b53af74a4bf62ae5511055290838050bf764df81565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100e757600080fd5b506100be7f000000000000000000000000b49c4e680174e331cb0a7ff3ab58afc9738d5f8b81565b61008861011d366004610da5565b6102fa565b34801561012e57600080fd5b5061008861013d366004610cb4565b6104c7565b34801561014e57600080fd5b506100be7f000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b81565b34801561018257600080fd5b5061018d620186a081565b6040519081526020016100d2565b600260005414156101f35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260009081556102058a89846104ff565b90507f000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b6001600160a01b0316639fbf10fc348d8d8d33878f6102479190611012565b8e8e8e8e6040518b63ffffffff1660e01b815260040161026f99989796959493929190610ee9565b6000604051808303818588803b15801561028857600080fd5b505af115801561029c573d6000803e3d6000fd5b50506040805186358152602081018690526001600160f01b0319881694507fe005092a469280dafcad91e38921cc6f96eac91d73413489fd8719634163345e935001905060405180910390a250506001600055505050505050505050565b6002600054141561034d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ea565b60026000557f000000000000000000000000b49c4e680174e331cb0a7ff3ab58afc9738d5f8b6001600160a01b03166103c85760405162461bcd60e51b815260206004820152601e60248201527f576964676574537761703a2066756e63206e6f7420617661696c61626c65000060448201526064016101ea565b60006103d4878361072b565b90506001600160a01b037f000000000000000000000000b49c4e680174e331cb0a7ff3ab58afc9738d5f8b16631114cd2a61040f8334611012565b8a33898961041d888f611012565b8d6040518863ffffffff1660e01b815260040161043f96959493929190610ea5565b6000604051808303818588803b15801561045857600080fd5b505af115801561046c573d6000803e3d6000fd5b50506040805186358152602081018690526001600160f01b0319881694507fe005092a469280dafcad91e38921cc6f96eac91d73413489fd8719634163345e935001905060405180910390a250506001600055505050505050565b6040516001600160f01b03198216907f85ce809fd9fd62b920fadc9d3a3a8e642d3969bf635276bfbdde866acce409fc90600090a250565b60405163068bcd8d60e01b815261ffff8416600482015260009081906001600160a01b037f000000000000000000000000e3b53af74a4bf62ae5511055290838050bf764df169063068bcd8d90602401602060405180830381600087803b15801561056957600080fd5b505af115801561057d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a19190610c78565b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156105db57600080fd5b505af11580156105ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106139190610c78565b905061062a6001600160a01b0382163330876108d6565b620186a0610639843586610ff3565b6106439190610fd3565b91506106696106586040850160208601610c5c565b6001600160a01b0383169084610947565b6001600160a01b03811663095ea7b37f000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b6106a38588611012565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156106e957600080fd5b505af11580156106fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107219190610c94565b50505b9392505050565b6000620186a061073c833585610ff3565b6107469190610fd3565b90508034116107a85760405162461bcd60e51b815260206004820152602860248201527f576964676574537761703a206e6f7420656e6f7567682065746820666f722077604482015267696467657446656560c01b60648201526084016101ea565b826107b38234611012565b1161080c5760405162461bcd60e51b815260206004820152602360248201527f576964676574537761703a206e6f7420656e6f7567682065746820666f72207360448201526207761760ec1b60648201526084016101ea565b600061081e6040840160208501610c5c565b6001600160a01b03168260405160006040518083038185875af1925050503d8060008114610868576040519150601f19603f3d011682016040523d82523d6000602084013e61086d565b606091505b50509050806108cf5760405162461bcd60e51b815260206004820152602860248201527f576964676574537761703a206661696c656420746f207472616e736665722077604482015267696467657446656560c01b60648201526084016101ea565b5092915050565b6040516001600160a01b03808516602483015283166044820152606481018290526109419085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261097c565b50505050565b6040516001600160a01b03831660248201526044810182905261097790849063a9059cbb60e01b9060640161090a565b505050565b60006109d1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610a4e9092919063ffffffff16565b80519091501561097757808060200190518101906109ef9190610c94565b6109775760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ea565b6060610a5d8484600085610a65565b949350505050565b606082471015610ac65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ea565b6001600160a01b0385163b610b1d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ea565b600080866001600160a01b03168587604051610b399190610e56565b60006040518083038185875af1925050503d8060008114610b76576040519150601f19603f3d011682016040523d82523d6000602084013e610b7b565b606091505b5091509150610b8b828286610b96565b979650505050505050565b60608315610ba5575081610724565b825115610bb55782518084602001fd5b8160405162461bcd60e51b81526004016101ea9190610e72565b80356001600160f01b031981168114610be757600080fd5b919050565b60008083601f840112610bfd578182fd5b50813567ffffffffffffffff811115610c14578182fd5b602083019150836020828501011115610c2c57600080fd5b9250929050565b600060408284031215610c44578081fd5b50919050565b803561ffff81168114610be757600080fd5b600060208284031215610c6d578081fd5b81356107248161106b565b600060208284031215610c89578081fd5b81516107248161106b565b600060208284031215610ca5578081fd5b81518015158114610724578182fd5b600060208284031215610cc5578081fd5b61072482610bcf565b6000806000806000806000806000806101408b8d031215610ced578586fd5b610cf68b610c4a565b9950610d0460208c01610c4a565b9850610d1260408c01610c4a565b975060608b0135965060808b0135955060a08b013567ffffffffffffffff80821115610d3c578687fd5b908c01906060828f031215610d4f578687fd5b90955060c08c01359080821115610d64578586fd5b50610d718d828e01610bec565b9095509350610d84905060e08c01610bcf565b9150610d948c6101008d01610c33565b90509295989b9194979a5092959850565b600080600080600080600060e0888a031215610dbf578283fd5b610dc888610c4a565b96506020880135955060408801359450606088013567ffffffffffffffff811115610df1578384fd5b610dfd8a828b01610bec565b9095509350610e10905060808901610bcf565b9150610e1f8960a08a01610c33565b905092959891949750929550565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008251610e68818460208701611029565b9190910192915050565b6020815260008251806020840152610e91816040850160208701611029565b601f01601f19169190910160400192915050565b61ffff871681526001600160a01b038616602082015260a060408201819052600090610ed49083018688610e2d565b60608301949094525060800152949350505050565b600061012061ffff808d168452808c166020850152808b1660408501525060018060a01b03891660608401528760808401528660a08401528060c08401528535818401525060208501356101408301526040850135601e19863603018112610f4f578182fd5b8501803567ffffffffffffffff811115610f67578283fd5b803603871315610f75578283fd5b6060610160850152610f8f61018085018260208501610e2d565b91505082810360e0840152610fa5818587610e2d565b8381036101008501526002815261060f60f31b60208201529050604081019c9b505050505050505050505050565b600082610fee57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561100d5761100d611055565b500290565b60008282101561102457611024611055565b500390565b60005b8381101561104457818101518382015260200161102c565b838111156109415750506000910152565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461108057600080fd5b5056fea26469706673582212206de9399256b1ded278c005d985fab531c678b670113b63c8447f08f32eccdce464736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b000000000000000000000000b49c4e680174e331cb0a7ff3ab58afc9738d5f8b000000000000000000000000e3b53af74a4bf62ae5511055290838050bf764df
-----Decoded View---------------
Arg [0] : _stargateRouter (address): 0xB0D502E938ed5f4df2E681fE6E419ff29631d62b
Arg [1] : _stargateRouterETH (address): 0xB49c4e680174E331CB0A7fF3Ab58afC9738d5F8b
Arg [2] : _stargateFactory (address): 0xE3B53AF74a4BF62Ae5511055290838050bf764Df
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000b0d502e938ed5f4df2e681fe6e419ff29631d62b
Arg [1] : 000000000000000000000000b49c4e680174e331cb0a7ff3ab58afc9738d5f8b
Arg [2] : 000000000000000000000000e3b53af74a4bf62ae5511055290838050bf764df
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.