Contract Overview
Balance:
0 MATIC
My Name Tag:
Not Available
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0xa230c7db1f2d607d3d314e425e0cb94d2b16e76f77616b1a7bcc82126270e9cf | 0x60806040 | 27233645 | 319 days 11 hrs ago | 0x3a973ccc40a2436a518c6c531ade829d22fde451 | IN | Create: FileRegistry | 0 MATIC | 0.023001052622 |
[ Download CSV Export ]
Contract Name:
FileRegistry
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity)
/** *Submitted for verification at polygonscan.com on 2022-07-18 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.9; /** * @title FileRegistry for GhostShare.xyz * @author Joris Zierold * @dev Main contract, which handles file tracing and access control. */ contract FileRegistry { /* ------------------------------ DATA STORAGE ------------------------------ */ struct File { address fileOwner; mapping(address => bool) accessRights; } mapping(bytes32 => File) public files; /* --------------------------------- EVENTS --------------------------------- */ event FileRegistered(bytes32 fileId, address indexed fileOwner); event AccessGranted(bytes32 fileId, address indexed recipient); event AccessRevoked(bytes32 fileId, address indexed recipient); /* -------------------------------- MODIFIERS ------------------------------- */ modifier onlyFileOwner(bytes32 fileId) { // requre msg.sender is owner of fileId require( files[fileId].fileOwner == msg.sender, "FileRegistry::onlyFileOwner: You do not have access." ); _; } /* -------------------------------------------------------------------------- */ /* FUNCTIONS */ /* -------------------------------------------------------------------------- */ function registerFile(bytes32 fileId) public returns (bool fileRegistered) { require( files[fileId].fileOwner == address(0), "FileRegistry::registerFile: File already exists." ); files[fileId].fileOwner = msg.sender; files[fileId].accessRights[msg.sender] = true; emit FileRegistered(fileId, msg.sender); return true; } function grantAccess(bytes32 fileId, address recipient) public onlyFileOwner(fileId) returns (bool accessGranted) { require( !files[fileId].accessRights[recipient], "FileRegistry::grantAccess: Recipient is already granted." ); files[fileId].accessRights[recipient] = true; emit AccessGranted(fileId, recipient); return true; } function revokeAccess(bytes32 fileId, address recipient) public onlyFileOwner(fileId) returns (bool accessRevoked) { require( files[fileId].accessRights[recipient], "FileRegistry::revokeAccess: No access is granted to this Recipient." ); files[fileId].accessRights[recipient] = false; emit AccessRevoked(fileId, recipient); return true; } function hasAccess(bytes32 fileId, address recipient) public view returns (bool _hasAccess) { return files[fileId].accessRights[recipient]; } }
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"fileId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"AccessGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"fileId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"AccessRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"fileId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"fileOwner","type":"address"}],"name":"FileRegistered","type":"event"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"files","outputs":[{"internalType":"address","name":"fileOwner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"fileId","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"}],"name":"grantAccess","outputs":[{"internalType":"bool","name":"accessGranted","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"fileId","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"}],"name":"hasAccess","outputs":[{"internalType":"bool","name":"_hasAccess","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"fileId","type":"bytes32"}],"name":"registerFile","outputs":[{"internalType":"bool","name":"fileRegistered","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"fileId","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"}],"name":"revokeAccess","outputs":[{"internalType":"bool","name":"accessRevoked","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50610c07806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806340554c3a1461005c57806383177db31461008c5780638d53b208146100bc57806398c9adff146100ec578063c1190e401461011c575b600080fd5b6100766004803603810190610071919061085b565b61014c565b60405161008391906108b6565b60405180910390f35b6100a660048036038101906100a1919061085b565b610356565b6040516100b391906108b6565b60405180910390f35b6100d660048036038101906100d1919061085b565b6103c0565b6040516100e391906108b6565b60405180910390f35b610106600480360381019061010191906108d1565b6105c9565b604051610113919061090d565b60405180910390f35b610136600480360381019061013191906108d1565b610607565b60405161014391906108b6565b60405180910390f35b6000823373ffffffffffffffffffffffffffffffffffffffff1660008083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146101f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101e9906109ab565b60405180910390fd5b60008085815260200190815260200160002060010160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610292576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028990610a3d565b60405180910390fd5b600160008086815260200190815260200160002060010160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508273ffffffffffffffffffffffffffffffffffffffff167ff20afd7b032307b01752ee91e3f6a4b83a5b4ab631f9ab279322fd45634382c0856040516103439190610a6c565b60405180910390a2600191505092915050565b600080600084815260200190815260200160002060010160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000823373ffffffffffffffffffffffffffffffffffffffff1660008083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610466576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045d906109ab565b60405180910390fd5b60008085815260200190815260200160002060010160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610505576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fc90610b1f565b60405180910390fd5b600080600086815260200190815260200160002060010160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508273ffffffffffffffffffffffffffffffffffffffff167fe7906b77ea165c70ad8268ce5b59b778a198edf9c1ae4118378eefdc76fce5f4856040516105b69190610a6c565b60405180910390a2600191505092915050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081565b60008073ffffffffffffffffffffffffffffffffffffffff1660008084815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106a390610bb1565b60405180910390fd5b3360008084815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160008084815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f92c41fb52830c64a58d64103b7544943e244ab8f9d0007e1e93460504b71380b836040516107b19190610a6c565b60405180910390a260019050919050565b600080fd5b6000819050919050565b6107da816107c7565b81146107e557600080fd5b50565b6000813590506107f7816107d1565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610828826107fd565b9050919050565b6108388161081d565b811461084357600080fd5b50565b6000813590506108558161082f565b92915050565b60008060408385031215610872576108716107c2565b5b6000610880858286016107e8565b925050602061089185828601610846565b9150509250929050565b60008115159050919050565b6108b08161089b565b82525050565b60006020820190506108cb60008301846108a7565b92915050565b6000602082840312156108e7576108e66107c2565b5b60006108f5848285016107e8565b91505092915050565b6109078161081d565b82525050565b600060208201905061092260008301846108fe565b92915050565b600082825260208201905092915050565b7f46696c6552656769737472793a3a6f6e6c7946696c654f776e65723a20596f7560008201527f20646f206e6f742068617665206163636573732e000000000000000000000000602082015250565b6000610995603483610928565b91506109a082610939565b604082019050919050565b600060208201905081810360008301526109c481610988565b9050919050565b7f46696c6552656769737472793a3a6772616e744163636573733a20526563697060008201527f69656e7420697320616c7265616479206772616e7465642e0000000000000000602082015250565b6000610a27603883610928565b9150610a32826109cb565b604082019050919050565b60006020820190508181036000830152610a5681610a1a565b9050919050565b610a66816107c7565b82525050565b6000602082019050610a816000830184610a5d565b92915050565b7f46696c6552656769737472793a3a7265766f6b654163636573733a204e6f206160008201527f6363657373206973206772616e74656420746f2074686973205265636970696560208201527f6e742e0000000000000000000000000000000000000000000000000000000000604082015250565b6000610b09604383610928565b9150610b1482610a87565b606082019050919050565b60006020820190508181036000830152610b3881610afc565b9050919050565b7f46696c6552656769737472793a3a726567697374657246696c653a2046696c6560008201527f20616c7265616479206578697374732e00000000000000000000000000000000602082015250565b6000610b9b603083610928565b9150610ba682610b3f565b604082019050919050565b60006020820190508181036000830152610bca81610b8e565b905091905056fea2646970667358221220f7e664d1ef744a6487278d1a82d9b7becd749b6ccdf96c431a573913bf074c5664736f6c63430008090033
Deployed ByteCode Sourcemap
209:2671:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1794:434;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2690:187;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2236:446;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;428:37;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;1382:404;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;1794:434;1915:18;1889:6;1004:10;977:37;;:5;:13;983:6;977:13;;;;;;;;;;;:23;;;;;;;;;;;;:37;;;955:139;;;;;;;;;;;;:::i;:::-;;;;;;;;;1974:5:::1;:13:::0;1980:6:::1;1974:13;;;;;;;;;;;:26;;:37;2001:9;1974:37;;;;;;;;;;;;;;;;;;;;;;;;;1973:38;1951:144;;;;;;;;;;;;:::i;:::-;;;;;;;;;2146:4;2106:5;:13:::0;2112:6:::1;2106:13;;;;;;;;;;;:26;;:37;2133:9;2106:37;;;;;;;;;;;;;;;;:44;;;;;;;;;;;;;;;;;;2188:9;2166:32;;;2180:6;2166:32;;;;;;:::i;:::-;;;;;;;;2216:4;2209:11;;1794:434:::0;;;;;:::o;2690:187::-;2792:15;2832:5;:13;2838:6;2832:13;;;;;;;;;;;:26;;:37;2859:9;2832:37;;;;;;;;;;;;;;;;;;;;;;;;;2825:44;;2690:187;;;;:::o;2236:446::-;2358:18;2332:6;1004:10;977:37;;:5;:13;983:6;977:13;;;;;;;;;;;:23;;;;;;;;;;;;:37;;;955:139;;;;;;;;;;;;:::i;:::-;;;;;;;;;2416:5:::1;:13:::0;2422:6:::1;2416:13;;;;;;;;;;;:26;;:37;2443:9;2416:37;;;;;;;;;;;;;;;;;;;;;;;;;2394:154;;;;;;;;;;;;:::i;:::-;;;;;;;;;2599:5;2559::::0;:13:::1;2565:6;2559:13;;;;;;;;;;;:26;;:37;2586:9;2559:37;;;;;;;;;;;;;;;;:45;;;;;;;;;;;;;;;;;;2642:9;2620:32;;;2634:6;2620:32;;;;;;:::i;:::-;;;;;;;;2670:4;2663:11;;2236:446:::0;;;;;:::o;428:37::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1382:404::-;1436:19;1525:1;1490:37;;:5;:13;1496:6;1490:13;;;;;;;;;;;:23;;;;;;;;;;;;:37;;;1468:135;;;;;;;;;;;;:::i;:::-;;;;;;;;;1640:10;1614:5;:13;1620:6;1614:13;;;;;;;;;;;:23;;;:36;;;;;;;;;;;;;;;;;;1702:4;1661:5;:13;1667:6;1661:13;;;;;;;;;;;:26;;:38;1688:10;1661:38;;;;;;;;;;;;;;;;:45;;;;;;;;;;;;;;;;;;1745:10;1722:34;;;1737:6;1722:34;;;;;;:::i;:::-;;;;;;;;1774:4;1767:11;;1382:404;;;:::o;88:117:1:-;197:1;194;187:12;334:77;371:7;400:5;389:16;;334:77;;;:::o;417:122::-;490:24;508:5;490:24;:::i;:::-;483:5;480:35;470:63;;529:1;526;519:12;470:63;417:122;:::o;545:139::-;591:5;629:6;616:20;607:29;;645:33;672:5;645:33;:::i;:::-;545:139;;;;:::o;690:126::-;727:7;767:42;760:5;756:54;745:65;;690:126;;;:::o;822:96::-;859:7;888:24;906:5;888:24;:::i;:::-;877:35;;822:96;;;:::o;924:122::-;997:24;1015:5;997:24;:::i;:::-;990:5;987:35;977:63;;1036:1;1033;1026:12;977:63;924:122;:::o;1052:139::-;1098:5;1136:6;1123:20;1114:29;;1152:33;1179:5;1152:33;:::i;:::-;1052:139;;;;:::o;1197:474::-;1265:6;1273;1322:2;1310:9;1301:7;1297:23;1293:32;1290:119;;;1328:79;;:::i;:::-;1290:119;1448:1;1473:53;1518:7;1509:6;1498:9;1494:22;1473:53;:::i;:::-;1463:63;;1419:117;1575:2;1601:53;1646:7;1637:6;1626:9;1622:22;1601:53;:::i;:::-;1591:63;;1546:118;1197:474;;;;;:::o;1677:90::-;1711:7;1754:5;1747:13;1740:21;1729:32;;1677:90;;;:::o;1773:109::-;1854:21;1869:5;1854:21;:::i;:::-;1849:3;1842:34;1773:109;;:::o;1888:210::-;1975:4;2013:2;2002:9;1998:18;1990:26;;2026:65;2088:1;2077:9;2073:17;2064:6;2026:65;:::i;:::-;1888:210;;;;:::o;2104:329::-;2163:6;2212:2;2200:9;2191:7;2187:23;2183:32;2180:119;;;2218:79;;:::i;:::-;2180:119;2338:1;2363:53;2408:7;2399:6;2388:9;2384:22;2363:53;:::i;:::-;2353:63;;2309:117;2104:329;;;;:::o;2439:118::-;2526:24;2544:5;2526:24;:::i;:::-;2521:3;2514:37;2439:118;;:::o;2563:222::-;2656:4;2694:2;2683:9;2679:18;2671:26;;2707:71;2775:1;2764:9;2760:17;2751:6;2707:71;:::i;:::-;2563:222;;;;:::o;2791:169::-;2875:11;2909:6;2904:3;2897:19;2949:4;2944:3;2940:14;2925:29;;2791:169;;;;:::o;2966:239::-;3106:34;3102:1;3094:6;3090:14;3083:58;3175:22;3170:2;3162:6;3158:15;3151:47;2966:239;:::o;3211:366::-;3353:3;3374:67;3438:2;3433:3;3374:67;:::i;:::-;3367:74;;3450:93;3539:3;3450:93;:::i;:::-;3568:2;3563:3;3559:12;3552:19;;3211:366;;;:::o;3583:419::-;3749:4;3787:2;3776:9;3772:18;3764:26;;3836:9;3830:4;3826:20;3822:1;3811:9;3807:17;3800:47;3864:131;3990:4;3864:131;:::i;:::-;3856:139;;3583:419;;;:::o;4008:243::-;4148:34;4144:1;4136:6;4132:14;4125:58;4217:26;4212:2;4204:6;4200:15;4193:51;4008:243;:::o;4257:366::-;4399:3;4420:67;4484:2;4479:3;4420:67;:::i;:::-;4413:74;;4496:93;4585:3;4496:93;:::i;:::-;4614:2;4609:3;4605:12;4598:19;;4257:366;;;:::o;4629:419::-;4795:4;4833:2;4822:9;4818:18;4810:26;;4882:9;4876:4;4872:20;4868:1;4857:9;4853:17;4846:47;4910:131;5036:4;4910:131;:::i;:::-;4902:139;;4629:419;;;:::o;5054:118::-;5141:24;5159:5;5141:24;:::i;:::-;5136:3;5129:37;5054:118;;:::o;5178:222::-;5271:4;5309:2;5298:9;5294:18;5286:26;;5322:71;5390:1;5379:9;5375:17;5366:6;5322:71;:::i;:::-;5178:222;;;;:::o;5406:291::-;5546:34;5542:1;5534:6;5530:14;5523:58;5615:34;5610:2;5602:6;5598:15;5591:59;5684:5;5679:2;5671:6;5667:15;5660:30;5406:291;:::o;5703:366::-;5845:3;5866:67;5930:2;5925:3;5866:67;:::i;:::-;5859:74;;5942:93;6031:3;5942:93;:::i;:::-;6060:2;6055:3;6051:12;6044:19;;5703:366;;;:::o;6075:419::-;6241:4;6279:2;6268:9;6264:18;6256:26;;6328:9;6322:4;6318:20;6314:1;6303:9;6299:17;6292:47;6356:131;6482:4;6356:131;:::i;:::-;6348:139;;6075:419;;;:::o;6500:235::-;6640:34;6636:1;6628:6;6624:14;6617:58;6709:18;6704:2;6696:6;6692:15;6685:43;6500:235;:::o;6741:366::-;6883:3;6904:67;6968:2;6963:3;6904:67;:::i;:::-;6897:74;;6980:93;7069:3;6980:93;:::i;:::-;7098:2;7093:3;7089:12;7082:19;;6741:366;;;:::o;7113:419::-;7279:4;7317:2;7306:9;7302:18;7294:26;;7366:9;7360:4;7356:20;7352:1;7341:9;7337:17;7330:47;7394:131;7520:4;7394:131;:::i;:::-;7386:139;;7113:419;;;:::o
Swarm Source
ipfs://f7e664d1ef744a6487278d1a82d9b7becd749b6ccdf96c431a573913bf074c56
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|