Created
April 30, 2023 16:41
-
-
Save changwu-tw/59d67d1be5e3afed4b603a4743bb4e1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: CC0-1.0 | |
pragma solidity ^0.8.0; | |
import "./interfaces/IERC5851.sol"; | |
abstract contract ERC5851Issuer is IERC5851{ | |
mapping(uint256 => IERC5851.Claim[]) private _claimMetadata; | |
mapping(address => mapping(uint256 => bool)) private _SBTVerified; | |
address public admin; | |
constructor() { | |
admin = msg.sender; | |
} | |
function ifVerified(address claimmer, uint256 SBTID) public override view returns (bool){ | |
return(_SBTVerified[claimmer][SBTID]); | |
} | |
function standardClaim(uint256 SBTID) public override view returns (Claim[] memory){ | |
return(_claimMetadata[SBTID]); | |
} | |
function changeStandardClaim(uint256 SBTID, Claim[] memory _claims) public override returns (bool){ | |
require(msg.sender == admin); | |
_claimMetadata[SBTID] = _claims; | |
emit StandardChanged(SBTID, _claims); | |
return(true); | |
} | |
function certify(address claimer, uint256 SBTID) public override returns (bool){ | |
require(msg.sender == admin); | |
_SBTVerified[claimer][SBTID] = true; | |
emit Certified(claimer, SBTID); | |
return(true); | |
} | |
function revoke(address claimer, uint256 SBTID) external override returns (bool){ | |
require(msg.sender == admin); | |
_SBTVerified[claimer][SBTID] = false; | |
emit Revoked(claimer, SBTID); | |
return(true); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: CC0-1.0 | |
pragma solidity ^0.8.0; | |
import "./interfaces/IERC5851.sol"; | |
abstract contract ERC5851Verifier is IERC5851 { | |
address private _issuer; | |
constructor(address issuer) { | |
_issuer = issuer; | |
} | |
modifier KYCApproved(address claimer, uint256 SBTID) { | |
IERC5851(_issuer).ifVerified(claimer, SBTID); | |
_; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment