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

feat(Contracts): DApp registry contract using ENS and FDS registrar as base #27

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

molekilla
Copy link
Contributor

Refactors to use ENS ERC721 token curated registry on top of FDS registrar.

  • Contains merged PR from fds registrar branch
  • Refactored DAppregistry.sol
  • Unit tests

Not implemented in this release/issue: deployment or migration scripts

@molekilla molekilla requested a review from nugaon June 10, 2022 19:04
@molekilla molekilla marked this pull request as ready for review June 10, 2022 19:05
@nugaon
Copy link
Collaborator

nugaon commented Jun 15, 2022

please don't include other PR under review. please rebase it to the other branch and set this PR's base to that branch until it gets merged.

@molekilla molekilla force-pushed the dapp-tcr branch 2 times, most recently from c07a3d4 to 2cc22af Compare June 16, 2022 13:07
feat(contracts): rename sha3 method, apply recommend suggestions from code review

feat(contracts): FDSRegistry is ENSRegistry, supports @ensdomains interface. fix prettier issues. removed subdomain

feat(contracts): FDSRegistry is ENSRegistry, supports @ensdomains interface. fix prettier issues. removed subdomain

feat(contracts): removing fdsregistry, not needed (typechain builds artifacts from npm packages ie ENSRegistry)

feat(contracts): fixes
@molekilla
Copy link
Contributor Author

@nugaon ready for review

Copy link
Collaborator

@nugaon nugaon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have many concerns about the current implementation, please read my comments below.

Also, remove all ERC20 token related code, I don't know why did you commit those.

There are no methods in DappRegistry to change the Record value of a dApp by the owner.


import "./ERC20/ERC20.sol";

contract TestToken is ERC20 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the previous code based on token registry old design pattern that used ERC20 (I change to use ENS base registry in last commit). Will remove.

// indexation type
uint8 indexType;
// Data structure format
bytes32 dataFormat;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate this one please? it is related to BeeSon or any other datastructure signiture?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should leave this agnostic, beeson by default, but they could use other dataformats. If is always beeson, then I wil remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eg based on the multibase tables.csv values

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it is fine as it is for now

Comment on lines 30 to 33
bytes32 indexed node,
bytes32 label,
uint256 duration,
address indexed owner
Copy link
Collaborator

@nugaon nugaon Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should we index owner?

Suggested change
bytes32 indexed node,
bytes32 label,
uint256 duration,
address indexed owner
bytes32 indexed node,
bytes32 label,
uint256 duration,
address owner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably from the old design pattern, with ENS not required

event TransferRecord(
address from,
address to,
bytes32 node
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe index node?

Suggested change
bytes32 node
bytes32 indexed node

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes



// Global Variables
ENS public ensInstance;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove indent

yarn.lock Outdated
@@ -0,0 +1,11492 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove.

dappRegistry = await DappRegistry.deploy(ens.address, registrar.address, keccak256FromUtf8Bytes('dappregistry'))
await dappRegistry.deployed()
// set subnode owner and add to controller
await registrar.setSubnodeOwner(keccak256FromUtf8Bytes('dappregistry'), dappRegistry.address)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got error:
Property 'setSubnodeOwner' does not exist on type 'FDSRegistrar'.ts(2339)

bytes32 _node
) {
ensInstance = _ens;
baseNode = _node;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this baseNode? you don't use it for anything.


const DappRegistry = await ethers.getContractFactory('DappRegistry')
// set ENS and FDS addresses, and configure subdomain (eg dappregistry.fds)
dappRegistry = await DappRegistry.deploy(ens.address, registrar.address, keccak256FromUtf8Bytes('dappregistry'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagined like the names of dapps are on the same level as normal user names. e.g. nugaon.fds a username, then anythread.fds can be a dapp name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me make that change then

// ENS app name
bytes32 node;
// owner
address owner;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be tracked by the ENS contract.

…pp update, cleaning package.json/lock and fixes to unit tests
@molekilla molekilla requested a review from nugaon June 23, 2022 14:03
@molekilla
Copy link
Contributor Author

@nugaon will update this PR later this week

@crtahlin crtahlin added the enhancement New feature or request label Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants