Skip to content

openpolis-dev/sns

Repository files navigation

SNS - SeeDAO Name Service

SeeDAO Name Service is a name service dedicated to SeeDAO.

1. Preparation before development and deployment

It is recommended to use the hardhat_metamask_client2 plugin for deployment. With this plugin, you can directly use the MetaMask extension in the browser to deploy and interact with contracts. To enable this feature, just set useMetamaskClient to true in hardhat.config.ts on line #78:

extendEnvironment((hre) => {
  hre.useMetamaskClient = true;
});

If you do not want to using the hardhat_metamask_client2 plugin, you need to set useMetamaskClient to false and fill in the private key in hardhat.config.ts on line #9 or modify it to read the private key from the .env file.

We did not use the more common .env file because we recommend using the MetaMask extension in the browser to deploy and interact with contracts.

2. Run unit tests

$ REPORT_GAS=true npx hardhat test

3. Deploy contracts

The following commands need to be executed in order to deploy a total of 6 contracts.

Note:

  1. 04_deploy_BaseRegistrar.ts #26~#28 set the top-level domain (.seedao) and ERC721's symbol and name
  2. 05_deploy_SeeDAORegistrarController.ts #26 #27 set the lifetime of commitment
  3. 08_deploy_SeeDAOActivityMinter.ts #26 set the address of SCR contract
# Deploy `SNSRegistry` contract
$ npx hardhat run --network mainnet scripts/01_deploy_SNSRegistry.ts

# Deploy `Root` contract
$ npx hardhat run --network mainnet scripts/02_deploy_Root.ts

# Deploy `ReverseRegistrar` contract
$ npx hardhat run --network mainnet scripts/03_deploy_ReverseRegistrar.ts

# Deploy `BaseRegistrar` contract
$ npx hardhat run --network mainnet scripts/04_deploy_BaseRegistrar.ts

# Deploy `SeeDAORegistrarController` contract
$ npx hardhat run --network mainnet scripts/05_deploy_SeeDAORegistrarController.ts

# Deploy `PublicResolver` contract
$ npx hardhat run --network mainnet scripts/06_deploy_PublicResolver.ts

# Deploy `SeeDAOMinter` contract
$ npx hardhat run --network mainnet scripts/07_deploy_SeeDAOMinter.ts

# Deploy `SeeDAOActivityMinter` contract
$ npx hardhat run --network mainnet scripts/08_deploy_SeeDAOActivityMinter.ts

4. Upgrade BaseRegistrar and SeeDAORegistrarController contracts

# Upgrade `BaseRegistrar` contract
$ npx hardhat run --network mainnet scripts/101_update_BaseRegistrar.ts

# Upgrade `SeeDAORegistrarController` contract
$ npx hardhat run --network mainnet scripts/102_upgrade_SeeDAORegistrarController.ts

# Upgrade `SeeDAOMinter` contract
$ npx hardhat run --network mainnet scripts/103_upgrade_SeeDAOMinter.ts

# Upgrade `SeeDAOActivityMinter` contract
$ npx hardhat run --network mainnet scripts/104_upgrade_SeeDAOActivityMinter.ts

5. Verify contracts

# Verify `SNSRegistry` contract
$ npx hardhat verify --network mainnet <SNSRegistry Address>

# Verify `Root` contract
$ npx hardhat verify --network mainnet <Root Address> <SNSRegistry Address>

# Verify `ReverseRegistrar` contract
$ npx hardhat verify --network mainnet <ReverseRegistrar Address> <SNSRegistry Address>

# Verify `BaseRegistrar` contract
$ npx hardhat verify --network mainnet <BaseRegistrar Address>

# Verify `SeeDAORegistrarController` contract
$ npx hardhat verify --network mainnet <SeeDAORegistrarController Address>

# Verify `PublicResolver` contract
$ npx hardhat verify --network mainnet <PublicResolver Address> <SNSRegistry Address> <ReverseRegistrar Address> <SeeDAORegistrarController Address> 0x0000000000000000000000000000000000000000

# Verify `SeeDAOMinter` contract
$ npx hardhat verify --network mainnet <SeeDAOMinter Address>

# Verify `SeeDAOActivityMinter` contract
$ npx hardhat verify --network mainnet <SeeDAOActivityMinter Address>

6. Methods provided by each contract

6.1 Methods of BaseRegistrar contract

Management methods:

  • enableTransferable()

  • disableTransferable()

  • setBaseURI(string)

Other methods:

  • available(bytes32)

  • nextTokenId()

  • register(bytes32, address, address)

  • reclaim(bytes32, address)

  • all functions inherited from ERC721

6.2 Methods of SeeDAORegistrarController contract

Management methods:

  • grantMinter(address):

  • revokeMinter(address):

  • enableRegister():

  • disableRegister()

  • setMaxOwnedNumber(uint256)

Other methods:

  • available(string)

  • valid(string)

  • balanceOf(address)

  • nextTokenId()

  • batchRegister(string[], address[], address)

  • makeCommitment(string, address, address, bytes32)

  • commit(bytes32)

  • registerWithCommitment(string, address, address, bytes32)

  • register(string, address, address)

  • reclaim(string, address, address)

  • setDefaultName(string, address)

  • setDefaultAddr(string, address, address)

6.3 Methods of SeeDAOMinter contract

Management methods:

  • setRegistrarController()

  • enableRegister()

  • disableRegister()

  • enableRegisterWithWhitelist()

  • disableRegisterWithWhitelist()

  • setWhitelist(uint256, bytes32)

  • setCondERC20(address)

  • ...

  • setPriceOracle(IPriceOracle)

Other methods:

  • register(string, address, bytes32, address)
  • registerWithWhitelist(string, address, bytes32, uint256, bytes32[])

About

SeeDAO Name Service

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors