-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathinteracaoentrecontratos.sol
55 lines (38 loc) · 1.4 KB
/
interacaoentrecontratos.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
pragma solidity 0.5.11;
contract Persona {
mapping (address => string) public infoPersona;
address public addressValidator;
constructor() public {
}
function addPersona (address _address, string memory _info) public {
infoPersona[_address] = _info;
}
function getInfoPersona (address _address) public view returns (string memory) {
return infoPersona[_address];
}
function setSCValidator(address _address) public {
addressValidator = _address;
}
function isValidator(address _address) public view returns (bool) {
Validator validator = Validator(addressValidator);
return validator.checkValidator(_address);
}
}
contract Validator {
mapping (address => bool) public isValidator;
address public addressPersona;
constructor(address _addressPersona) public {
addressPersona = _addressPersona;
}
function addValidator (address _address) public {
isValidator[_address] = true;
}
function checkValidator (address _address) public view returns (bool) {
return isValidator[_address];
}
function getInfo (address _address) public view returns (string memory) {
Persona persona = Persona(addressPersona);
string memory info = persona.getInfoPersona(_address);
return info;
}
}