Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
SodiumWalletFactory
Compiler Version
v0.8.4+commit.c7e474f2
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2022-10-17 */ // Sources flattened with hardhat v2.10.1 https://hardhat.org // SPDX-License-Identifier: MIT // File @openzeppelin/contracts/proxy/[email protected] // OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore( ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore( add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore( ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore( add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { assembly { let ptr := mload(0x40) mstore( ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore( add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000 ) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } } // File contracts/interfaces/ISodiumWalletFactory.sol pragma solidity ^0.8.0; interface ISodiumWalletFactory { /* ===== EVENTS ===== */ // Emitted when a Sodium Wallet is created for a user event WalletCreated(address indexed owner, address wallet); /* ===== METHODS ===== */ function createWallet(address borrower) external returns (address); } // File contracts/libraries/Types.sol pragma solidity ^0.8.0; // A library containing structs and enums used on the Sodium Protocol library Types { // Indicates type of collateral enum Collateral { ERC721, ERC1155 } // Represents an ongoing loan struct Loan { // Requested loan length uint256 length; // End of loan uint256 end; // End of potential loan auction uint256 auctionEnd; // ID of collateral uint256 tokenId; // Total funds added to the loan uint256 liquidity; // Loan lenders in lending queue order address[] lenders; // In-order principals of lenders in `lenders` uint256[] principals; // In-order APRs of said prinicpals uint256[] APRs; // Timestamps at which contributions of lenders in `lenders` were added uint256[] timestamps; // Address of collateral's contract address tokenAddress; // The currency the loan is made in address currency; // The loan's borrower address borrower; // Address holding loan collateral address wallet; // Debt repaid by borrower uint256 repayment; // Indicates type of collateral Collateral collateralType; } // Encapsulates information required for a lender's meta-transaction struct MetaContribution { // Signature - used to infer meta-lender's address bytes32 r; bytes32 s; uint8 v; // Total funds the meta-lender has offered uint256 available; // The APR the meta-lender has offered said funds at uint256 APR; // The limit up to which the funds can be used to increase loan liquidity uint256 liquidityLimit; // Lender's loan-specific meta-contribution nonce uint256 nonce; } // Encapsulates a collateral auction's state struct Auction { // Address of current highest bidder address bidder; // Their non-boosted bid => equal to the actual funds they sent uint256 rawBid; // Their boosted bid uint256 effectiveBid; } // Parameters for a loan request via Sodium Core struct RequestParams { // The requested amount uint256 amount; // Their starting APR uint256 APR; // Requested length of the loan uint256 length; // Loan currency - zero address used for an ETH loan address currency; } // Contains information needed to validate that a set of meta-contributions have not been withdrawn struct NoWithdrawalSignature { // The deadline up to which the signature is valid uint256 deadline; // Signature uint8 v; bytes32 r; bytes32 s; } // Used to identify a token (ERC721) or type of token struct Token { // Address of the token's contract address tokenAddress; // ID of the token uint256 tokenId; } } // File contracts/interfaces/ISodiumWallet.sol pragma solidity ^0.8.0; interface ISodiumWallet { function initialize( address _owner, address _core, address _registry ) external; function execute( address[] calldata contractAddresses, bytes[] memory calldatas, uint256[] calldata values ) external payable; function transferERC721( address recipient, address tokenAddress, uint256 tokenId ) external; function transferERC1155( address recipient, address tokenAddress, uint256 tokenId ) external; function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4); } // File contracts/SodiumWalletFactory.sol pragma solidity ^0.8.0; /// @notice Simple clone factory for creating minimal proxy Sodium Wallets contract SodiumWalletFactory is ISodiumWalletFactory { /* ===== STATE ===== */ // Wallet implementation contract address public implementation; // The address of the current Sodium Registry address public registry; /* ===== CONSTRUCTOR ===== */ /// @param implementation_ The contract to which wallets deployed by this contract delegate their calls /// @param registry_ Used by the wallets to determine external call permission constructor(address implementation_, address registry_) { implementation = implementation_; registry = registry_; } /* ===== CORE METHODS ===== */ /// @notice Called by the Core to create new wallets /// @dev Deploys a minimal EIP-1167 proxy that delegates its calls to `implementation` /// @param requester The owner of the new wallet function createWallet(address requester) external override returns (address) { // Deploy address wallet = Clones.clone(implementation); // Configure ISodiumWallet(wallet).initialize(requester, msg.sender, registry); emit WalletCreated(requester, wallet); // Pass address back to Core return wallet; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"implementation_","type":"address"},{"internalType":"address","name":"registry_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"wallet","type":"address"}],"name":"WalletCreated","type":"event"},{"inputs":[{"internalType":"address","name":"requester","type":"address"}],"name":"createWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506040516103de3803806103de83398101604081905261002f9161007c565b600080546001600160a01b039384166001600160a01b031991821617909155600180549290931691161790556100ae565b80516001600160a01b038116811461007757600080fd5b919050565b6000806040838503121561008e578182fd5b61009783610060565b91506100a560208401610060565b90509250929050565b610321806100bd6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635c60da1b146100465780637b1039991461008f578063b054a9e8146100af575b600080fd5b6000546100669073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6001546100669073ffffffffffffffffffffffffffffffffffffffff1681565b6100666100bd3660046102b0565b6000805481906100e29073ffffffffffffffffffffffffffffffffffffffff166101ca565b6001546040517fc0c53b8b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152336024830152918216604482015291925082169063c0c53b8b90606401600060405180830381600087803b15801561015f57600080fd5b505af1158015610173573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8481168252861692507f5b03bfed1c14a02bdeceb5fa582eb1a5765fc0bc64ca0e6af4c20afc9487f081915060200160405180910390a292915050565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f091505073ffffffffffffffffffffffffffffffffffffffff81166102ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f455243313136373a20637265617465206661696c656400000000000000000000604482015260640160405180910390fd5b919050565b6000602082840312156102c1578081fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146102e4578182fd5b939250505056fea2646970667358221220ee15f62aab3808c635789c36bafdf4d8feca8a7a1d2ff1e40e369cb02bda387464736f6c634300080400330000000000000000000000006cddedd171ae4f2acf6ad3eb0a67dfaa04fb51be0000000000000000000000004c550042a61cecd13d6b973dd34f999b2eaad61a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100415760003560e01c80635c60da1b146100465780637b1039991461008f578063b054a9e8146100af575b600080fd5b6000546100669073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6001546100669073ffffffffffffffffffffffffffffffffffffffff1681565b6100666100bd3660046102b0565b6000805481906100e29073ffffffffffffffffffffffffffffffffffffffff166101ca565b6001546040517fc0c53b8b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152336024830152918216604482015291925082169063c0c53b8b90606401600060405180830381600087803b15801561015f57600080fd5b505af1158015610173573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff8481168252861692507f5b03bfed1c14a02bdeceb5fa582eb1a5765fc0bc64ca0e6af4c20afc9487f081915060200160405180910390a292915050565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f091505073ffffffffffffffffffffffffffffffffffffffff81166102ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f455243313136373a20637265617465206661696c656400000000000000000000604482015260640160405180910390fd5b919050565b6000602082840312156102c1578081fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146102e4578182fd5b939250505056fea2646970667358221220ee15f62aab3808c635789c36bafdf4d8feca8a7a1d2ff1e40e369cb02bda387464736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006cddedd171ae4f2acf6ad3eb0a67dfaa04fb51be0000000000000000000000004c550042a61cecd13d6b973dd34f999b2eaad61a
-----Decoded View---------------
Arg [0] : implementation_ (address): 0x6CDDedD171Ae4f2aCF6AD3Eb0a67dFAa04fb51bE
Arg [1] : registry_ (address): 0x4C550042A61cEcD13D6b973dD34F999b2eAad61a
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000006cddedd171ae4f2acf6ad3eb0a67dfaa04fb51be
Arg [1] : 0000000000000000000000004c550042a61cecd13d6b973dd34f999b2eaad61a
Deployed Bytecode Sourcemap
8600:1278:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8730:29;;;;;;;;;;;;524:42:1;512:55;;;494:74;;482:2;467:18;8730:29:0;;;;;;;8819:23;;;;;;;;;9469:406;;;;;;:::i;:::-;9564:7;9638:14;;9564:7;;9625:28;;9638:14;;9625:12;:28::i;:::-;9744:8;;9688:65;;;;;:32;860:15:1;;;9688:65:0;;;842:34:1;9732:10:0;892:18:1;;;885:43;9744:8:0;;;944:18:1;;;937:43;9608:45:0;;-1:-1:-1;9688:32:0;;;;;754:18:1;;9688:65:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;9771:32:0;;;512:55:1;;;494:74;;9771:32:0;;;-1:-1:-1;9771:32:0;;-1:-1:-1;482:2:1;467:18;9771:32:0;;;;;;;9861:6;9469:406;-1:-1:-1;;9469:406:0:o;1106:622::-;1163:16;1233:4;1227:11;1299:66;1277:3;1252:128;1427:14;1421:4;1417:25;1410:4;1405:3;1401:14;1394:49;1515:66;1491:4;1486:3;1482:14;1457:139;1637:4;1632:3;1629:1;1622:20;1610:32;-1:-1:-1;;1671:22:0;;;1663:57;;;;;;;1193:2:1;1663:57:0;;;1175:21:1;1232:2;1212:18;;;1205:30;1271:24;1251:18;;;1244:52;1313:18;;1663:57:0;;;;;;;;1106:622;;;:::o;14:329:1:-;73:6;126:2;114:9;105:7;101:23;97:32;94:2;;;147:6;139;132:22;94:2;191:9;178:23;241:42;234:5;230:54;223:5;220:65;210:2;;304:6;296;289:22;210:2;332:5;84:259;-1:-1:-1;;;84:259:1:o
Swarm Source
ipfs://ee15f62aab3808c635789c36bafdf4d8feca8a7a1d2ff1e40e369cb02bda3874
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.