Contract Address Details
0xca0627F666421d7729F90dE44C0439C6c87a3412
UserConsentLogsManager
Last Balance Update: Block #9945603
Created by 0x2cbe–dd7429
at
0x5a63–495c7e
Balance
0 Quad
Fetching tokens...
- Contract name:
- UserConsentLogsManager
- Optimization enabled
- true
- Compiler version
- v0.6.12+commit.27d51765
- Optimization runs
- 200
- EVM Version
- byzantium
Contract source code
/*** Submitted for verification at blockscout.com on 2021-05-18 11:47:52.940748Z*/// File: @openzeppelin\contracts\GSN\Context.sol
//SPDX-License-Identifier: CC-BY-NC-ND-4.0
pragma solidity >=0.4.22 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: contracts\UserConsentLogsManager.sol
// Import Libraries
/**
* @title - User Consent Logs Manager
* @author - Quadrant
* @notice - A contract to emit user consent events within Quadrant chain that can be trusted by users and regulators
*/
contract UserConsentLogsManager is Context {
/**
* @dev Constructor function
* @notice Set contract deployer as the owner
*/
constructor() public {
isOwner[_msgSender()] = true;
}
/**
* @dev Mapping variable to store boolean checks for request type
* @notice If boolen is true then the request type is performed only by Quadrant for Quadrant Compliance App
* @notice If boolean is false then anyone can perform this request
*/
mapping(string => bool) public isAdminRequest;
mapping(address => bool) internal isOwner;
/**
* @dev Throws if the function is not called by the owner
*/
modifier onlyOwner() {
require(isOwner[_msgSender()], "No permission");
_;
}
/**
* @dev Throws if the function is neither called by the owner nor by the requester
* @param requester - The address of the requester
*/
modifier eitherOwnerOrRequester(address requester) {
require(
isOwner[_msgSender()] || _msgSender() == requester,
"No permission"
);
_;
}
/**
* @notice - Add SDK user audit trail
* @dev - Used to emit events when a user from publisher's app opts in, opts out, DNS, request or delete data
*/
event SdkUserConsentAuditTrail(
string requestId,
string requestType,
string regulation,
address indexed requestedBy,
address indexed app,
string deviceId,
bytes32 indexed data,
uint256 capturedAt,
uint8 requestStatus,
uint8 action
);
/**
* @notice - Add Quadrant Compliance user audit trail
* @dev - Used to emit events when a user from Quadrant compliance's app (or email) opts in, opts out, DNS, request or delete data
*/
event QuadrantComplianceUserAuditTrail(
string requestId,
string requestType,
address indexed requestedBy,
string deviceId,
bytes32 indexed data,
uint256 capturedAt,
uint8 requestStatus,
uint8 action,
string requestCameFrom
);
/**
* @dev - Function to set ownership
* @param inputAddress - The address whose ownership will be added or revoked
* @param ownerFlag - Boolean value to set. True indicates the address will be set as owner
* @notice - Access: Only Owner (Quadrant)
*/
function setOwner(address inputAddress, bool ownerFlag) external onlyOwner {
isOwner[inputAddress] = ownerFlag;
}
/**
* @dev - Function to set requests that are performed only by admin (Quadrant) for Quadrant compliance app
* @param requestType - Type of the request
* @param isOnlyQuadrantRequest - Boolean value to set. True indicates operation performed only by Quadrant
* @notice - Access: Only Owner (Quadrant)
*/
function setAdminRequest(
string memory requestType,
bool isOnlyQuadrantRequest
) external onlyOwner {
isAdminRequest[requestType] = isOnlyQuadrantRequest;
}
/**
* @dev - Function to emit SDK user event
* @notice - Emits event when there is a user operation from Publisher's SDK app side
* @param requestId - The request id in UUID format
* @param requestType - Type of the request
* @param regulation - GDPR, CCPA etc.
* @param requestedBy - Address of the requester (publisher address) or admin (quadrant)
* @param app - App address
* @param deviceId - Encrypted device id
* @param data - SHA256 hash of the json data object. The data will have details of the compliance event
* @param capturedAt - The 13 digit epoch time when the request was made
* @param requestStatus - The status of the request (e.g. PENDING, COMPLETED etc - represented in integers)
* @param action - Indicates if the request is forwarded or not (Default: '')
* @notice - Access: Either Owner (Quadrant) or the requester
*/
function addSdkUserConsentAuditTrail(
string memory requestId,
string memory requestType,
string memory regulation,
address requestedBy,
address app,
string memory deviceId,
bytes32 data,
uint256 capturedAt,
uint8 requestStatus,
uint8 action
) external eitherOwnerOrRequester(requestedBy) {
/// Accept all except Quadrant Compliance App requests
require(!isAdminRequest[requestType], "Invalid request");
/// Accept only NULL OR PENDING requestStatus when a non owner calls this function
if (!isOwner[_msgSender()]) {
require(
requestStatus == 0 || requestStatus == 1,
"Invalid request status"
);
}
/// Emit Event
emit SdkUserConsentAuditTrail(
requestId,
requestType,
regulation,
requestedBy,
app,
deviceId,
data,
capturedAt,
requestStatus,
action
);
}
/**
* @dev - Function to emit compliance app user event
* @notice - Emits event when there is an operation on Compliance App
* @param requestId - The request id in UUID format
* @param requestType - Type of the request
* @param requestedBy - Address of the requester (Quadrant/admin address)
* @param deviceId - Encrypted device id
* @param data - SHA256 hash of the json data object. The data will have details of the compliance event
* @param capturedAt - The 13 digit epoch time when the request was made
* @param requestStatus - The status of the request (e.g. PENDING, COMPLETED etc - represented in integers)
* @param action - Indicates if the request is forwarded or not (Default: '')
* @param requestCameFrom - Indicates whether the request came via email or compliance app
* @notice - Access: Only Owner (Quadrant)
*/
function addQuadrantComplianceUserAuditTrail(
string memory requestId,
string memory requestType,
address requestedBy,
string memory deviceId,
bytes32 data,
uint256 capturedAt,
uint8 requestStatus,
uint8 action,
string memory requestCameFrom
) external onlyOwner {
/// Accept only request types that are performed by Quadrant
require(isAdminRequest[requestType], "Invalid request");
/// Emit Event
emit QuadrantComplianceUserAuditTrail(
requestId,
requestType,
requestedBy,
deviceId,
data,
capturedAt,
requestStatus,
action,
requestCameFrom
);
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"QuadrantComplianceUserAuditTrail","inputs":[{"type":"string","name":"requestId","internalType":"string","indexed":false},{"type":"string","name":"requestType","internalType":"string","indexed":false},{"type":"address","name":"requestedBy","internalType":"address","indexed":true},{"type":"string","name":"deviceId","internalType":"string","indexed":false},{"type":"bytes32","name":"data","internalType":"bytes32","indexed":true},{"type":"uint256","name":"capturedAt","internalType":"uint256","indexed":false},{"type":"uint8","name":"requestStatus","internalType":"uint8","indexed":false},{"type":"uint8","name":"action","internalType":"uint8","indexed":false},{"type":"string","name":"requestCameFrom","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"SdkUserConsentAuditTrail","inputs":[{"type":"string","name":"requestId","internalType":"string","indexed":false},{"type":"string","name":"requestType","internalType":"string","indexed":false},{"type":"string","name":"regulation","internalType":"string","indexed":false},{"type":"address","name":"requestedBy","internalType":"address","indexed":true},{"type":"address","name":"app","internalType":"address","indexed":true},{"type":"string","name":"deviceId","internalType":"string","indexed":false},{"type":"bytes32","name":"data","internalType":"bytes32","indexed":true},{"type":"uint256","name":"capturedAt","internalType":"uint256","indexed":false},{"type":"uint8","name":"requestStatus","internalType":"uint8","indexed":false},{"type":"uint8","name":"action","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addQuadrantComplianceUserAuditTrail","inputs":[{"type":"string","name":"requestId","internalType":"string"},{"type":"string","name":"requestType","internalType":"string"},{"type":"address","name":"requestedBy","internalType":"address"},{"type":"string","name":"deviceId","internalType":"string"},{"type":"bytes32","name":"data","internalType":"bytes32"},{"type":"uint256","name":"capturedAt","internalType":"uint256"},{"type":"uint8","name":"requestStatus","internalType":"uint8"},{"type":"uint8","name":"action","internalType":"uint8"},{"type":"string","name":"requestCameFrom","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addSdkUserConsentAuditTrail","inputs":[{"type":"string","name":"requestId","internalType":"string"},{"type":"string","name":"requestType","internalType":"string"},{"type":"string","name":"regulation","internalType":"string"},{"type":"address","name":"requestedBy","internalType":"address"},{"type":"address","name":"app","internalType":"address"},{"type":"string","name":"deviceId","internalType":"string"},{"type":"bytes32","name":"data","internalType":"bytes32"},{"type":"uint256","name":"capturedAt","internalType":"uint256"},{"type":"uint8","name":"requestStatus","internalType":"uint8"},{"type":"uint8","name":"action","internalType":"uint8"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isAdminRequest","inputs":[{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAdminRequest","inputs":[{"type":"string","name":"requestType","internalType":"string"},{"type":"bool","name":"isOnlyQuadrantRequest","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setOwner","inputs":[{"type":"address","name":"inputAddress","internalType":"address"},{"type":"bool","name":"ownerFlag","internalType":"bool"}]}]
Contract Byte Code
0x608060405234801561001057600080fd5b5060043610610073577c010000000000000000000000000000000000000000000000000000000060003504631000d17d81146100785780632165ad1b14610122578063516c731c1461038c578063ae3737d9146103ba578063df41ef9414610625575b600080fd5b6101206004803603604081101561008e57600080fd5b8101906020810181356401000000008111156100a957600080fd5b8201836020820111156100bb57600080fd5b803590602001918460018302840111640100000000831117156100dd57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050505035151590506106df565b005b610120600480360361012081101561013957600080fd5b81019060208101813564010000000081111561015457600080fd5b82018360208201111561016657600080fd5b8035906020019184600183028401116401000000008311171561018857600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092959493602081019350359150506401000000008111156101db57600080fd5b8201836020820111156101ed57600080fd5b8035906020019184600183028401116401000000008311171561020f57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295600160a060020a0385351695909490935060408101925060200135905064010000000081111561027357600080fd5b82018360208201111561028557600080fd5b803590602001918460018302840111640100000000831117156102a757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929584359560208601359560ff60408201358116965060608201351694509192509060a08101906080013564010000000081111561031757600080fd5b82018360208201111561032957600080fd5b8035906020019184600183028401116401000000008311171561034b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506107be945050505050565b610120600480360360408110156103a257600080fd5b50600160a060020a0381351690602001351515610ae4565b61012060048036036101408110156103d157600080fd5b8101906020810181356401000000008111156103ec57600080fd5b8201836020820111156103fe57600080fd5b8035906020019184600183028401116401000000008311171561042057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561047357600080fd5b82018360208201111561048557600080fd5b803590602001918460018302840111640100000000831117156104a757600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092959493602081019350359150506401000000008111156104fa57600080fd5b82018360208201111561050c57600080fd5b8035906020019184600183028401116401000000008311171561052e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295600160a060020a03853581169660208701359091169591945092506060810191506040013564010000000081111561059a57600080fd5b8201836020820111156105ac57600080fd5b803590602001918460018302840111640100000000831117156105ce57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505082359350505060208101359060ff60408201358116916060013516610b7a565b6106cb6004803603602081101561063b57600080fd5b81019060208101813564010000000081111561065657600080fd5b82018360208201111561066857600080fd5b8035906020019184600183028401116401000000008311171561068a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610f65945050505050565b604080519115158252519081900360200190f35b600160006106eb610f85565b600160a060020a0316815260208101919091526040016000205460ff1661074a576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020610f8a833981519152604482015290519081900360640190fd5b806000836040518082805190602001908083835b6020831061077d5780518252601f19909201916020918201910161075e565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220805460ff19169315159390931790925550505050565b600160006107ca610f85565b600160a060020a0316815260208101919091526040016000205460ff16610829576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020610f8a833981519152604482015290519081900360640190fd5b6000886040518082805190602001908083835b6020831061085b5780518252601f19909201916020918201910161083c565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092205460ff1691506108e29050576040805160e560020a62461bcd02815260206004820152600f60248201527f496e76616c696420726571756573740000000000000000000000000000000000604482015290519081900360640190fd5b8487600160a060020a03167fe732a5275422a5ba5578656af54f185e069c5d887fc4f2456916cdae9488290f8b8b8a89898989604051808060200180602001806020018881526020018760ff1681526020018660ff1681526020018060200185810385528c818151815260200191508051906020019080838360005b8381101561097657818101518382015260200161095e565b50505050905090810190601f1680156109a35780820380516001836020036101000a031916815260200191505b5085810384528b5181528b516020918201918d019080838360005b838110156109d65781810151838201526020016109be565b50505050905090810190601f168015610a035780820380516001836020036101000a031916815260200191505b5085810383528a5181528a516020918201918c019080838360005b83811015610a36578181015183820152602001610a1e565b50505050905090810190601f168015610a635780820380516001836020036101000a031916815260200191505b50858103825286518152865160209182019188019080838360005b83811015610a96578181015183820152602001610a7e565b50505050905090810190601f168015610ac35780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390a3505050505050505050565b60016000610af0610f85565b600160a060020a0316815260208101919091526040016000205460ff16610b4f576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020610f8a833981519152604482015290519081900360640190fd5b600160a060020a03919091166000908152600160205260409020805460ff1916911515919091179055565b8660016000610b87610f85565b600160a060020a0316815260208101919091526040016000205460ff1680610bc7575080600160a060020a0316610bbc610f85565b600160a060020a0316145b610c09576040805160e560020a62461bcd02815260206004820152600d6024820152600080516020610f8a833981519152604482015290519081900360640190fd5b60008a6040518082805190602001908083835b60208310610c3b5780518252601f199092019160209182019101610c1c565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092205460ff16159150610cc39050576040805160e560020a62461bcd02815260206004820152600f60248201527f496e76616c696420726571756573740000000000000000000000000000000000604482015290519081900360640190fd5b60016000610ccf610f85565b600160a060020a0316815260208101919091526040016000205460ff16610d575760ff83161580610d0357508260ff166001145b610d57576040805160e560020a62461bcd02815260206004820152601660248201527f496e76616c696420726571756573742073746174757300000000000000000000604482015290519081900360640190fd5b8487600160a060020a031689600160a060020a03167f4e5739e2903f11bf9e98d992a294f0587899e49d8e5197bcad7c2238d28ad24b8e8e8e8c8b8b8b60405180806020018060200180602001806020018881526020018760ff1681526020018660ff16815260200185810385528c818151815260200191508051906020019080838360005b83811015610df5578181015183820152602001610ddd565b50505050905090810190601f168015610e225780820380516001836020036101000a031916815260200191505b5085810384528b5181528b516020918201918d019080838360005b83811015610e55578181015183820152602001610e3d565b50505050905090810190601f168015610e825780820380516001836020036101000a031916815260200191505b5085810383528a5181528a516020918201918c019080838360005b83811015610eb5578181015183820152602001610e9d565b50505050905090810190601f168015610ee25780820380516001836020036101000a031916815260200191505b5085810382528951815289516020918201918b019080838360005b83811015610f15578181015183820152602001610efd565b50505050905090810190601f168015610f425780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390a45050505050505050505050565b805160208183018101805160008252928201919093012091525460ff1681565b339056fe4e6f207065726d697373696f6e00000000000000000000000000000000000000a26469706673582212209fdc16dbcdfea7a09b4adef124bf27e5cb4713925e270f1428444a134aa56b6d64736f6c634300060c0033