Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparation for ENS name wrapper #210

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ First, you need to specify deployments secrets in `config.edn`. For example:
:privateKeys ["0508d5f96e139a0c18ee97a92d890c55707c77b90916395ff7849efafffbd810"]
:ensAddress "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
:registrarAddress "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"
:nameWrapperAddress "TODO fill when ENS Ropsten deployment exists"
:metadataServiceAddress "TODO fill when ENS Ropsten deployment exists"
:publicResolverAddress "0x42D63ae25990889E35F215bC95884039Ba354115"
:reverseRegistrarAddress "0x6F628b68b30Dc3c17f345c9dbBb1E483c2b7aE5c"}}}
```
Expand Down
6 changes: 4 additions & 2 deletions docker-builds/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ RUN apt-get -yq update && apt-get install -yqq --no-install-recommends \
git \
python2.7 python-pip \
python3.7 python3-pip \
ssh
ssh \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# https://sanderknape.com/2019/06/installing-private-git-repositories-npm-install-docker/
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
Expand All @@ -27,5 +29,5 @@ ENV PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}"
# install truffle
ENV PYTHON /usr/bin/python3
RUN PYTHON=/usr/bin/python3 pip3 install --no-cache-dir solc-select
RUN solc-select install 0.5.17 && solc-select use 0.5.17
RUN solc-select install 0.8.4 && solc-select use 0.8.4
RUN npm install -g truffle --unsafe-perm=true --allow-root
4 changes: 3 additions & 1 deletion docker-builds/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ RUN apt-get -yq update && apt-get install -yqq --no-install-recommends \
git \
python2.7 python-pip \
python3.7 python3-pip \
ssh
ssh \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# https://sanderknape.com/2019/06/installing-private-git-repositories-npm-install-docker/
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
Expand Down
4 changes: 3 additions & 1 deletion docker-builds/ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ RUN apt-get -yq update && apt-get install -yqq --no-install-recommends \
git \
python2.7 python-pip \
python3.7 python3-pip \
ssh
ssh \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# https://sanderknape.com/2019/06/installing-private-git-repositories-npm-install-docker/
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
Expand Down
3 changes: 2 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
[lein-npm "0.6.2"]
[lein-pdo "0.1.1"]]

:npm {:dependencies [["@ensdomains/ens-contracts" "0.0.4"]
:npm {:dependencies [["@ensdomains/ens-contracts" "0.0.7"]
["@ensdomains/name-wrapper" "1.0.0"]
["@openzeppelin/contracts" "4.1.0"]
["@sentry/node" "4.2.1"]
["@ungap/global-this" "0.4.4"]
Expand Down
43 changes: 27 additions & 16 deletions resources/public/contracts-migration/2_namebazaar_migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ const validateDeploymentConfig = (config = {}) => {

const loadedArtifacts = loadArtifacts([
{kw: ':ens', name: 'ENSRegistry'},
{kw: ':eth-registrar', name: 'NameBazaarDevRegistrar'},
{kw: ':eth-registrar', name: 'NamebazaarDevRegistrar'},
{kw: ':name-wrapper', name: 'NameWrapper'},
{kw: ':metadata-service', name: 'StaticMetadataService'},
{kw: ':offering-registry', name: 'OfferingRegistry'},
{kw: ':mutable-forwarder', name: 'MutableForwarder'},
{kw: ':buy-now-offering', name: 'BuyNowOffering'},
Expand All @@ -105,13 +107,15 @@ const loadedArtifacts = loadArtifacts([
{kw: ':auction-offering-factory', name: 'AuctionOfferingFactory'},
{kw: ':district0x-emails', name: 'District0xEmails'},
{kw: ':reverse-name-resolver', name: 'NamebazaarDevNameResolver'},
{kw: ':public-resolver', name: 'NamebazaarDevPublicResolver'},
{kw: ':reverse-registrar', name: 'NamebazaarDevReverseRegistrar'},
{kw: ':public-resolver', name: 'PublicResolver'},
{kw: ':reverse-registrar', name: 'ReverseRegistrar'},
])

const {
ENSRegistry,
NameBazaarDevRegistrar,
NamebazaarDevRegistrar,
NameWrapper,
StaticMetadataService,
OfferingRegistry,
MutableForwarder,
BuyNowOffering,
Expand All @@ -120,8 +124,8 @@ const {
AuctionOfferingFactory,
District0xEmails,
NamebazaarDevNameResolver,
NamebazaarDevPublicResolver,
NamebazaarDevReverseRegistrar
PublicResolver,
ReverseRegistrar
} = loadedArtifacts

const emergencyMultisigPlaceholder = "DeEDdeeDDEeDDEEdDEedDEEdDEeDdEeDDEEDDeed".toLowerCase()
Expand All @@ -142,28 +146,35 @@ module.exports = async function (deployer, network, accounts) {
}

if (network === 'development') {
const [ens, namebazaarDevNameResolver] = await parallel(
metadataUrl = 'We don\'t care about metadata service currently'
const [ens, nameResolver, metadataService] = await parallel(
deploy(ENSRegistry),
deploy(NamebazaarDevNameResolver)
deploy(NamebazaarDevNameResolver),
deploy(StaticMetadataService, metadataUrl)
)

const [nameBazaarDevRegistrar, _, namebazaarDevReverseRegistrar] = await parallel(
deploy(NameBazaarDevRegistrar, ens.address, namehash('eth')),
deploy(NamebazaarDevPublicResolver, ens.address),
deploy(NamebazaarDevReverseRegistrar, ens.address, namebazaarDevNameResolver.address)
const [ethRegistrar, reverseRegistrar] = await parallel(
deploy(NamebazaarDevRegistrar, ens.address, namehash('eth')),
deploy(ReverseRegistrar, ens.address, nameResolver.address)
)
await ens.setSubnodeOwner(namehash(''), ensLabel('eth'), nameBazaarDevRegistrar.address)
await ens.setSubnodeOwner(namehash(''), ensLabel('eth'), ethRegistrar.address)
await ens.setSubnodeOwner(namehash(''), ensLabel('reverse'), accounts[0])
await ens.setSubnodeOwner(namehash('reverse'), ensLabel('addr'), namebazaarDevReverseRegistrar.address)
await ens.setSubnodeOwner(namehash('reverse'), ensLabel('addr'), reverseRegistrar.address)

// the contract's bytecode is too large to be deployed. Keep watching ENS for news.
// const nameWrapper = await deploy(NameWrapper, ens.address, ethRegistrar.address, metadataService.address)
const publicResolver = await deploy(PublicResolver, ens.address, nameWrapper.address)
} else {
const config = deployer.networks[network].deploymentConfig
validateDeploymentConfig(config)

skipDeploy(ENSRegistry, config.ensAddress)
skipDeploy(NamebazaarDevNameResolver, "0x0000000000000000000000000000000000000000") // this address is not important
skipDeploy(NameBazaarDevRegistrar, config.registrarAddress)
skipDeploy(NamebazaarDevPublicResolver, config.publicResolverAddress)
skipDeploy(NamebazaarDevReverseRegistrar, config.reverseRegistrarAddress)
skipDeploy(NameWrapper, config.nameWrapperAddress)
skipDeploy(MetadataService, config.metadataServiceAddress)
skipDeploy(PublicResolver, config.publicResolverAddress)
skipDeploy(ReverseRegistrar, config.reverseRegistrarAddress)
}

const emergencyMultisigAccount = accounts[0]
Expand Down
16 changes: 5 additions & 11 deletions resources/public/contracts/src/NameBazaarDevContracts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,17 @@ import {BaseRegistrarImplementation} from "@ensdomains/ens-contracts/contracts/e
import {ENS} from "@ensdomains/ens-contracts/contracts/registry/ENS.sol";
import {NameResolver} from "@ensdomains/ens-contracts/contracts/resolvers/profiles/NameResolver.sol";
import {PublicResolver} from "@ensdomains/ens-contracts/contracts/resolvers/PublicResolver.sol";
import {ReverseRegistrar, NameResolver as INameResolver} from "@ensdomains/ens-contracts/contracts/registry/ReverseRegistrar.sol";

contract NamebazaarDevPublicResolver is PublicResolver {
constructor(ENS ens) PublicResolver(ens) {}
}
import {ReverseRegistrar} from "@ensdomains/ens-contracts/contracts/registry/ReverseRegistrar.sol";
import {NameWrapper} from "@ensdomains/name-wrapper/contracts/NameWrapper.sol";
import {StaticMetadataService} from "@ensdomains/name-wrapper/contracts/StaticMetadataService.sol";

contract NamebazaarDevNameResolver is NameResolver {
function isAuthorised(bytes32 node) internal view override returns(bool) {
return true;
}
}

contract NamebazaarDevReverseRegistrar is ReverseRegistrar {
constructor(ENS ens, INameResolver resolver) ReverseRegistrar(ens, resolver) {}
}

contract NameBazaarDevRegistrar is BaseRegistrarImplementation {
contract NamebazaarDevRegistrar is BaseRegistrarImplementation {
/**
* @dev Constructs a new Registrar, with the provided address as the owner of the root node.
*
Expand All @@ -44,4 +38,4 @@ contract NameBazaarDevRegistrar is BaseRegistrarImplementation {
emit ControllerAdded(msg.sender);
_register(uint256(_hash), msg.sender, 365 days, true);
}
}
}
2 changes: 1 addition & 1 deletion run-ganache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ docker rm namebazaar-ganache || true

docker run --name=namebazaar-ganache \
-p 8549:8549 \
trufflesuite/ganache-cli:v6.12.1 -p 8549
trufflesuite/ganache-cli:v6.12.2 -p 8549 --gasLimit 0xffe4e1c0
33 changes: 19 additions & 14 deletions src/name_bazaar/shared/smart_contracts.cljs
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
(ns name-bazaar.shared.smart-contracts)
(def smart-contracts
;; Ropsten ENSRegistry
;; https://docs.ens.domains/ens-deployments
;; https://ropsten.etherscan.io/address/0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e
{:ens {:name "ENSRegistry" :address "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"}
{;; ENS CONTRACTS
;; Ropsten ENSRegistry
;; https://docs.ens.domains/ens-deployments
;; https://ropsten.etherscan.io/address/0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e
:ens {:name "ENSRegistry" :address "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"}
;; Ropsten BaseRegistrarImplementation
;; https://ropsten.etherscan.io/address/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85
:eth-registrar {:name "NameBazaarDevRegistrar" :address "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5"}
:offering-registry {:name "OfferingRegistry" :address "0xa3634fE2E2973d5d0cB7f2a1b2b0327A0B6e2d0D"}
:buy-now-offering {:name "BuyNowOffering" :address "0xfF58F3De9319f37BF9b6F355694fe4431b58E6a4"}
:buy-now-offering-factory {:name "BuyNowOfferingFactory" :address "0x8dD4F32663771D73b387A983D1c40BdB431241fd"}
:auction-offering {:name "AuctionOffering" :address "0xa9c221236b9c16Ef08bccd84F89cE5b525B817A9"}
:auction-offering-factory {:name "AuctionOfferingFactory" :address "0x18eF935Cd12b962739538B35F94B0E9fE0e19D59"}
:district0x-emails {:name "District0xEmails" :address "0x31BF9DB8b432b0d108491e2bc9423d6C6d419E20"}
:eth-registrar {:name "NamebazaarDevRegistrar" :address "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"}
;; TODO update NameWrapper and MetadataService addresses when Ropsten deployment is created by ENS
:name-wrapper {:name "NameWrapper" :address "0x0000000000000000000000000000000000000000"}
:metadata-service {:name "StaticMetadataService" :address "0x0000000000000000000000000000000000000000"}
:reverse-name-resolver {:name "NamebazaarDevNameResolver" :address "0x0000000000000000000000000000000000000000"}
;; Ropsten PublicResolver
;; https://ropsten.etherscan.io/address/0x42d63ae25990889e35f215bc95884039ba354115
:public-resolver {:name "NamebazaarDevPublicResolver" :address "0x42D63ae25990889E35F215bC95884039Ba354115"}
:public-resolver {:name "PublicResolver" :address "0x42D63ae25990889E35F215bC95884039Ba354115"}
;; Ropsten ReverseRegistrar
;; https://ropsten.etherscan.io/address/0x6F628b68b30Dc3c17f345c9dbBb1E483c2b7aE5c
:reverse-registrar {:name "NamebazaarDevReverseRegistrar" :address "0x6F628b68b30Dc3c17f345c9dbBb1E483c2b7aE5c"}
})
:reverse-registrar {:name "ReverseRegistrar" :address "0x6F628b68b30Dc3c17f345c9dbBb1E483c2b7aE5c"}

;; NAMEBAZAAR CONTRACTS
:offering-registry {:name "OfferingRegistry" :address "0xa3634fE2E2973d5d0cB7f2a1b2b0327A0B6e2d0D"}
:buy-now-offering {:name "BuyNowOffering" :address "0xfF58F3De9319f37BF9b6F355694fe4431b58E6a4"}
:buy-now-offering-factory {:name "BuyNowOfferingFactory" :address "0x8dD4F32663771D73b387A983D1c40BdB431241fd"}
:auction-offering {:name "AuctionOffering" :address "0xa9c221236b9c16Ef08bccd84F89cE5b525B817A9"}
:auction-offering-factory {:name "AuctionOfferingFactory" :address "0x18eF935Cd12b962739538B35F94B0E9fE0e19D59"}
:district0x-emails {:name "District0xEmails" :address "0x31BF9DB8b432b0d108491e2bc9423d6C6d419E20"}})
2 changes: 1 addition & 1 deletion src/name_bazaar/ui/events/reverse_registrar_events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
:form-data (select-keys form-data [:ens.record/addr :public-resolver])
:args-order [:ens.record/addr :public-resolver]
:form-id (select-keys form-data [:ens.record/addr])
:tx-opts {:gas 100000 :gas-price default-gas-price}
:tx-opts {:gas 120000 :gas-price default-gas-price}
:on-tx-receipt-n [[:ens.records.resolver/load [(reverse-record-node (:ens.record/addr form-data))]]
[:district0x.snackbar/show-message
(gstring/format
Expand Down