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

Builder pattern for creating boxes #5

Open
greenhat opened this issue Nov 20, 2020 · 0 comments
Open

Builder pattern for creating boxes #5

greenhat opened this issue Nov 20, 2020 · 0 comments

Comments

@greenhat
Copy link
Member

Like the following:

 let math_bounty_candidate = create_candidate(
            bounty_amount_in_nano_ergs,
            &"94hWSMqgxHtRNEWoKrJFGVNQEYX34zfX68FNxWr".to_string(),
            &vec![],
            &vec![],
            current_height,
        )

would become something like

let math_bounty_candidate = CandidateBuilder::new(bounty_amount_in_nano_ergs, &"address".to_string(), current_height)
.build();

and if you add tokens :

let math_bounty_candidate = CandidateBuilder::new(bounty_amount_in_nano_ergs, &"address".to_string(), current_height)
.set_tokens(tokens)
.build();

Or even breaking new into separate methods to "name" parameters:

let math_bounty_candidate = CandidateBuilder::with_value(bounty_amount_in_nano_ergs)
.with_address(&"address".to_string())
.with_height(current_height)
.with_tokens(tokens)
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant