Skip to content

Commit d9595eb

Browse files
authored
🔀 add new dojang type for VerifyCode
2 parents 58751c6 + 1499a96 commit d9595eb

21 files changed

Lines changed: 1924 additions & 173 deletions

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
Dojang is a service that issues offchain information (outside the blockchain) as onchain attestations on the GIWA chain. It plays an important role in linking onchain wallet addresses with offchain information. This allows users to hold an onchain identity without revealing Personally Identifiable Information (PII) from their wallet.
55

6-
Dojang aims to establish the trust layer of the Giwa ecosystem by leveraging Ethereum Attestation Service (EAS).
6+
Dojang aims to establish the trust layer of the GIWA ecosystem by leveraging Ethereum Attestation Service (EAS).
77

88
## Contracts
99

10-
### Giwa Testnet (Sepolia)
10+
### GIWA Testnet (Sepolia)
1111

1212
- Schemas
1313

@@ -16,7 +16,7 @@ Dojang aims to establish the trust layer of the Giwa ecosystem by leveraging Eth
1616
| Verified Address | Wallet address which is verified by a trusted issuer | `bool isVerified` | `0x568eb581cdf80b03d3bdfa414f3203bfdcc4bba4e66355612bd0e879da812f06` | `0x072d75e18b2be4f89a13a7147240477481c4b526d5795802acba59046b426e08` |
1717
| Balance Root | Root of a Merkle tree of balances | `uint256 coinType,uint64 snapshotAt,uint192 leafCount,uint256 totalAmount,bytes32 root` | `0xf09c1384d860519bb4ea5bb2a45ab64b00a8d900d47fb79203663be6da21e06c` | `0x369faa9c2cd261c45be3db5e230b585f5f1abecf8e12be575bb543e917e6db52` |
1818
| Verified Balance | User's balance verified by a trusted issuer | `uint256 balance,bytes32 salt,bytes32[] proofs` | `0x06c3bd846f5ea60b0b6f5a835ef85fd8253b53f67917d6c690be628d032f841b` | `0x77bf88ca262cc63e1b185dccd870aacc5320b8987ef6c7169920f265fe6ab5e9` |
19-
19+
| Verified Code | Authentication code verified by a trusted issuer | `bytes32 codeHash,string domain` | `0x68053e055c01ce9b3577f3162b36324bb195ebcb574c48e823480d205f06af9b` | `0x55ac1369dac97522d062b89ffdc4e752b48fbeba86915fdb956c7c2d0501d280` |
2020

2121
- Contracts
2222

