Created
February 20, 2020 13:11
-
-
Save buddies2705/ee8e14ce617ec230e252a913d6f84018 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
pragma solidity ^0.5.0; | |
contract PromiseDapp{ | |
uint public totalPromises; | |
struct Promise | |
{ | |
address party1; | |
address party2; | |
string promises; | |
} | |
Promise [] public pro; | |
mapping(uint=>Promise) public ProList; | |
function storePromises(address _party1,address _party2,string memory _promises)public returns(uint) | |
{ | |
Promise memory newPromise = Promise({ | |
party1:_party1, | |
party2:_party2, | |
promises:_promises | |
}); | |
pro.push(newPromise); | |
ProList[totalPromises++]=newPromise; | |
return totalPromises; | |
} | |
function displayPromise(uint proNum) view public returns(string memory) | |
{ | |
address p1=ProList[proNum].party1; | |
address p2=ProList[proNum].party2; | |
require(msg.sender==p1 || msg.sender==p2); | |
return ProList[proNum].promises; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment