Skip to content

Instantly share code, notes, and snippets.

Created December 25, 2021 20:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at
pragma solidity >=0.7.0 <0.9.0;
contract UserContract {
address payable owner;
constructor () public {
owner =payable(msg.sender);
modifier onlyOwner {
require(msg.sender == owner);
struct User {
bool verify;
string name;
address user_address;
mapping (address => User) public users;
function createUser (string memory _name, address _user_address) public {
require(_user_address != address(0x0), "adress is required");
require(bytes(_name).length >= 4, 'name should have at least 4 characters');
require(users[_user_address].user_address != _user_address, "User already exists,cannot update");
users[_user_address] = User(false,_name,_user_address);
function getUser (address _user_address ) view public returns(bool verify,string memory name,address user_address) {
require(_user_address != address(0x0));
User memory u = users[_user_address];
function verifyUser (address _user_address) public onlyOwner {
User storage u = users[_user_address];
require(u.verify == false, 'user is already verified' );
u.verify = true;
receive() external payable onlyOwner{
require(msg.sender.balance >= msg.value );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment