-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
196 additions
and
226 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
[workspace] | ||
members = [ | ||
"provider/github", | ||
"bounty", | ||
"backend" | ||
] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
use candid::Principal; | ||
|
||
// GITHUB SERVICE | ||
pub mod provider { | ||
pub mod github { | ||
pub mod api { | ||
pub mod get_fixed_by; | ||
pub mod get_is_merged; | ||
pub mod get_issue; | ||
pub mod get_merged_details; | ||
} | ||
pub mod client; | ||
pub mod utils; | ||
} | ||
} | ||
use provider::github::api::get_issue::IssueResponse; | ||
use provider::github::api::get_merged_details::PrDetailsResponse; | ||
use provider::github::client::{GithubClient, IGithubClient}; | ||
|
||
// BOUNTY SERVICE | ||
pub mod bounty { | ||
pub mod api { | ||
pub mod accept; | ||
pub mod claim; | ||
pub mod deposit; | ||
pub mod icrc1; | ||
pub mod init; | ||
pub mod state; | ||
} | ||
} | ||
|
||
use bounty::api::accept::accept_impl; | ||
use bounty::api::init::init_impl; | ||
use bounty::api::deposit::{deposit_impl, DepositReceipt}; | ||
use bounty::api::state::Contributor; | ||
|
||
// GITHUB SERVICE | ||
#[ic_cdk::update] | ||
async fn get_issue(github_token: String) -> IssueResponse { | ||
let owner = "input-output-hk".to_string(); | ||
let repo = "hydra".to_string(); | ||
let issue_nbr = 1218; | ||
let client = GithubClient { | ||
owner, | ||
repo, | ||
github_token, | ||
}; | ||
return client.get_issue(issue_nbr).await; | ||
} | ||
|
||
#[ic_cdk::update] | ||
async fn get_fixed_by(github_token: String) -> String { | ||
let owner = "input-output-hk".to_string(); | ||
let repo = "hydra".to_string(); | ||
let issue_nbr = 1370; | ||
let client = GithubClient { | ||
owner, | ||
repo, | ||
github_token, | ||
}; | ||
return client.get_fixed_by(issue_nbr).await; | ||
} | ||
|
||
#[ic_cdk::update] | ||
async fn get_is_merged(github_token: String) -> String { | ||
let owner = "input-output-hk".to_string(); | ||
let repo = "hydra".to_string(); | ||
let pr_nbr = 1266; | ||
let client = GithubClient { | ||
owner, | ||
repo, | ||
github_token, | ||
}; | ||
return client.get_is_merged(pr_nbr).await; | ||
} | ||
|
||
#[ic_cdk::update] | ||
async fn get_merged_details(github_token: String) -> PrDetailsResponse { | ||
let owner = "input-output-hk".to_string(); | ||
let repo = "hydra".to_string(); | ||
let pr_nbr = 1266; | ||
let client = GithubClient { | ||
owner, | ||
repo, | ||
github_token, | ||
}; | ||
return client.get_merged_details(pr_nbr).await; | ||
} | ||
|
||
// BOUNTY SERVICE | ||
#[ic_cdk::init] | ||
fn init(authority: Principal, github_issue_id: i32) -> () { | ||
init_impl(authority, github_issue_id); | ||
} | ||
|
||
#[ic_cdk::update] | ||
fn accept(contributor: Contributor, github_pr_id: i32) -> () { | ||
accept_impl(contributor, github_pr_id); | ||
} | ||
|
||
#[ic_cdk::update] | ||
async fn deposit() -> DepositReceipt { | ||
return deposit_impl().await; | ||
} | ||
|
||
#[ic_cdk::update] | ||
async fn healthcheck() -> String { | ||
return "OK".to_string(); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.