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

Add List collection. #16

Closed
zie1ony opened this issue Aug 2, 2022 · 0 comments · Fixed by #40
Closed

Add List collection. #16

zie1ony opened this issue Aug 2, 2022 · 0 comments · Fixed by #40
Assignees
Labels
feature Full feature description

Comments

@zie1ony
Copy link
Contributor

zie1ony commented Aug 2, 2022

Allow for:

use odra::List;

#[odra::module]
pub struct Contract {
    list: List<u8>
}

#[odra::module]
impl Contract {
    pub fn add(&self, value: u8) {
        self.list.append(value);
    }

    pub fn get(&self, index: u32) -> Option<u32> {
        self.list.get(index)
    }
}

It should be implemented using Mapping and indexed from 0.

@zie1ony zie1ony added the feature Full feature description label Aug 2, 2022
@zie1ony zie1ony added this to the Release 0.2.0 milestone Aug 17, 2022
@kpob kpob self-assigned this Aug 19, 2022
@kpob kpob linked a pull request Aug 22, 2022 that will close this issue
@kpob kpob closed this as completed Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Full feature description
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants