/// @dev Attribute store infomation as it relates to a single attribute
/// `attrKeys` Array of keys defined by (wallet address/DID + data Type)
/// `value` Attribute value
/// `epoch` timestamp when the attribute has been verified by an Issuer
/// `issuer` address of the issuer issuing the attribute
struct Attribute {
bytes32 value;
uint256 epoch;
address issuer;
}
For Solidity version < 0.8.0
UsegetAttributesLegacy()which returns three arrays. The index of each array maps to the others to create a tuple (e.g. attributeValues[0], epochs[0], issuers[0] are part of the same result).
epochs: Timestamp that indicates when the attribute was verified by the passport issuer.
issuers: Passport issuer who verified the attributes.
Example
import "@quadrata/contracts/interfaces/IQuadReader.sol";
import "@quadrata/contracts/interfaces/IQuadPassportStore.sol";
import "@quadrata/contracts/utility/QuadReaderUtils.sol";
contract MyDapp {
using QuadReaderUtils for bytes32;
IQuadReader public reader;
function borrowMoney() external payable {
IQuadPassportStore.Attribute[] memory attributes = reader.getAttributes(
msg.sender,
keccak256("COUNTRY")
);
require(attributes.length > 0, "REQUIRES_COUNTRY");
// only users residing outside the US may borrow money
if (!attributes[0].value.countryIsEqual("US")) {
// Allow borrow actions
}
}
The attribute you want to query. See: .
attributeValues: Raw or hashed attribute values. See for the return values of each attribute.
You can find our helper library to facilitate parsing the response =>