Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Note v2.0.0 #18

Merged
merged 12 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode
*.abi
*.wasm
node_modules
.idea
auth.json
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- '10'
before_install:
- mkdir ~/.hydra
- openssl aes-256-cbc -K $encrypted_2234089e6802_key -iv $encrypted_2234089e6802_iv -in auth.json.enc -out ~/.hydra/auth.json -d
70 changes: 53 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,77 @@
Crypto-Badge
----------

Version 1.0.0
Version 2.0.0

This contract provides multiple functionalities:
- Users can register to become a badge issuer,
- Issuer can create/update badge and assign to badge owner
- Badge owner can create new certification based on the created badge
- Badge owner can create new certification and issue to users (issuer pay for RAM) directly or offer it to users (Users must pay RAM if they accept the offer)
- Badge owner can cancel the offered certification.
- User can accept the offer to receive certification from Badge owner
- Badge owner can create new certification and issue to users
- Badge owner can create new certification and reserved it for non CAN account
- Users who just have CAN account can claim badge which belong to them under verification from crypto-badge
- User can choose to public certification detail

Dependencies:
* [can v1.0.x](https://github.com/canfoundation/CAN/releases/tag/can-v1.0.0)
* [eosio.cdt v1.7.x](https://github.com/EOSIO/eosio.cdt/releases/tag/v1.7.0)

Build the contracts:
## Build the contracts:
```
cd cryptobadge

eosio-cpp -abigen -I include -contract cryptobadge -o cryptobadge.wasm src/cryptobadge.cpp
```

## How to run unit test

Actions:
1. Install eosio testing framework [hydra](https://docs.klevoya.com/hydra/about/getting-started) and login into it:

## badge::regissuer issuer data
```bash
npm i -g @klevoya/hydra

hydra login
```

2. Install yarn packages:

```bash
yarn install
```
cd cryptobadge

3. Run test:

Run all unit test

```bash
yarn test
```

Run test file:

```bash
yarn test cryptobadge.test.ts
```

***WARING*** Because test need to send many request to hydra server, test timeout error may sometime happend. Make sure your network connection is stable to run this test.

## Example to run contract with cleos:

* [Example](https://github.com/canfoundation/cryptobadge/tree/master/example)

## Actions:

#### badge::regissuer issuer data
- Indicates that a particular account wishes to become a issuer
- **issuer** account registering to be a badge issuer who has permission to create badge
- **data** sha256 of issuer info

## badge::updateissuer issuer data
#### badge::updateissuer issuer data
- **issuer** account owner of issuer
- **data** sha256 updated issuer info

## badge::createbadge issuer version name image_url path description criteria
#### badge::createbadge issuer version name image_url path description criteria
- Create a new badge
- **issuer** the account registering as a issuer
- **badge_id** the id of badge, should be unique in scope of issuer
Expand All @@ -45,7 +81,7 @@ Actions:
- **description** the description of badge
- **criteria** the criteria of badge

## badge::updatebadge issuer badge_id version name image_url path description criteria
#### badge::updatebadge issuer badge_id version name image_url path description criteria
- **issuer** account has created badge
- **badge_id** id of badge
- **name** the name of badge
Expand All @@ -54,7 +90,7 @@ Actions:
- **description** the description of badge
- **criteria** the criteria of badge

## badge::issuebadge issuer owner idata require_claim
#### badge::issuebadge issuer owner idata require_claim
- Create a new certification
- **issuer** account whose onwer of badge_id
- **owner** account whose certification owner
Expand All @@ -64,37 +100,37 @@ Actions:
- **encrypted_data** ceritification encrypted data
- **require_claim** true or false. If disabled, upon creation, the certification will be transfered to owner but issuer'S memory will be used until the certification is transferred again). If enabled issuer will remain the owner, but an offer will be created for the account specified in the owner field to claim the certification using the account's RAM.

## badge::claimcert claimer cert_ids
#### badge::claimcert claimer cert_ids
- **claimer** account whose onwer of certification
- **cert_ids** list certifications to claim. The action will be failed if one cert_ids does not work
- Note : claimer must pay RAM for certification if they do this action

## badge::canceloffer issuer cert_ids
#### badge::canceloffer issuer cert_ids
- **issuer** current certification issuer account
- **cert_ids** list certifications to cancel offer
- Issuer only cancel offer when the certification still not issue it to owner

## badge::removecert owner cert_ids memo
#### badge::removecert owner cert_ids memo
- Deposits tokens to user REX fund
- **owner** current certification owner account
- **cert_ids** array of cert_id's to revoke
- **memo** memo for revoke action
- This action is only available for the certification owner. After executing, the certification will disappear forever, and RAM used for certification will be released.

## badge::attach owner cert_id data
#### badge::attach owner cert_id data
- public certification detail. Action is not mandatory
- **owner** certification owner account
- **cert_id** id of certificastion when to public on blockchain
- **data** json stringify data of certification
- Note: once the certification is public, there are no way to remove data on blockchain

## badge::detach owner cert_ids
#### badge::detach owner cert_ids
- Detach certification detail. Action is not mandatory.
- **owner** certification owner account
- **cert_ids** list of id certification
- The Ram will be release

## badge::createlog issuer owner idata cert_id require_claim
#### badge::createlog issuer owner idata cert_id require_claim
- Empty action. Used by create action to log cert_id so that third party explorers can easily get new certification ids and other information.


Expand Down
Binary file added auth.json.enc
Binary file not shown.
Loading