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
good first issue Good for newcomers improvement: error handling Improvements made on error-handling improvement: security Improvements made on runtime security priority: medium Moderately important tasks that should be completed but are not urgent.

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 improvement: error handling Improvements made on error-handling improvement: security Improvements made on runtime security and removed enhancement labels Dec 12, 2024
@shamardy shamardy added the priority: medium Moderately important tasks that should be completed but are not urgent. label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers improvement: error handling Improvements made on error-handling improvement: security Improvements made on runtime security priority: medium Moderately important tasks that should be completed but are not urgent.
Projects
None yet
Development

No branches or pull requests

2 participants