Skip to content

Instantly share code, notes, and snippets.

@ashokslsk
Created February 21, 2020 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashokslsk/7c313bceb363d8aad9bc2c87176311af to your computer and use it in GitHub Desktop.
Save ashokslsk/7c313bceb363d8aad9bc2c87176311af to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.18+commit.9cf6e910.js&optimize=true&gist=
pragma solidity ^0.4.18;
contract VideoProvider {
struct UserInfo {
uint Age;
bool AgeRestriction;
}
mapping (string => UserInfo) AllUsers;
function SetUserInfo(string _Name, uint _Age) public {
AllUsers[_Name].Age = _Age;
if (AllUsers[_Name].Age >= 18) {AllUsers[_Name].AgeRestriction = false;
}
else AllUsers[_Name].AgeRestriction = true;
}
function GetUserInfo(string _Name) public view returns (uint,bool) {
return (AllUsers[_Name].Age,AllUsers[_Name].AgeRestriction);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment