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

Implement the access control feature for Paltalabs #54

Closed
wants to merge 4 commits into from

Conversation

apptreeso
Copy link

No description provided.

Copy link

vercel bot commented Aug 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
create-soroban-dapp ❌ Failed (Inspect) Aug 20, 2024 8:31am
create-soroban-dapp-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 8:31am

@esteblock
Copy link
Member

Hello @apptreeso @chopan123
Your fork is failing in deployment, can you please solve this? Yarn build should succeeed without errors

image

@esteblock
Copy link
Member

// This function should be called once when the contract is deployed
pub fn init(env: Env, admin: Address, title: String) {
if env.storage().instance().has(&AdminInfo::Initialized) {
panic!("contract already initilized")
Copy link
Member

Choose a reason for hiding this comment

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

it's better to throw errors!

@chopan123
Copy link
Member

Good simple implementation of the access control! I like that the contract is tested in multiple scenarios! But frontend is not even compiling on development...

@chopan123 chopan123 closed this Aug 23, 2024
@apptreeso
Copy link
Author

Good simple implementation of the access control! I like that the contract is tested in multiple scenarios! But frontend is not even compiling on development...

I missed to commit one file. I just added it and create a new PR. It works fine. Would you check it?
#63

@esteblock
Copy link
Member

Hello @apptreeso your deployment is still failing
image

Copy link
Member

Choose a reason for hiding this comment

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

Nice to have onchain tests with chai.
it would be nice to test that another address cannot change the title

}

#[test]
fn test_set_title_by_owner() {
Copy link
Member

Choose a reason for hiding this comment

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

Here you are mocking all auths, thats why is working

@esteblock
Copy link
Member

Hello @apptreeso I reviewed your submission.
I see 2 main things:

1.- You didnt implement any address management, neither on smart contract side, neither on the frontend.
This was in the challenge:

Your Task: Add authorization controls to the contract so only specific addresses can modify a title. Implement address management and required_auth to verify authorized changes. 

2.- Your preview is failing. As I said, you can check if it will fail by just doing yarn build and check that it builds without errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants