Skip to content

Commit

Permalink
Add doc comments to Rust canister methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanasa committed Aug 23, 2023
1 parent 89820e7 commit 0a8c90e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions canisters/ic_eth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn get_rpc_endpoint(network: &str) -> &'static str {
}
}

/// Verify an ECDSA signature (signed by an Ethereum wallet).
#[ic_cdk_macros::query]
#[candid_method]
pub fn verify_ecdsa(eth_address: String, message: String, signature: String) -> bool {
Expand All @@ -49,18 +50,18 @@ pub fn verify_ecdsa(eth_address: String, message: String, signature: String) ->
.is_ok()
}

//
// ?? whitelist / access control
// ?? cycles estimation (for HTTP outcall to RPC mech).
//

/// Find the owner of an ERC-721 NFT by calling the Ethereum blockchain.
#[ic_cdk_macros::update]
#[candid_method]
pub async fn erc721_owner_of(
network: String,
nft_contract_address: String,
token_id: u64,
) -> String {
// TODO: whitelist / access control
// TODO: cycles estimation for HTTP outcalls

let service_url = get_rpc_endpoint(&network).to_string();

#[allow(deprecated)]
Expand Down Expand Up @@ -145,6 +146,7 @@ fn from_hex(data: &str) -> Result<Vec<u8>, FromHexError> {
hex::decode(&data[2..])
}

/// Find the balance of an ERC-1155 token by calling the Ethereum blockchain.
#[ic_cdk_macros::update]
#[candid_method]
pub async fn erc1155_balance_of(
Expand All @@ -153,7 +155,7 @@ pub async fn erc1155_balance_of(
owner_address: String,
token_id: u64,
) -> u64 {
// to do -- use `candid::Nat`
// TODO: use `candid::Nat` in place of `u64`

let owner_address =
ethers_core::types::Address::from_str(&owner_address).expect("Invalid owner address");
Expand Down

0 comments on commit 0a8c90e

Please sign in to comment.