DEV Community

Cover image for Created a Profile Storage SmartContract and Deployed on XinFin XDC Network.
MahaLakshmi Perumal
MahaLakshmi Perumal

Posted on

Created a Profile Storage SmartContract and Deployed on XinFin XDC Network.

Created a SmartContract in Solidity language to store the user's profile with Name, description, URL, Image. Deployed the #SmartContract on XinFin XDC Network.
Check the code here:

pragma solidity ^0.5.0;
contract Profile {
struct User {
string name;
string subtitle;
string sdescription;
string ldescription;
string weburl;
string imghash;
}
mapping(address => User) public users;
function set(string memory _name, string memory _subtitle, string memory _sdescription,string memory _ldescription, string memory _weburl, string memory _imghash) public {
users[msg.sender] = User(_name, _subtitle, _sdescription, _ldescription, _weburl, _imghash);
}
function get() public view returns (string memory, string memory, string memory, string memory, string memory, string memory) {
return (
users[msg.sender].name,
users[msg.sender].subtitle,
users[msg.sender].sdescription,
users[msg.sender].ldescription,
users[msg.sender].weburl,
users[msg.sender].imghash
);
}}

Discussion (0)