Last active
November 3, 2021 20:32
-
-
Save z0r0z/806d27309cfbdc882aaa432298c624c5 to your computer and use it in GitHub Desktop.
iykyk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0-or-later | |
pragma solidity >=0.8.0; | |
contract LexRegistry { | |
address public owner; | |
mapping(address => Lawyer) public lawyers; | |
struct Lawyer { | |
string name; | |
string jurisdiction; | |
string details; | |
bool availability; | |
} | |
constructor() { | |
owner = msg.sender; | |
} | |
function register(address lawyer, string calldata name, string calldata jurisdiction, string calldata details) external { | |
require(msg.sender == owner, "NOT_OWNER"); | |
lawyers[lawyer] = Lawyer(name, jurisdiction, details, true); | |
} | |
function updateAvailability(bool availability) external { | |
bytes memory name = bytes(lawyers[msg.sender].name); | |
require(name.length > 0, "NOT_LAWYER"); | |
lawyers[msg.sender].availability = availability; | |
} | |
function transferOwner(address _owner) external { | |
require(msg.sender == owner, "NOT_OWNER"); | |
owner = _owner; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment