@naba-finance/uaepass 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +129 -0
- package/contracts/ICredential.sol +63 -0
- package/deployments/addresses.json +17 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Naba Finance
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# @naba-finance/uaepass
|
|
2
|
+
|
|
3
|
+
Solidity interfaces and deployment addresses for integrating **UAE Pass on-chain identity**.
|
|
4
|
+
|
|
5
|
+
Use this package to gate your contracts on UAE Pass *provenance* — for example, a token that only addresses created by an official UAE Pass account can hold or receive.
|
|
6
|
+
|
|
7
|
+
> This is the public **integration** package. It ships interfaces + addresses only; the implementation contracts, validator, and ZK circuit live in a separate repository.
|
|
8
|
+
|
|
9
|
+
## What it provides
|
|
10
|
+
|
|
11
|
+
- [`ICredential`](contracts/ICredential.sol) — interface to the UAE Pass `Credential` contract. The key method is:
|
|
12
|
+
|
|
13
|
+
```solidity
|
|
14
|
+
function wasCreatedByUAEPass(address account) external view returns (bool);
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
It returns `true` iff `account` was deployed through one of the currently trusted UAE Pass account factories.
|
|
18
|
+
|
|
19
|
+
- [`deployments/addresses.json`](deployments/addresses.json) — canonical contract addresses.
|
|
20
|
+
|
|
21
|
+
### What `wasCreatedByUAEPass` means (and doesn't)
|
|
22
|
+
|
|
23
|
+
It is a **provenance** check: "was this address created by an official UAE Pass factory." It does **not** assert real-time control of the account, KYC/identity status, or that any particular validator is still installed. Gate on it when "is this one of our accounts" is the question you're answering.
|
|
24
|
+
|
|
25
|
+
## Deployed addresses
|
|
26
|
+
|
|
27
|
+
All contracts use a **same-address deployment**: the address is identical on every supported chain (CREATE2 via Arachnid's deterministic deployment proxy).
|
|
28
|
+
|
|
29
|
+
| Contract | Address |
|
|
30
|
+
| --------------- | -------------------------------------------- |
|
|
31
|
+
| `Credential` | `0x8bA9eB1FF63DEd9145d341f316758e6Ca132Cb0e` |
|
|
32
|
+
| `Registry` | `0x9B66841644a49187b34660fEb05d057f7f4a3C4E` |
|
|
33
|
+
| `Validator` | `0x07656Fb863E3181664014124604f6fE5A2836206` |
|
|
34
|
+
| `AccountFactory`| `0x3B56036FeE71527879E8a423DDcF327e08aD00A8` |
|
|
35
|
+
| `Verifier` | `0xDe29EFC7d5E21308a8AE2f95fE0946D96581427f` |
|
|
36
|
+
| `KernelFactory` | `0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419` |
|
|
37
|
+
|
|
38
|
+
| Chain | Chain ID | Network |
|
|
39
|
+
| ------------- | -------- | ------- |
|
|
40
|
+
| Polygon PoS | 137 | mainnet |
|
|
41
|
+
| Polygon Amoy | 80002 | testnet |
|
|
42
|
+
| ADI | 36900 | mainnet |
|
|
43
|
+
| ADI | 99999 | testnet |
|
|
44
|
+
|
|
45
|
+
For most integrations you only need **`Credential`**.
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install @naba-finance/uaepass
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Hardhat
|
|
54
|
+
|
|
55
|
+
Import directly from `node_modules`:
|
|
56
|
+
|
|
57
|
+
```solidity
|
|
58
|
+
import {ICredential} from "@naba-finance/uaepass/contracts/ICredential.sol";
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Foundry
|
|
62
|
+
|
|
63
|
+
Foundry resolves `node_modules`. Add a remapping (see [`remappings.txt`](remappings.txt)):
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
@naba-finance/uaepass/=node_modules/@naba-finance/uaepass/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
then import the same way:
|
|
70
|
+
|
|
71
|
+
```solidity
|
|
72
|
+
import {ICredential} from "@naba-finance/uaepass/contracts/ICredential.sol";
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Usage — gating a token
|
|
76
|
+
|
|
77
|
+
```solidity
|
|
78
|
+
// SPDX-License-Identifier: MIT
|
|
79
|
+
pragma solidity ^0.8.24;
|
|
80
|
+
|
|
81
|
+
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
82
|
+
import {ICredential} from "@naba-finance/uaepass/contracts/ICredential.sol";
|
|
83
|
+
|
|
84
|
+
/// @notice ERC-20 holdable only by UAE Pass accounts.
|
|
85
|
+
contract GatedToken is ERC20 {
|
|
86
|
+
ICredential public immutable credential;
|
|
87
|
+
|
|
88
|
+
error NotUAEPassAccount(address account);
|
|
89
|
+
|
|
90
|
+
constructor(ICredential _credential) ERC20("Gated", "GATE") {
|
|
91
|
+
credential = _credential; // 0x8bA9eB1FF63DEd9145d341f316758e6Ca132Cb0e
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// OZ v5 transfer hook — runs on mint, transfer, and burn.
|
|
95
|
+
function _update(address from, address to, uint256 value) internal override {
|
|
96
|
+
// Allow burns (to == address(0)); gate every recipient otherwise.
|
|
97
|
+
if (to != address(0) && !credential.wasCreatedByUAEPass(to)) {
|
|
98
|
+
revert NotUAEPassAccount(to);
|
|
99
|
+
}
|
|
100
|
+
super._update(from, to, value);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Reading the predicate off-chain (viem):
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { createPublicClient, http } from "viem";
|
|
109
|
+
import { polygon } from "viem/chains";
|
|
110
|
+
|
|
111
|
+
const client = createPublicClient({ chain: polygon, transport: http() });
|
|
112
|
+
|
|
113
|
+
const isUAEPass = await client.readContract({
|
|
114
|
+
address: "0x8bA9eB1FF63DEd9145d341f316758e6Ca132Cb0e",
|
|
115
|
+
abi: [{
|
|
116
|
+
type: "function",
|
|
117
|
+
name: "wasCreatedByUAEPass",
|
|
118
|
+
stateMutability: "view",
|
|
119
|
+
inputs: [{ name: "account", type: "address" }],
|
|
120
|
+
outputs: [{ type: "bool" }],
|
|
121
|
+
}],
|
|
122
|
+
functionName: "wasCreatedByUAEPass",
|
|
123
|
+
args: [userAddress],
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.4;
|
|
3
|
+
|
|
4
|
+
/// @title ICredential
|
|
5
|
+
/// @author Naba Finance
|
|
6
|
+
/// @notice Public, dependency-free interface to the UAE Pass `Credential` contract.
|
|
7
|
+
/// Integrators use this to gate functionality on UAE Pass provenance —
|
|
8
|
+
/// i.e. "was this address created by an official UAE Pass account factory".
|
|
9
|
+
///
|
|
10
|
+
/// @dev The canonical predicate is {wasCreatedByUAEPass}. It is a pure
|
|
11
|
+
/// provenance check: it returns true iff `account` was deployed through
|
|
12
|
+
/// one of the currently trusted UAE Pass account factories. It does NOT
|
|
13
|
+
/// attest to real-time control, KYC status, or that any particular
|
|
14
|
+
/// validator is still installed on the account.
|
|
15
|
+
///
|
|
16
|
+
/// Deployed at the same address on every supported chain (CREATE2
|
|
17
|
+
/// same-address scheme). See deployments/addresses.json / the README.
|
|
18
|
+
///
|
|
19
|
+
/// Ownership/admin functions (owner, transferOwnership, acceptOwnership)
|
|
20
|
+
/// come from OpenZeppelin's Ownable2Step and are intentionally omitted
|
|
21
|
+
/// here; integrators only need the read surface below.
|
|
22
|
+
interface ICredential {
|
|
23
|
+
/// @notice Emitted when a factory is added to the trusted list.
|
|
24
|
+
/// @param factory The factory address that was trusted.
|
|
25
|
+
/// @param by The owner account that performed the change.
|
|
26
|
+
event FactoryAdded(address indexed factory, address indexed by);
|
|
27
|
+
|
|
28
|
+
/// @notice Emitted when a factory is removed from the trusted list.
|
|
29
|
+
/// @param factory The factory address that was untrusted.
|
|
30
|
+
/// @param by The owner account that performed the change.
|
|
31
|
+
event FactoryRemoved(address indexed factory, address indexed by);
|
|
32
|
+
|
|
33
|
+
/// @notice Address of the UAE Pass validator associated with this contract.
|
|
34
|
+
/// @dev This is the `UAEPassValidator` — an ERC-7579 validator module
|
|
35
|
+
/// installed as the root validator on the ZeroDev Kernel (v3.1)
|
|
36
|
+
/// accounts that UAE Pass deploys. Returned as a plain `address`;
|
|
37
|
+
/// cast it to the validator's own interface if you need to call it.
|
|
38
|
+
/// Informational: {wasCreatedByUAEPass} is a factory-provenance
|
|
39
|
+
/// check and does NOT depend on this validator still being at root.
|
|
40
|
+
/// @return The validator module address (immutable, same on every chain).
|
|
41
|
+
function validator() external view returns (address);
|
|
42
|
+
|
|
43
|
+
/// @notice Whether `factory` is currently in the trusted list.
|
|
44
|
+
/// @param factory The factory address to query.
|
|
45
|
+
/// @return True if the factory is trusted.
|
|
46
|
+
function isTrustedFactory(address factory) external view returns (bool);
|
|
47
|
+
|
|
48
|
+
/// @notice The full list of currently trusted factories.
|
|
49
|
+
/// @return The trusted factory addresses.
|
|
50
|
+
function getFactories() external view returns (address[] memory);
|
|
51
|
+
|
|
52
|
+
/// @notice Number of trusted factories (for paginated reads).
|
|
53
|
+
/// @return The count of trusted factories.
|
|
54
|
+
function factoriesLength() external view returns (uint256);
|
|
55
|
+
|
|
56
|
+
/// @notice Whether `account` was created through a currently trusted UAE
|
|
57
|
+
/// Pass account factory.
|
|
58
|
+
/// @dev Provenance check only — see the interface-level notes. Returns
|
|
59
|
+
/// false for any address not deployed by a trusted factory.
|
|
60
|
+
/// @param account The address to check.
|
|
61
|
+
/// @return True if the account is of UAE Pass provenance.
|
|
62
|
+
function wasCreatedByUAEPass(address account) external view returns (bool);
|
|
63
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"note": "Same-address deployment: every contract lives at the SAME address on every supported chain (CREATE2 via Arachnid's deterministic deployment proxy). The chain list below shares the single address set in `contracts`.",
|
|
3
|
+
"contracts": {
|
|
4
|
+
"credential": "0x8bA9eB1FF63DEd9145d341f316758e6Ca132Cb0e",
|
|
5
|
+
"registry": "0x9B66841644a49187b34660fEb05d057f7f4a3C4E",
|
|
6
|
+
"validator": "0x07656Fb863E3181664014124604f6fE5A2836206",
|
|
7
|
+
"factory": "0x3B56036FeE71527879E8a423DDcF327e08aD00A8",
|
|
8
|
+
"verifier": "0xDe29EFC7d5E21308a8AE2f95fE0946D96581427f",
|
|
9
|
+
"kernelFactory": "0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419"
|
|
10
|
+
},
|
|
11
|
+
"chains": {
|
|
12
|
+
"137": { "name": "Polygon PoS", "network": "mainnet" },
|
|
13
|
+
"80002": { "name": "Polygon Amoy", "network": "testnet" },
|
|
14
|
+
"36900": { "name": "ADI", "network": "mainnet" },
|
|
15
|
+
"99999": { "name": "ADI", "network": "testnet" }
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@naba-finance/uaepass",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Solidity interfaces and deployment addresses for integrating UAE Pass on-chain identity (gate functionality on UAE Pass provenance).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/Naba-Finance/uaepass-sdk#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Naba-Finance/uaepass-sdk.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Naba-Finance/uaepass-sdk/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"uaepass",
|
|
16
|
+
"solidity",
|
|
17
|
+
"ethereum",
|
|
18
|
+
"polygon",
|
|
19
|
+
"identity",
|
|
20
|
+
"account-abstraction",
|
|
21
|
+
"erc-4337",
|
|
22
|
+
"token-gating"
|
|
23
|
+
],
|
|
24
|
+
"files": [
|
|
25
|
+
"contracts/**/*.sol",
|
|
26
|
+
"deployments/*.json",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
}
|
|
33
|
+
}
|