Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
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:
PoolAskVerifier
Compiler Version
v0.8.19+commit.7dd6d404
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2023-04-24 */ // File: contracts/lib/WasabiStructs.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.19; library WasabiStructs { enum OptionType { CALL, PUT } struct OptionData { bool active; OptionType optionType; uint256 strikePrice; uint256 expiry; uint256 tokenId; // Locked token for CALL options } struct PoolAsk { uint256 id; address poolAddress; OptionType optionType; uint256 strikePrice; uint256 premium; uint256 expiry; uint256 tokenId; // Token to lock for CALL options uint256 orderExpiry; } struct PoolBid { uint256 id; uint256 price; address tokenAddress; uint256 orderExpiry; uint256 optionId; } struct Bid { uint256 id; uint256 price; address tokenAddress; address collection; uint256 orderExpiry; address buyer; OptionType optionType; uint256 strikePrice; uint256 expiry; uint256 expiryAllowance; address optionTokenAddress; } struct Ask { uint256 id; uint256 price; address tokenAddress; uint256 orderExpiry; address seller; uint256 optionId; } struct EIP712Domain { string name; string version; uint256 chainId; address verifyingContract; } struct ExecutionInfo { address module; bytes data; uint256 value; } } /** * @dev Signature Verification */ library Signing { /** * @dev Returns the message hash for the given request */ function getMessageHash(WasabiStructs.PoolAsk calldata _request) public pure returns (bytes32) { return keccak256( abi.encode( _request.id, _request.poolAddress, _request.optionType, _request.strikePrice, _request.premium, _request.expiry, _request.tokenId, _request.orderExpiry)); } /** * @dev Returns the message hash for the given request */ function getAskHash(WasabiStructs.Ask calldata _ask) public pure returns (bytes32) { return keccak256( abi.encode( _ask.id, _ask.price, _ask.tokenAddress, _ask.orderExpiry, _ask.seller, _ask.optionId)); } function getBidHash(WasabiStructs.Bid calldata _bid) public pure returns (bytes32) { return keccak256( abi.encode( _bid.id, _bid.price, _bid.tokenAddress, _bid.collection, _bid.orderExpiry, _bid.buyer, _bid.optionType, _bid.strikePrice, _bid.expiry, _bid.expiryAllowance)); } /** * @dev creates an ETH signed message hash */ function getEthSignedMessageHash(bytes32 _messageHash) public pure returns (bytes32) { /* Signature is produced by signing a keccak256 hash with the following format: "\x19Ethereum Signed Message\n" + len(msg) + msg */ return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash)); } function getSigner( WasabiStructs.PoolAsk calldata _request, bytes memory signature ) public pure returns (address) { bytes32 messageHash = getMessageHash(_request); bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash); return recoverSigner(ethSignedMessageHash, signature); } function getAskSigner( WasabiStructs.Ask calldata _ask, bytes memory signature ) public pure returns (address) { bytes32 messageHash = getAskHash(_ask); bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash); return recoverSigner(ethSignedMessageHash, signature); } function recoverSigner(bytes32 _ethSignedMessageHash, bytes memory _signature) public pure returns (address) { (bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature); return ecrecover(_ethSignedMessageHash, v, r, s); } function splitSignature(bytes memory sig) public pure returns ( bytes32 r, bytes32 s, uint8 v ) { require(sig.length == 65, "invalid signature length"); assembly { /* First 32 bytes stores the length of the signature add(sig, 32) = pointer of sig + 32 effectively, skips first 32 bytes of signature mload(p) loads next 32 bytes starting at the memory address p into memory */ // first 32 bytes, after the length prefix r := mload(add(sig, 32)) // second 32 bytes s := mload(add(sig, 64)) // final byte (first byte of the next 32 bytes) v := byte(0, mload(add(sig, 96))) } // implicitly return (r, s, v) } } /** * @dev Signature Verification for PoolAsk */ library PoolAskVerifier { bytes32 constant EIP712DOMAIN_TYPEHASH = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); bytes32 constant POOLASK_TYPEHASH = keccak256( "PoolAsk(uint256 id,address poolAddress,uint8 optionType,uint256 strikePrice,uint256 premium,uint256 expiry,uint256 tokenId,uint256 orderExpiry)" ); /** * @dev Creates the hash of the EIP712 domain for this validator * * @param _eip712Domain the domain to hash * @return the hashed domain */ function hashDomain( WasabiStructs.EIP712Domain memory _eip712Domain ) internal pure returns (bytes32) { return keccak256( abi.encode( EIP712DOMAIN_TYPEHASH, keccak256(bytes(_eip712Domain.name)), keccak256(bytes(_eip712Domain.version)), _eip712Domain.chainId, _eip712Domain.verifyingContract ) ); } /** * @dev Creates the hash of the PoolAsk for this validator * * @param _poolAsk to hash * @return the poolAsk domain */ function hashForPoolAsk( WasabiStructs.PoolAsk memory _poolAsk ) public pure returns (bytes32) { return keccak256( abi.encode( POOLASK_TYPEHASH, _poolAsk.id, _poolAsk.poolAddress, _poolAsk.optionType, _poolAsk.strikePrice, _poolAsk.premium, _poolAsk.expiry, _poolAsk.tokenId, _poolAsk.orderExpiry ) ); } /** * @dev Gets the signer of the given signature for the given _poolAsk * * @param _poolAsk the ask to validate * @param _signature the signature to validate * @return address who signed the signature */ function getSignerForPoolAsk( WasabiStructs.PoolAsk memory _poolAsk, bytes memory _signature ) public view returns (address) { bytes32 domainSeparator = hashDomain( WasabiStructs.EIP712Domain({ name: "PoolAskSignature", version: "1", chainId: getChainID(), verifyingContract: address(this) }) ); bytes32 digest = keccak256( abi.encodePacked("\x19\x01", domainSeparator, hashForPoolAsk(_poolAsk)) ); return Signing.recoverSigner(digest, _signature); } /** * @dev Checks the signer of the given signature for the given poolAsk is the given signer * * @param _poolAsk the _poolAsk to validate * @param _signature the signature to validate * @param _signer the signer to validate * @return true if the signature belongs to the signer, false otherwise */ function verifyPoolAsk( WasabiStructs.PoolAsk memory _poolAsk, bytes memory _signature, address _signer ) internal view returns (bool) { return getSignerForPoolAsk(_poolAsk, _signature) == _signer; } /** * @return the current chain id */ function getChainID() internal view returns (uint256) { uint256 id; assembly { id := chainid() } return id; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"enum WasabiStructs.OptionType","name":"optionType","type":"WasabiStructs.OptionType"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"orderExpiry","type":"uint256"}],"internalType":"struct WasabiStructs.PoolAsk","name":"_poolAsk","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"getSignerForPoolAsk","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"enum WasabiStructs.OptionType","name":"optionType","type":"WasabiStructs.OptionType"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"orderExpiry","type":"uint256"}],"internalType":"struct WasabiStructs.PoolAsk","name":"_poolAsk","type":"tuple"}],"name":"hashForPoolAsk","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
61064f61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c8063827f3b6e14610045578063d4ef50bc14610082575b600080fd5b61005861005336600461045b565b6100a3565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610095610090366004610506565b61022b565b604051908152602001610079565b6040805160c0810182526010608082019081527f506f6f6c41736b5369676e61747572650000000000000000000000000000000060a0830152815281518083018352600181527f31000000000000000000000000000000000000000000000000000000000000006020808301919091528201526000918291610130918101468152306020909101526102ab565b905060008161013e8661022b565b6040517f190100000000000000000000000000000000000000000000000000000000000060208201526022810192909252604282015260620160408051601f198184030181529082905280516020909101207f97aba7f9000000000000000000000000000000000000000000000000000000008252915073d3bb8475c30fd70675f6250fb725e30b3a6e6094906397aba7f9906101e1908490889060040161052a565b602060405180830381865af41580156101fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102229190610580565b95945050505050565b60007f131e64112fe3977cd4e488b80e8774e31182499611b63350f7b4e74ab82b9365826000015183602001518460400151856060015186608001518760a001518860c001518960e0015160405160200161028e9998979695949392919061059d565b604051602081830303815290604052805190602001209050919050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f8260000151805190602001208360200151805190602001208460400151856060015160405160200161028e95949392919094855260208501939093526040840191909152606083015273ffffffffffffffffffffffffffffffffffffffff16608082015260a00190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561037757610377610338565b604052919050565b73ffffffffffffffffffffffffffffffffffffffff811681146103a157600080fd5b50565b8035600281106103b357600080fd5b919050565b60006101008083850312156103cc57600080fd5b6040519081019067ffffffffffffffff821181831017156103ef576103ef610338565b81604052809250833581526020840135915061040a8261037f565b81602082015261041c604085016103a4565b6040820152606084013560608201526080840135608082015260a084013560a082015260c084013560c082015260e084013560e0820152505092915050565b600080610120838503121561046f57600080fd5b61047984846103b8565b915061010083013567ffffffffffffffff8082111561049757600080fd5b818501915085601f8301126104ab57600080fd5b8135818111156104bd576104bd610338565b6104d0601f8201601f191660200161034e565b91508082528660208285010111156104e757600080fd5b8060208401602084013760009082016020015292959294509192505050565b6000610100828403121561051957600080fd5b61052383836103b8565b9392505050565b82815260006020604081840152835180604085015260005b8181101561055e57858101830151858201606001528201610542565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561059257600080fd5b81516105238161037f565b8981526020810189905273ffffffffffffffffffffffffffffffffffffffff881660408201526101208101600288106105e657634e487b7160e01b600052602160045260246000fd5b8760608301528660808301528560a08301528460c08301528360e0830152826101008301529a995050505050505050505056fea2646970667358221220ee0eb5564ceecc5aff316a79db6d13a506bcaf6c8a5d1dbdaf056c42a694eac164736f6c63430008130033
Deployed Bytecode
0x73e3f3dca2bd68cbd34b58cfc3bcd109998fcce0ac30146080604052600436106100405760003560e01c8063827f3b6e14610045578063d4ef50bc14610082575b600080fd5b61005861005336600461045b565b6100a3565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610095610090366004610506565b61022b565b604051908152602001610079565b6040805160c0810182526010608082019081527f506f6f6c41736b5369676e61747572650000000000000000000000000000000060a0830152815281518083018352600181527f31000000000000000000000000000000000000000000000000000000000000006020808301919091528201526000918291610130918101468152306020909101526102ab565b905060008161013e8661022b565b6040517f190100000000000000000000000000000000000000000000000000000000000060208201526022810192909252604282015260620160408051601f198184030181529082905280516020909101207f97aba7f9000000000000000000000000000000000000000000000000000000008252915073d3bb8475c30fd70675f6250fb725e30b3a6e6094906397aba7f9906101e1908490889060040161052a565b602060405180830381865af41580156101fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102229190610580565b95945050505050565b60007f131e64112fe3977cd4e488b80e8774e31182499611b63350f7b4e74ab82b9365826000015183602001518460400151856060015186608001518760a001518860c001518960e0015160405160200161028e9998979695949392919061059d565b604051602081830303815290604052805190602001209050919050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f8260000151805190602001208360200151805190602001208460400151856060015160405160200161028e95949392919094855260208501939093526040840191909152606083015273ffffffffffffffffffffffffffffffffffffffff16608082015260a00190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561037757610377610338565b604052919050565b73ffffffffffffffffffffffffffffffffffffffff811681146103a157600080fd5b50565b8035600281106103b357600080fd5b919050565b60006101008083850312156103cc57600080fd5b6040519081019067ffffffffffffffff821181831017156103ef576103ef610338565b81604052809250833581526020840135915061040a8261037f565b81602082015261041c604085016103a4565b6040820152606084013560608201526080840135608082015260a084013560a082015260c084013560c082015260e084013560e0820152505092915050565b600080610120838503121561046f57600080fd5b61047984846103b8565b915061010083013567ffffffffffffffff8082111561049757600080fd5b818501915085601f8301126104ab57600080fd5b8135818111156104bd576104bd610338565b6104d0601f8201601f191660200161034e565b91508082528660208285010111156104e757600080fd5b8060208401602084013760009082016020015292959294509192505050565b6000610100828403121561051957600080fd5b61052383836103b8565b9392505050565b82815260006020604081840152835180604085015260005b8181101561055e57858101830151858201606001528201610542565b506000606082860101526060601f19601f830116850101925050509392505050565b60006020828403121561059257600080fd5b81516105238161037f565b8981526020810189905273ffffffffffffffffffffffffffffffffffffffff881660408201526101208101600288106105e657634e487b7160e01b600052602160045260246000fd5b8760608301528660808301528560a08301528460c08301528360e0830152826101008301529a995050505050505050505056fea2646970667358221220ee0eb5564ceecc5aff316a79db6d13a506bcaf6c8a5d1dbdaf056c42a694eac164736f6c63430008130033
Deployed Bytecode Sourcemap
5492:3569:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7603:630;;;;;;:::i;:::-;;:::i;:::-;;;2843:42:1;2831:55;;;2813:74;;2801:2;2786:18;7603:630:0;;;;;;;;6769:580;;;;;;:::i;:::-;;:::i;:::-;;;3283:25:1;;;3271:2;3256:18;6769:580:0;3129:185:1;7603:630:0;7813:208;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;7788:244:0;;-1:-1:-1;;9011:9:0;7813:208;;8000:4;7813:208;;;;;7788:10;:244::i;:::-;7762:270;;8043:14;8113:15;8130:24;8145:8;8130:14;:24::i;:::-;8084:71;;3589:66:1;8084:71:0;;;3577:79:1;3672:11;;;3665:27;;;;3708:12;;;3701:28;3745:12;;8084:71:0;;;-1:-1:-1;;8084:71:0;;;;;;;;;;8060:106;;8084:71;8060:106;;;;8184:41;;;8060:106;-1:-1:-1;8184:7:0;;:21;;:41;;8060:106;;8214:10;;8184:41;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8177:48;7603:630;-1:-1:-1;;;;;7603:630:0:o;6769:580::-;6869:7;5746:180;7009:8;:11;;;7043:8;:20;;;7086:8;:19;;;7128:8;:20;;;7171:8;:16;;;7210:8;:15;;;7248:8;:16;;;7287:8;:20;;;6937:389;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;6909:432;;;;;;6889:452;;6769:580;;;:::o;6113:491::-;6221:7;5575:119;6382:13;:18;;;6366:36;;;;;;6441:13;:21;;;6425:39;;;;;;6487:13;:21;;;6531:13;:31;;;6289:292;;;;;;;;;;;5938:25:1;;;5994:2;5979:18;;5972:34;;;;6037:2;6022:18;;6015:34;;;;6080:2;6065:18;;6058:34;6141:42;6129:55;6123:3;6108:19;;6101:84;5925:3;5910:19;;5679:512;14:184;-1:-1:-1;;;63:1:1;56:88;163:4;160:1;153:15;187:4;184:1;177:15;203:275;274:2;268:9;339:2;320:13;;-1:-1:-1;;316:27:1;304:40;;374:18;359:34;;395:22;;;356:62;353:88;;;421:18;;:::i;:::-;457:2;450:22;203:275;;-1:-1:-1;203:275:1:o;483:154::-;569:42;562:5;558:54;551:5;548:65;538:93;;627:1;624;617:12;538:93;483:154;:::o;642:151::-;718:20;;767:1;757:12;;747:40;;783:1;780;773:12;747:40;642:151;;;:::o;798:984::-;852:5;882:6;925:2;913:9;908:3;904:19;900:28;897:48;;;941:1;938;931:12;897:48;974:2;968:9;1004:15;;;;1049:18;1034:34;;1070:22;;;1031:62;1028:88;;;1096:18;;:::i;:::-;1136:10;1132:2;1125:22;1165:6;1156:15;;1208:9;1195:23;1187:6;1180:39;1271:2;1260:9;1256:18;1243:32;1228:47;;1284:33;1309:7;1284:33;:::i;:::-;1350:7;1345:2;1337:6;1333:15;1326:32;1391:46;1433:2;1422:9;1418:18;1391:46;:::i;:::-;1386:2;1378:6;1374:15;1367:71;1499:2;1488:9;1484:18;1471:32;1466:2;1458:6;1454:15;1447:57;1566:3;1555:9;1551:19;1538:33;1532:3;1524:6;1520:16;1513:59;1634:3;1623:9;1619:19;1606:33;1600:3;1592:6;1588:16;1581:59;1702:3;1691:9;1687:19;1674:33;1668:3;1660:6;1656:16;1649:59;1770:3;1759:9;1755:19;1742:33;1736:3;1728:6;1724:16;1717:59;;;798:984;;;;:::o;1787:867::-;1887:6;1895;1948:3;1936:9;1927:7;1923:23;1919:33;1916:53;;;1965:1;1962;1955:12;1916:53;1988:45;2025:7;2014:9;1988:45;:::i;:::-;1978:55;;2084:3;2073:9;2069:19;2056:33;2108:18;2149:2;2141:6;2138:14;2135:34;;;2165:1;2162;2155:12;2135:34;2203:6;2192:9;2188:22;2178:32;;2248:7;2241:4;2237:2;2233:13;2229:27;2219:55;;2270:1;2267;2260:12;2219:55;2306:2;2293:16;2328:2;2324;2321:10;2318:36;;;2334:18;;:::i;:::-;2376:55;2419:2;2400:13;;-1:-1:-1;;2396:27:1;2425:4;2392:38;2376:55;:::i;:::-;2363:68;;2454:2;2447:5;2440:17;2496:7;2489:4;2484:2;2480;2476:11;2472:22;2469:35;2466:55;;;2517:1;2514;2507:12;2466:55;2576:2;2569:4;2565:2;2561:13;2554:4;2547:5;2543:16;2530:49;2622:1;2599:14;;;2615:4;2595:25;2588:36;1787:867;;2603:5;;-1:-1:-1;1787:867:1;;-1:-1:-1;;;1787:867:1:o;2898:226::-;2980:6;3033:3;3021:9;3012:7;3008:23;3004:33;3001:53;;;3050:1;3047;3040:12;3001:53;3073:45;3110:7;3099:9;3073:45;:::i;:::-;3063:55;2898:226;-1:-1:-1;;;2898:226:1:o;3768:625::-;3951:6;3940:9;3933:25;3914:4;3977:2;4015;4010;3999:9;3995:18;3988:30;4047:6;4041:13;4090:6;4085:2;4074:9;4070:18;4063:34;4115:1;4125:140;4139:6;4136:1;4133:13;4125:140;;;4234:14;;;4230:23;;4224:30;4200:17;;;4219:2;4196:26;4189:66;4154:10;;4125:140;;;4129:3;4314:1;4309:2;4300:6;4289:9;4285:22;4281:31;4274:42;4384:2;4377;4373:7;4368:2;4360:6;4356:15;4352:29;4341:9;4337:45;4333:54;4325:62;;;;3768:625;;;;;:::o;4398:251::-;4468:6;4521:2;4509:9;4500:7;4496:23;4492:32;4489:52;;;4537:1;4534;4527:12;4489:52;4569:9;4563:16;4588:31;4613:5;4588:31;:::i;4654:1020::-;5035:25;;;5091:2;5076:18;;5069:34;;;5151:42;5139:55;;5134:2;5119:18;;5112:83;5022:3;5007:19;;5225:1;5214:13;;5204:201;;-1:-1:-1;;;5258:1:1;5251:88;5362:4;5359:1;5352:15;5390:4;5387:1;5380:15;5204:201;5441:6;5436:2;5425:9;5421:18;5414:34;5485:6;5479:3;5468:9;5464:19;5457:35;5529:6;5523:3;5512:9;5508:19;5501:35;5573:6;5567:3;5556:9;5552:19;5545:35;5617:6;5611:3;5600:9;5596:19;5589:35;5661:6;5655:3;5644:9;5640:19;5633:35;4654:1020;;;;;;;;;;;;:::o
Swarm Source
ipfs://ee0eb5564ceecc5aff316a79db6d13a506bcaf6c8a5d1dbdaf056c42a694eac1
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.