@@ -30,7 +30,8 @@ Dojang aims to establish the trust layer of the Giwa ecosystem by leveraging Eth
3030
| AddressDojangResolver | Triggered on issuance or revocation of a Verified Address attestation | [`0x692009FE206C3F897867F6BF7B5B45506B747F9e`](https://sepolia-explorer.giwa.io/address/0x692009FE206C3F897867F6BF7B5B45506B747F9e) | v0.2.0 |
3131
| BalanceRootDojangResolver | Triggered on issuance or revocation of a Balance Root attestation | [`0xD90a964aB65bc02397De1E7fcBd230803bC1bEd0`](https://sepolia-explorer.giwa.io/address/0xD90a964aB65bc02397De1E7fcBd230803bC1bEd0) | v0.4.0 |
3232
| BalanceDojangResolver | Triggered on issuance or revocation of a Verified Balance attestation | [`0x6FFa7ABc1E380Bb967C78D5E648EF804e1fE6dAd`](https://sepolia-explorer.giwa.io/address/0x6FFa7ABc1E380Bb967C78D5E648EF804e1fE6dAd) | v0.4.0 |
33-
| DojangScroll | Provides convenient read access to Dojang data | [`0xd5077b67dcb56caC8b270C7788FC3E6ee03F17B9`](https://sepolia-explorer.giwa.io/address/0xd5077b67dcb56caC8b270C7788FC3E6ee03F17B9) | v0.4.0 |
33+
| VerifyCodeDojangResolver | Triggered on issuance or revocation of a Verified Code attestation | [`0x843fF433f7657901118fF3E2Eca915abb9BC12Df`](https://sepolia-explorer.giwa.io/address/0x843fF433f7657901118fF3E2Eca915abb9BC12Df) | v0.5.0 |
34+
| DojangScroll | Provides convenient read access to Dojang data | [`0xd5077b67dcb56caC8b270C7788FC3E6ee03F17B9`](https://sepolia-explorer.giwa.io/address/0xd5077b67dcb56caC8b270C7788FC3E6ee03F17B9) | v0.5.0 |
3435

3536

3637
## Usage

broadcast/03-DeployVerifyCodeDojang.s.sol/91342/run-1764576757886.json

Lines changed: 397 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/03-DeployVerifyCodeDojang.s.sol/91342/run-latest.json

Lines changed: 397 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/Upgrade.s.sol/91342/run-1764577197151.json

Lines changed: 127 additions & 0 deletions
Large diffs are not rendered by default.

broadcast/Upgrade.s.sol/91342/run-latest.json

Lines changed: 42 additions & 157 deletions
Large diffs are not rendered by default.

deploy-config/91342.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"DojangAttesterBook": "0xDA282E89244424E297Ce8e78089B54D043FB28B6",
66
"DojangScroll": "0xd5077b67dcb56caC8b270C7788FC3E6ee03F17B9",
77
"SchemaBook": "0x78cBb3413FBb6aF05EF1D21e646440e56baE3AD6",
8-
"BalanceRootDojangResolver": "0xD90a964aB65bc02397De1E7fcBd230803bC1bEd0"
8+
"BalanceRootDojangResolver": "0xD90a964aB65bc02397De1E7fcBd230803bC1bEd0",
9+
"VerifyCodeDojangResolver": "0x843fF433f7657901118fF3E2Eca915abb9BC12Df"
910
}

deployments/91342-deploy.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"DojangAttesterBook": "0xDA282E89244424E297Ce8e78089B54D043FB28B6",
66
"DojangScroll": "0xd5077b67dcb56caC8b270C7788FC3E6ee03F17B9",
77
"SchemaBook": "0x78cBb3413FBb6aF05EF1D21e646440e56baE3AD6",
8-
"BalanceRootDojangResolver": "0xD90a964aB65bc02397De1E7fcBd230803bC1bEd0"
8+
"BalanceRootDojangResolver": "0xD90a964aB65bc02397De1E7fcBd230803bC1bEd0",
9+
"VerifyCodeDojangResolver": "0x843fF433f7657901118fF3E2Eca915abb9BC12Df"
910
}

offchain-specs/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Dojang Off-chain Specs
2+
3+
This directory contains **reference implementations** and **formal specs**
4+
for off-chain logic that must be consistent across all issuers and verifiers.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.28;
3+
4+
/// @notice Off-chain reference implementation for VerifyCode Dojang.
5+
/// @dev This contract is NEVER deployed on-chain. It exists solely as a spec.
6+
library VerifyCodeSpec {
7+
/// @notice Computes the codeHash from a user-facing code string.
8+
/// @dev Rule: codeHash = keccak256(bytes(code))
9+
function computeCodeHash(string memory code) internal pure returns (bytes32) {
10+
return keccak256(bytes(code));
11+
}
12+
13+
/// @notice Canonicalizes a domain string for VerifyCode usage.
14+
/// @dev Rule: trim leading/trailing spaces, remove all internal spaces (0x20),
15+
/// and lowercase ASCII characters only. Non-ASCII (e.g., Korean) characters are preserved as-is.
16+
function canonicalizeDomain(string memory domain) internal pure returns (string memory) {
17+
bytes memory b = bytes(domain);
18+
uint256 start = 0;
19+
uint256 end = b.length;
20+
21+
// trim leading/trailing spaces (0x20)
22+
while (start < end && b[start] == 0x20) start++;
23+
while (end > start && b[end - 1] == 0x20) end--;
24+
25+
// build canonicalized output: remove all spaces and lowercase ASCII
26+
bytes memory out = new bytes(end - start);
27+
uint256 n = 0;
28+
for (uint256 i = start; i < end; i++) {
29+
bytes1 c = b[i];
30+
// skip any whitespace (0x20)
31+
if (c == 0x20) continue;
32+
// lowercase ASCII only
33+
if (c >= 0x41 && c <= 0x5A) {
34+
c = bytes1(uint8(c) + 32);
35+
}
36+
out[n++] = c;
37+
}
38+
assembly { mstore(out, n) }
39+
return string(out);
40+
}
41+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dojang",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "Contracts for Dojang Service",
55
"engines": {
66
"node": ">=22.0.0"

0 commit comments

Comments
 (0)