-
Notifications
You must be signed in to change notification settings - Fork 0
Added Name Service #28
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
base: main
Are you sure you want to change the base?
Conversation
PierreOssun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Co-authored-by: Pierre Giraud <[email protected]>
Co-authored-by: Pierre Giraud <[email protected]>
Co-authored-by: Pierre Giraud <[email protected]>
Co-authored-by: Pierre Giraud <[email protected]>
Co-authored-by: Pierre Giraud <[email protected]>
Co-authored-by: Pierre Giraud <[email protected]>
Co-authored-by: Pierre Giraud <[email protected]>
Co-authored-by: Pierre Giraud <[email protected]>
|
Review comments resolved. |
PierreOssun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error: expected :, found =``
nameservice/contracts/src/lib.rs
Outdated
| creator: AccountId, | ||
| owner: AccountId, | ||
| subdomain: vec[u8], | ||
| domain: vec[u8], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niklabh still not updated
| 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use any panic! assertion
return Result::Err if anything wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flipper also using assert_eq!
Can you suggest one change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flipper doesn't use asser_eq!
https://github.com/paritytech/ink/blob/master/examples/flipper/lib.rs
You need to return Result::Err
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