sunshine-protocol / sunshine

Governance + Bounty Platform
Other
43 stars 16 forks source link

json config for org registration #111

Open 4meta5 opened 4 years ago

4meta5 commented 4 years ago

https://github.com/sunshine-protocol/sunshine-bounty/pull/110#issuecomment-653665806

The CLI input format for BatchIssueShares, BatchBurnShares, and RegisterWeightedOrg is not convenient.

#[derive(Clone, Debug)]
pub struct AccountShare(pub String, pub u64);
impl FromStr for AccountShare {
    type Err = Error;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
                                 .split(',')
                                 .collect();
        let acc_str = coords[0];
        let share_fromstr = coords[1].parse::<u64>().map_err(|_| Error::ParseIntError)?;
        Ok(AccountShare(acc_str.to_string(), share_fromstr))
    }
}

I'd prefer to use a .json file to register organizations because it's just poor usability to require the user to type out the members in the format above...

sunshine-bors commented 4 years ago

☀️ Sunshine Submission Approved ☀️
BountyID: 2 🌻 SubmissionID: 1 🌻 Amount Received: 500 🌻 Bounty Issue