#near #level #contract #risk #hapi #protocols #condition

hapi-near-connector

Rust library for using HAPI protocol in cmart contracts on NEAR

3 releases (breaking)

0.3.0 Mar 9, 2023
0.2.0 Jan 18, 2023
0.1.1 Oct 13, 2022

#663 in WebAssembly

Custom license

11KB
129 lines

Hapi

This is a crate that helps implement the use of the HAPI protocol in your smart contract on Near blockchain.

The crate has an AML structure that stores:

  • account_id: AccountId - the address of the aml contract;
  • pub aml_conditions: UnorderedMap<Category, RiskScore> - a map of categories and corresponding risk levels that you will add.

Note

If the risk level was not set for some categories, then the risk level for the category All is used, which is set during initialization.

Methods


  • get_aml - Returns the aml accountId and vector of added categories with accepted risk levels.

  • update_account_id - Updates account id of aml service.

  • update_category - Updates or add a category with accepted risk score to aml conditions.

  • remove_category - Removes category from aml conditions.

  • assert_risk - Checks the category according to the set level of risk. If the risk level is not set for this category, it checks the All category.

  • get_aml_conditions - Returns reference to UnorderedMap of added categories with accepted risk levels.

  • check_risk - Returns true if the address is risky or false if not.

Dependencies

~5MB
~102K SLoC