Examples of Basic Integration
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {IMicapassBaseVerifier} from "../interfaces/IMicapassBaseVerifier.sol";
import {MicapassBasicClientInitializable} from "./MicapassBasicClientInitializable.sol";
import {Managerable} from "../extensions/Managerable.sol";
contract Client is MicapassBasicClientInitializable, Managerable {
mapping(address => uint256) internal _userBalance;
// Required for input formatting
uint256[] public requiredDepositClaimTopics;
uint256[] public requiredWithdrawalClaimTopics;
function initialize(address micapassAddress) external initializer {
__MicapassBasicClient_init(micapassAddress);
__Managerable_init();
}
function deposit()
external
payable
micapassProtected(msg.sender, CLAIM_TOPIC_KYC)
micapassProtected(msg.sender, CLAIM_TOPIC_WALLET_SCREENING)
{
_userBalance[msg.sender] += msg.value;
}
function withdraw()
external
micapassProtected(msg.sender, CLAIM_TOPIC_WALLET_SCREENING)
{
require(_userBalance[msg.sender] > 0, "No funds deposited");
uint256 userBalance = _userBalance[msg.sender];
_userBalance[msg.sender] = 0;
payable(msg.sender).transfer(userBalance);
}
function withdrawTo(
address receiver
)
external
mAddressNotZero(receiver)
micapassProtected(msg.sender, CLAIM_TOPIC_WALLET_SCREENING)
{
require(_userBalance[msg.sender] > 0, "No funds deposited");
uint256 userBalance = _userBalance[msg.sender];
_userBalance[msg.sender] = 0;
payable(receiver).transfer(userBalance);
}
}
Last updated