Open
Conversation
PierreOssun
reviewed
Nov 9, 2022
Collaborator
PierreOssun
left a comment
There was a problem hiding this comment.
Thanks for the PR @niklabh
Some suggestions:
- please use snake_case in Rust (excpect for strcut & enum names)
- Do not use panic! - you fns should return a Result - you can use this macro for assertations
- ensure it is building with
cargo contract build
Co-authored-by: Pierre Giraud <35110271+PierreOssun@users.noreply.github.com>
Co-authored-by: Pierre Giraud <35110271+PierreOssun@users.noreply.github.com>
Co-authored-by: Pierre Giraud <35110271+PierreOssun@users.noreply.github.com>
Co-authored-by: Pierre Giraud <35110271+PierreOssun@users.noreply.github.com>
Co-authored-by: Pierre Giraud <35110271+PierreOssun@users.noreply.github.com>
Co-authored-by: Pierre Giraud <35110271+PierreOssun@users.noreply.github.com>
Co-authored-by: Pierre Giraud <35110271+PierreOssun@users.noreply.github.com>
Co-authored-by: Pierre Giraud <35110271+PierreOssun@users.noreply.github.com>
Co-authored-by: Pierre Giraud <35110271+PierreOssun@users.noreply.github.com>
Contributor
Author
|
Review comments resolved. |
PierreOssun
reviewed
Nov 15, 2022
Collaborator
PierreOssun
left a comment
There was a problem hiding this comment.
- Add nameservice to workspace Cargo.toml
- Ensure it is building with
cargo contract buildin the contract dir
nameservice/contracts/src/lib.rs
Outdated
| pub struct EnsSubdomainFactory { | ||
| owner: AccountId, | ||
| locked: bool, | ||
| ethname_hash = 0x00, |
Collaborator
There was a problem hiding this comment.
error: expected :, found =``
nameservice/contracts/src/lib.rs
Outdated
| creator: AccountId, | ||
| owner: AccountId, | ||
| subdomain: vec[u8], | ||
| domain: vec[u8], |
| assert_eq!(self.locked, false, "Domain transfers are locked"); | ||
| let subdomain_hash = self.namehash(subdomain, domain); | ||
| let subdomain_owner = self.getOwner(subdomain_hash); | ||
| assert_eq!(subdomain_owner, AccountId::from([0x0; 32]), "Subdomain already exists"); |
Collaborator
There was a problem hiding this comment.
Please don't use any panic! assertion
return Result::Err if anything wrong
Contributor
Author
There was a problem hiding this comment.
Flipper also using assert_eq!
Can you suggest one change
Collaborator
There was a problem hiding this comment.
Flipper doesn't use asser_eq!
https://github.com/paritytech/ink/blob/master/examples/flipper/lib.rs
You need to return Result::Err
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Name Service example
This example is intended to create a domain name service with wasm.
Custom trait implements
fn createSubdomain(&mut self, subdomain: vec, domain: vec) -> Result<()>;
fn transferSubdomain(&mut self, subdomain: vec, domain: vec, newOwner: AccountId) -> Result<()>;
unit test is implemented
deployed on Shibuya
deployed on Shiden
Deployment on Shibuya
Deployment on Shiden