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

using strict custom type for coin tickers #2236

Open
onur-ozkan opened this issue Oct 8, 2024 · 0 comments
Open

using strict custom type for coin tickers #2236

onur-ozkan opened this issue Oct 8, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@onur-ozkan
Copy link
Member

Right now String types are used everywhere for coin tickers, and in most places there's no clear validation for them. Even if validation is done, it's unclear where or how it's happening. Using a wrapper type for coin tickers would be much more appropriate.

Just a simple/quick ref for the wrapper type:

struct CoinTicker(String);

impl CoinTicker {
    fn new(ticker: String) -> Result<Self, Error> {
        // various validations
        Ok(Self(ticker))
    }
}

This way, by default, every ticker used in KDF will be enforced to be validated.

@onur-ozkan onur-ozkan added enhancement New feature or request good first issue Good for newcomers labels Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant