Skip to content

Commit

Permalink
feat(registry): define and use EIP1056Registry contract interface (#60)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jac18281828 authored Nov 2, 2023
1 parent 228ecc4 commit f416855
Show file tree
Hide file tree
Showing 15 changed files with 1,281 additions and 461 deletions.
14 changes: 11 additions & 3 deletions packages/did-eth-registry/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "^0.8.0"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"compiler-version": [
"error",
"^0.8.15"
],
"func-visibility": [
"warn",
{
"ignoreConstructors": true
}
],
"not-rely-on-time": "off"
}
}
}
51 changes: 6 additions & 45 deletions packages/did-eth-registry/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,56 +1,17 @@
FROM debian:stable-slim as python-builder
FROM ghcr.io/xmtp/foundry:latest

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

# Python
RUN export DEBIAN_FRONTEND=noninteractive && \
apt update && \
apt install -y -q --no-install-recommends \
npm build-essential curl \
ca-certificates apt-transport-https \
libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev \
libc6-dev libbz2-dev libffi-dev zlib1g-dev \
python3-pip python3-dev && \
python3-pip python3-dev python3 && \
apt clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /build
ADD https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz Python-3.10.13.tgz
RUN tar -xvf Python-3.10.13.tgz
WORKDIR /build/Python-3.10.13
RUN ./configure --enable-optimizations
RUN make -j4

FROM ghcr.io/xmtp/foundry:latest

RUN useradd --create-home -s /bin/bash did
RUN usermod -a -G sudo did
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

# Python 3.10

COPY --from=python-builder /build /build
WORKDIR /build/Python-3.10.13
RUN make install
RUN which python3 && python3 --version
RUN rm -rf /build

RUN mkdir -p /usr/local/nvm
ENV NVM_DIR=/usr/local/nvm

ENV NODE_VERSION=v14.21.3

ADD https://raw.githubusercontent.com/creationix/nvm/master/install.sh /usr/local/etc/nvm/install.sh
RUN bash /usr/local/etc/nvm/install.sh && \
bash -c ". $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm alias default $NODE_VERSION && nvm use default"

ENV NVM_NODE_PATH ${NVM_DIR}/versions/node/${NODE_VERSION}
ENV NODE_PATH ${NVM_NODE_PATH}/lib/node_modules
ENV PATH ${NVM_NODE_PATH}/bin:$PATH

RUN npm install [email protected] -g
RUN npm install yarn -g

ARG PROJECT=did-eth
WORKDIR /workspaces/${PROJECT}

Expand Down
4 changes: 2 additions & 2 deletions packages/did-eth-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ To use the contract, we provide hardhat artifacts. Once you require the `ethr-di
object containing the JSON.

```javascript
const { EthereumDIDRegistry } = require('ethr-did-registry')
const { DIDRegistry } = require('ethr-did-registry')
```

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

```javascript
const { ethers } = require('ethers')
const DidReg = new ethers.Contract(registryAddress, EthereumDIDRegistry.abi)
const DidReg = new ethers.Contract(registryAddress, DIDRegistry.abi)
DidReg.connect(yourSignerOrProvider)
```

Expand Down
Loading

0 comments on commit f416855

Please sign in to comment.