Skip to content

Commit f416855

Browse files
authored
feat(registry): define and use EIP1056Registry contract interface (#60)
* rename EthereumDIDRegistry to DIDRegistry * upgrade solidity 0.8.21, upgrade hardhat, simplify Dockerbuild * Document functions in DIDRegistry contract * Add EIP1056Registry * review: rename internal contract functions to include _ to avoid namespace pollution
1 parent 228ecc4 commit f416855

15 files changed

+1281
-461
lines changed
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
{
22
"extends": "solhint:recommended",
33
"rules": {
4-
"compiler-version": ["error", "^0.8.0"],
5-
"func-visibility": ["warn", { "ignoreConstructors": true }],
4+
"compiler-version": [
5+
"error",
6+
"^0.8.15"
7+
],
8+
"func-visibility": [
9+
"warn",
10+
{
11+
"ignoreConstructors": true
12+
}
13+
],
614
"not-rely-on-time": "off"
715
}
8-
}
16+
}

packages/did-eth-registry/Dockerfile

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,17 @@
1-
FROM debian:stable-slim as python-builder
1+
FROM ghcr.io/xmtp/foundry:latest
22

3-
# python3.10 is required for node-gyp
3+
RUN useradd --create-home -s /bin/bash did
4+
RUN usermod -a -G sudo did
5+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
46

7+
# Python
58
RUN export DEBIAN_FRONTEND=noninteractive && \
69
apt update && \
710
apt install -y -q --no-install-recommends \
8-
npm build-essential curl \
9-
ca-certificates apt-transport-https \
10-
libncursesw5-dev libssl-dev \
11-
libsqlite3-dev tk-dev libgdbm-dev \
12-
libc6-dev libbz2-dev libffi-dev zlib1g-dev \
13-
python3-pip python3-dev && \
11+
python3-pip python3-dev python3 && \
1412
apt clean && \
1513
rm -rf /var/lib/apt/lists/*
1614

17-
WORKDIR /build
18-
ADD https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz Python-3.10.13.tgz
19-
RUN tar -xvf Python-3.10.13.tgz
20-
WORKDIR /build/Python-3.10.13
21-
RUN ./configure --enable-optimizations
22-
RUN make -j4
23-
24-
FROM ghcr.io/xmtp/foundry:latest
25-
26-
RUN useradd --create-home -s /bin/bash did
27-
RUN usermod -a -G sudo did
28-
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
29-
30-
# Python 3.10
31-
32-
COPY --from=python-builder /build /build
33-
WORKDIR /build/Python-3.10.13
34-
RUN make install
35-
RUN which python3 && python3 --version
36-
RUN rm -rf /build
37-
38-
RUN mkdir -p /usr/local/nvm
39-
ENV NVM_DIR=/usr/local/nvm
40-
41-
ENV NODE_VERSION=v14.21.3
42-
43-
ADD https://raw.githubusercontent.com/creationix/nvm/master/install.sh /usr/local/etc/nvm/install.sh
44-
RUN bash /usr/local/etc/nvm/install.sh && \
45-
bash -c ". $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm alias default $NODE_VERSION && nvm use default"
46-
47-
ENV NVM_NODE_PATH ${NVM_DIR}/versions/node/${NODE_VERSION}
48-
ENV NODE_PATH ${NVM_NODE_PATH}/lib/node_modules
49-
ENV PATH ${NVM_NODE_PATH}/bin:$PATH
50-
51-
RUN npm install [email protected] -g
52-
RUN npm install yarn -g
53-
5415
ARG PROJECT=did-eth
5516
WORKDIR /workspaces/${PROJECT}
5617

packages/did-eth-registry/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ To use the contract, we provide hardhat artifacts. Once you require the `ethr-di
5757
object containing the JSON.
5858

5959
```javascript
60-
const { EthereumDIDRegistry } = require('ethr-did-registry')
60+
const { DIDRegistry } = require('ethr-did-registry')
6161
```
6262

6363
You can use [`ethers.js`](https://github.com/ethers-io/ethers.js/) to utilize these artifacts.
6464

6565
```javascript
6666
const { ethers } = require('ethers')
67-
const DidReg = new ethers.Contract(registryAddress, EthereumDIDRegistry.abi)
67+
const DidReg = new ethers.Contract(registryAddress, DIDRegistry.abi)
6868
DidReg.connect(yourSignerOrProvider)
6969
```
7070

0 commit comments

Comments
 (0)