https://github.com/sigmagmbh/swisstronik-sdi-contracts
Smart Contracts which are created to help developers interact with SDI (Swisstronik Digital Identity)
https://github.com/sigmagmbh/swisstronik-sdi-contracts
compliance cosmos dapp smart-contract smart-contracts solidity swisstronik
Last synced: about 1 month ago
JSON representation
Smart Contracts which are created to help developers interact with SDI (Swisstronik Digital Identity)
- Host: GitHub
- URL: https://github.com/sigmagmbh/swisstronik-sdi-contracts
- Owner: SigmaGmbH
- Created: 2024-06-17T15:38:55.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-03-20T11:40:36.000Z (2 months ago)
- Last Synced: 2025-04-04T18:23:30.693Z (about 2 months ago)
- Topics: compliance, cosmos, dapp, smart-contract, smart-contracts, solidity, swisstronik
- Language: Solidity
- Homepage: https://swisstronik.com
- Size: 301 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Swisstronik SDI Contracts
## Overview
Contracts to interact witht the compliance module.
It's designed for managing issuer records and verifying user compliance based on various criteria. It leverages the OpenZeppelin library for secure contract upgradeability and ownership management. The contract interacts with the compliance module/bridge to verify user data against issuer records.
## Features
- **Issuer Management**: Add, update, and remove issuer records securely.
- **User Verification**: Verify users based on compliance criteria such as AML (Anti-Money Laundering) checks and humanity verification.
- **Data Retrieval**: List issuer records and verification data for users.
- **Data Decoding**: Decode original data formats for various verification systems (Quadrata Passport V1, Worldcoin V1, Compilot V1, Zeronym V1).
- **Upgradeability**: Utilize OpenZeppelin's upgradeable contract patterns to allow future improvements without state loss.## Integration
In your solidity repository, run `npm i @swisstronik/sdi-contracts`
```solidity
pragma solidity ^0.8.24;
import {ISWTRProxy} from "@swisstronik/sdi-contracts/contracts/interfaces/ISWTRProxy.sol";
contract Sample {
ISWTRProxy public swtrProxy;
constructor(ISWTRProxy _swtrProxy) { swtrProxy = _swtrProxy; }function isUserVerified(
address user,
ISWTRProxy.VerificationType verificationType
) public view returns (bool) {
// Example call; expirationTimestamp set to 0 if not used.
return swtrProxy.isUserVerified(user, 0, verificationType);
}}
```## Functions
### Issuer Management
- `addIssuersRecord(string[] memory name, uint32[] memory version, address[] memory issuerAddress)`: Adds multiple issuer records.
- `removeIssuerRecord(string memory name, uint32 version)`: Removes an issuer record.
- `getIssuerRecordByAddress(address issuerAddress)`: Gets the issuer record by its address.
- `getIssuerAddressesByNameAndVersions(string memory name, uint32[] memory version)`: Get list of Issuer addresses by their name and versions
- `updateIssuerRecord(address issuerAddress, string memory name)`: Updates the name of an issuer.
- `listIssuersRecord(uint256 start, uint256 end)`: Lists issuer records within a specified range.
- `issuerRecordCount()`: Returns the total number of issuer records.### User Verification
- `isUserVerified(address userAddress, IComplianceBridge.VerificationType verificationType)`: Checks if a user is verified based on a specific verification type.
- `isUserVerifiedBy(address userAddress, IComplianceBridge.VerificationType verificationType, address[] memory allowedIssuers)`: Checks if a user is verified by specific issuers.
- `listVerificationData(address userAddress, address issuerAddress)`: Lists verification data for a user by an issuer.
- `getVerificationDataById(address userAddress, address issuerAddress, bytes memory verificationId)`: Retrieves verification data by ID.
- `getVerificationCountry(address userAddress, address issuerAddress, IComplianceBridge.VerificationType verificationType)`: Retrieves the country associated with a verification.
- `passedVerificationType(address userAddress, address issuerAddress, IComplianceBridge.VerificationType verificationType)`: Checks if a user has passed a specific verification type.
- `isUserHuman(address userAddress, address issuerAddress)`: Checks if a user has passed humanity verification.
- `walletPassedAML(address userAddress, address issuerAddress)`: Checks if a user's wallet has passed AML checks.### Data Decoding
#### decodeQuadrataPassportV1OriginalData(bytes memory originalData)Decodes original data for Quadrata Passport V1 verification.
Returns:
- `uint8 aml`: AML score or status.
- `string country`: The country extracted from the data.
- `string did`: The decentralized identifier.
- `bool isBusiness`: Indicates if the entity is a business.
- `bool investorStatus`: Indicates the investor status.#### decodeWorldcoinV1OriginalData(bytes memory originalData)
Decodes original data for Worldcoin V1 verification.
Returns:
- `string merkle_root`: The Merkle root.
- `string nullifier_hash`: The nullifier hash.
- `string proof`: The cryptographic proof.
- `string verification_level`: The verification level.#### decodeCompilotV1OriginalData(bytes memory originalData)
Decodes original data for Compilot V1 verification.
Returns:
- `string riskScore`: The risk score.
- `uint32 createdAt`: The Unix timestamp when the record was created.
- `string status`: The status of the verification.#### decodeZeronymV1OriginalData(bytes memory originalData)
Decodes original data for Zeronym V1 verification.
Returns:
- `bool isFromUs`: Indicates whether the user
- `uint256 actionId`: An action identifier.
- `uint256 output1`: The first output value.
- `uint256 output2`: The second output value.## Build
`npx hardhat compile`
## Deploy
`npx hardhat run scripts/deploy.ts --network testnet`
## Deployed Contracts
| Contract | Address |
|------------|--------------------------------------------|
| ProxyAdmin | `0x96e3ba5a33d21f64E5504Fd964656d1535a87F7e` |
| SWTRProxy | `0xBF896E5616d12fE6Bd7a376D2DBb924ff531CFDF` |