sunshine-protocol / sunshine

Governance + Bounty Platform
Other
43 stars 16 forks source link

improve code in `client/client` and `client/cli` #114

Closed 4meta5 closed 4 years ago

4meta5 commented 4 years ago

I wrote the code here quickly to make it work but there's lots of places it can be improved.

  1. A few event structs in client/src/srml/bounty.rs have the same fields but have different names because they correspond to different events (but a single struct would suffice with adequately general naming)

  2. client/cli has a bunch of duplicate logic for converting String to CidBytes like for the_string: String

let content = self.the_string.as_bytes();
let hash = Blake2b256::digest(&content[..]);
let cid = Cid::new_v1(Codec::Raw, hash);
CidBytes::from(&cid)

and this should maybe merged into the bounty_client::Account type which was previously an enum Identifier type

  1. To get the clap subcommand to work, I repeated the BankOpenCommand twice in an enum. That might not be necessary and it definitely isn't necessary once I add the other bank runtime methods to the CLI.

  2. The bounty CLI functionality doesn't (yet) express posting or applying for grants as an org although the module supports this functionality.