-
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.
* release v1.0.0
- Loading branch information
Showing
12 changed files
with
883 additions
and
1,524 deletions.
There are no files selected for viewing
This file was deleted.
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,89 +1,102 @@ | ||
# cryptobadge | ||
Crypto-Badge | ||
---------- | ||
|
||
## Version : 1.0.0 | ||
Version 1.0.0 | ||
|
||
Folder structure | ||
|
||
- `src` directory, the `cpp` files are there. | ||
- `include` directory, the `hpp` files are there. | ||
- `test` directory, test scripts are there. | ||
- `ricardian` contains the Ricardian contract files. | ||
- `.vscode` directory that contains *IntelliSense* definitions, task | ||
definitions, etc. | ||
- `test` directory, buil file and script. | ||
- `example` directory, an example to deploy/run smart contract. | ||
- `CMakeLists.txt` file, CMake definitions. | ||
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 | ||
- User can choose to public certification detail | ||
|
||
Dependencies: | ||
* [eosio v1.8.x](https://github.com/EOSIO/eos/releases/tag/v1.8.0) | ||
* [eosio.cdt v1.6.x](https://github.com/EOSIO/eosio.cdt/releases/tag/v1.6.1) | ||
|
||
To build the contracts and the unit tests: | ||
* First, ensure that your __eosio__ is compiled to the core symbol for the EOSIO blockchain that intend to deploy to. | ||
* Second, make sure that you have ```sudo make install```ed __eosio__. | ||
* Third, make sure that you have install CDT version > 1.6.x | ||
* Then just go to each smart contract folder and following below instruction | ||
|
||
## Prerequisites for Ubuntu & MacOS | ||
|
||
* We assume you have installed [Python 3.5](https://www.python.org/downloads/release/python-356/) (or higher). | ||
* We assume you have installed [pip3 18.1](https://pypi.org/project/pip/) (or higher). | ||
|
||
## Install *EOSFactory* on Ubuntu & MacOS | ||
|
||
|
||
Clone *EOSFactory* source code from the repository: | ||
|
||
```bash | ||
git clone https://github.com/tokenika/eosfactory.git | ||
``` | ||
|
||
Open a bash terminal and navigate to the `eosfactory` folder: | ||
|
||
```bash | ||
cd eosfactory | ||
``` | ||
|
||
Then run the `install` script by pointing it to the *EOSIO* source code: | ||
* [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) | ||
|
||
```bash | ||
./install.sh | ||
Build the contracts: | ||
``` | ||
cd cryptobadge | ||
## Build & Test | ||
|
||
Open `build` folder in projects | ||
|
||
```bash | ||
cd /cryptobadge | ||
cd build | ||
eosio-cpp -abigen -I include -contract cryptobadge -o cryptobadge.wasm src/cryptobadge.cpp | ||
``` | ||
|
||
To configure your project: | ||
|
||
```bash | ||
cmake .. | ||
``` | ||
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 | ||
- **issuer** account owner of issuer | ||
- **data** sha256 updated issuer info | ||
|
||
## 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 | ||
- **name** the name of badge | ||
- **image_url** the url of badge | ||
- **path** the path of badge | ||
- **description** the description of badge | ||
- **criteria** the criteria of badge | ||
|
||
## 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 | ||
- **image_url** the url of badge | ||
- **path** the path of badge | ||
- **description** the description of badge | ||
- **criteria** the criteria of badge | ||
|
||
## badge::issuebadge issuer owner idata require_claim | ||
- Create a new certification | ||
- **issuer** account whose onwer of badge_id | ||
- **owner** account whose certification owner | ||
- **badge_id** badge id for certification | ||
- **badge_revision** the version of badge use for create certificate | ||
- **cert_id** certification id for certification, should be unique in scope of owner | ||
- **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 | ||
- **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 | ||
- **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 | ||
- 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 | ||
- 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 | ||
- 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 | ||
- Empty action. Used by create action to log cert_id so that third party explorers can easily get new certification ids and other information. | ||
|
||
The output should look like this: | ||
|
||
```bash | ||
-- Configuring done | ||
-- Generating done | ||
-- Build files have been written to: /mnt/c/Workspaces/EOS/contracts/foo_bar/build | ||
``` | ||
|
||
To build your project: | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
And finally, after your contract has been successfully built, run unit tests with this command: | ||
|
||
```bash | ||
cd .. | ||
python3 tests/unittest.py | ||
``` | ||
|
||
An example using smart contract by cloes at `example` directory |
Oops, something went wrong.