In my system, users can request to be verified by a trusted contract. When a user creates an account he deploys this contract (omitting non-related parts)
pragma solidity ^0.4.11;
contract User {
// State variables
address owner = msg.sender;
bool verified = false;
uint creationTime = now;
struct PersonalInfo {
string firstName;
string LastName;
string email;
}
uint level = 0;
function requestVerification(address trustEntity) {
/*
This function should send a verification request
to a trust entity's contract
*/
}
}
There is a known trusted entity, whose contract address will be known to everyone, who should be the only entity capable of verifying the users. Its contract (omitting non-related parts) is
pragma solidity ^0.4.11;
contract TrustEntity {
address owner;
address registry;
address[] public pendingRequests;
function verifyUsers(address user) {
/*
Whenever a user requests verification, his
address should be pushed to the pendingRequests
array, so it can then be fetched to verify or
reject
*/
}
}
Every example I see of a contract interacting with another contract, they're both in the same file (docs, this question) so I don't know if it is possible for a contract to call another contract (or, in this specific case, to push an address into another contract's state variable / change another contract's state variable).