Address Contract Verified
Address
0x18a0f3F937DD0FA150d152375aE5A4E941d1527b
Balance
0 ETH
Nonce
1
Code Size
1964 bytes
Creator
0x09572935...835b at tx 0x21a308b8...a21e51
Indexed Transactions
0
Contract Bytecode
1964 bytes
0x6080604052600436106100435760003560e01c806323d8817a1461004f5780633fc8cef3146100645780637e902d57146100c1578063f4e8cd69146100e657600080fd5b3661004a57005b600080fd5b61006261005d36600461061f565b6100f9565b005b34801561007057600080fd5b506100987f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100cd57600080fd5b5061009870893a26168158fbeadd9335be5bc96592e281565b6100626100f4366004610672565b610393565b6040517f8367080f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301526024820184905260009190861690638367080f90604401602060405180830381865afa158015610170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061019491906106e2565b905060006101a282346106fb565b90507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561020c57600080fd5b505af1158015610220573d6000803e3d6000fd5b50506040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a8116600483015260001960248301527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216935063095ea7b3925060440190506020604051808303816000875af11580156102bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e09190610735565b5060006102ec86610547565b6040517f864f6a7a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152602482018590526044820188905286811660648301529192509088169063864f6a7a9085906084015b6000604051808303818588803b15801561037157600080fd5b505af1158015610385573d6000803e3d6000fd5b505050505050505050505050565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810184905273ffffffffffffffffffffffffffffffffffffffff8716906323b872dd906064016020604051808303816000875af115801561040c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104309190610735565b506040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152600019602483015287169063095ea7b3906044016020604051808303816000875af11580156104a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104cb9190610735565b5060006104d785610547565b6040517f864f6a7a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8083166004830152602482018790526044820186905284811660648301529192509087169063864f6a7a903490608401610358565b600081156105e5576040517f8cb84e180000000000000000000000000000000000000000000000000000000081523360048201526000602482015270893a26168158fbeadd9335be5bc96592e290638cb84e1890604401602060405180830381865afa1580156105bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105df9190610759565b92915050565b5033919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461060e57600080fd5b50565b801515811461060e57600080fd5b6000806000806080858703121561063557600080fd5b8435610640816105ec565b9350602085013561065081610611565b9250604085013591506060850135610667816105ec565b939692955090935050565b60008060008060008060c0878903121561068b57600080fd5b8635610696816105ec565b955060208701356106a6816105ec565b945060408701356106b681610611565b9350606087013592506080870135915060a08701356106d4816105ec565b809150509295509295509295565b6000602082840312156106f457600080fd5b5051919050565b818103818111156105df577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006020828403121561074757600080fd5b815161075281610611565b9392505050565b60006020828403121561076b57600080fd5b8151610752816105ec56fea2646970667358221220b0d419648160dbf66f804445469b0f5031d6bc2712e7878f7c23ec7858d7c62864736f6c63430008150033
Verified Source Code Full Match
Compiler: v0.8.21+commit.d9974bed
EVM: paris
Optimization: Yes (2000 runs)
IWETH.sol 7 lines
pragma solidity >=0.5.0;
interface IWETH {
function deposit() external payable;
function transfer(address to, uint256 value) external returns (bool);
function withdraw(uint256) external;
}
ISocketVault.sol 13 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
interface ISocketVault {
function depositToAppChain(address receiver_, uint256 amount_, uint256 msgGasLimit_, address connector_)
external
payable;
function __token() external view returns (address);
function getMinFees(address connector, uint256 minGasLimit) external view returns (uint256);
}
LyraDepositWrapper.sol 72 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import {IERC20} from "../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {IWETH} from "../interfaces/IWETH.sol";
import {ISocketVault} from "../interfaces/ISocketVault.sol";
import {ILightAccountFactory} from "../interfaces/ILightAccountFactory.sol";
/**
* @title LyraDepositWrapper
* @dev Helper contract to wrap ETH into L2 WETH, or deposit any token to L2 smart contract wallet address
*/
contract LyraDepositWrapper {
///@dev L2 USDC address.
address public immutable weth;
///@dev Light Account factory address.
address public constant lightAccountFactory = 0x000000893A26168158fbeaDD9335Be5bC96592E2;
constructor(address _weth) {
weth = _weth;
}
/**
* @notice Wrap ETH into WETH and deposit to Lyra Chain via socket vault
*/
function depositETHToLyra(address socketVault, bool isSCW, uint256 gasLimit, address connector) external payable {
uint256 socketFee = ISocketVault(socketVault).getMinFees(connector, gasLimit);
uint256 depositAmount = msg.value - socketFee;
IWETH(weth).deposit{value: depositAmount}();
IERC20(weth).approve(socketVault, type(uint256).max);
address recipient = _getL2Receiver(isSCW);
ISocketVault(socketVault).depositToAppChain{value: socketFee}(recipient, depositAmount, gasLimit, connector);
}
/**
* @notice Deposit any token to Lyra Chain via socket vault.
* @dev This function help calculate L2 smart wallet addresses for users
*/
function depositToLyra(
address token,
address socketVault,
bool isSCW,
uint256 amount,
uint256 gasLimit,
address connector
) external payable {
IERC20(token).transferFrom(msg.sender, address(this), amount);
IERC20(token).approve(socketVault, type(uint256).max);
address recipient = _getL2Receiver(isSCW);
ISocketVault(socketVault).depositToAppChain{value: msg.value}(recipient, amount, gasLimit, connector);
}
/**
* @notice Return the receiver address on L2
*/
function _getL2Receiver(bool isScwWallet) internal view returns (address) {
if (isScwWallet) {
return ILightAccountFactory(lightAccountFactory).getAddress(msg.sender, 0);
} else {
return msg.sender;
}
}
receive() external payable {}
}
ILightAccountFactory.sol 23 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
interface ILightAccountFactory {
/**
* @notice Create an account, and return its address.
* Returns the address even if the account is already deployed.
* @dev During UserOperation execution, this method is called only if the account is not deployed.
* This method returns an existing account address so that entryPoint.getSenderAddress() would work even after account creation.
* @param owner The owner of the account to be created
* @param salt A salt, which can be changed to create multiple accounts with the same owner
* @return ret The address of either the newly deployed account or an existing account with this owner and salt
*/
function createAccount(address owner, uint256 salt) external returns (address ret);
/**
* @notice Calculate the counterfactual address of this account as it would be returned by createAccount()
* @param owner The owner of the account to be created
* @param salt A salt, which can be changed to create multiple accounts with the same owner
* @return The address of the account that would be created with createAccount()
*/
function getAddress(address owner, uint256 salt) external view returns (address);
}
IERC20.sol 78 lines
// 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);
}
Read Contract
lightAccountFactory 0x7e902d57 → address
weth 0x3fc8cef3 → address
Write Contract 2 functions
These functions modify contract state and require a wallet transaction to execute.
depositETHToLyra 0x23d8817a
address socketVault
bool isSCW
uint256 gasLimit
address connector
depositToLyra 0xf4e8cd69
address token
address socketVault
bool isSCW
uint256 amount
uint256 gasLimit
address connector
Recent Transactions
No transactions found for this address