Skip to content

Commit

Permalink
Pull from master (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvo11 authored Apr 24, 2020
1 parent 638be4d commit 2e6949c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 45 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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:
Expand Down Expand Up @@ -38,6 +38,7 @@ hydra login
```bash
yarn install
```
cd cryptobadge

3. Run test:

Expand All @@ -55,6 +56,9 @@ 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:

Expand Down
74 changes: 37 additions & 37 deletions cryptobadge.abi
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,6 @@
}
]
},
{
"name": "communityf",
"base": "",
"fields": [
{
"name": "community_account",
"type": "name"
},
{
"name": "creator",
"type": "name"
},
{
"name": "community_name",
"type": "string"
},
{
"name": "member_badge",
"type": "uint64[]"
},
{
"name": "community_url",
"type": "string"
},
{
"name": "description",
"type": "string"
}
]
},
{
"name": "createbadge",
"base": "",
Expand Down Expand Up @@ -323,6 +293,36 @@
}
]
},
{
"name": "v1_community",
"base": "",
"fields": [
{
"name": "community_account",
"type": "name"
},
{
"name": "creator",
"type": "name"
},
{
"name": "community_name",
"type": "string"
},
{
"name": "member_badge",
"type": "uint64[]"
},
{
"name": "community_url",
"type": "string"
},
{
"name": "description",
"type": "string"
}
]
},
{
"name": "v1_global",
"base": "",
Expand Down Expand Up @@ -439,13 +439,6 @@
}
],
"tables": [
{
"name": "community",
"type": "communityf",
"index_type": "i64",
"key_names": [],
"key_types": []
},
{
"name": "v1.badges",
"type": "v1_badge",
Expand All @@ -467,6 +460,13 @@
"key_names": [],
"key_types": []
},
{
"name": "v1.community",
"type": "v1_community",
"index_type": "i64",
"key_names": [],
"key_types": []
},
{
"name": "v1.global",
"type": "v1_global",
Expand Down
Binary file modified cryptobadge.wasm
Binary file not shown.
4 changes: 2 additions & 2 deletions include/cryptobadge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class[[eosio::contract]] cryptobadge : public contract


//refer govenance design
TABLE communityf
TABLE v1_community
{
name community_account;
name creator;
Expand All @@ -280,5 +280,5 @@ class[[eosio::contract]] cryptobadge : public contract
uint64_t primary_key() const { return community_account.value; }
};

typedef eosio::multi_index<"community"_n, communityf> community_table;
typedef eosio::multi_index<"v1.community"_n, v1_community> v1_community_table;
};
4 changes: 2 additions & 2 deletions src/cryptobadge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ACTION cryptobadge::createbadge(name issuer, uint64_t badge_id, string name, str
if(has_auth(ram_payer_system)) ram_payer = ram_payer_system;

v1_issuers _issuer(_self, _self.value);
community_table _community(g_state.governance_design, g_state.governance_design.value);
v1_community_table _community(g_state.governance_design, g_state.governance_design.value);

auto issuer_itr = _issuer.find( issuer.value );
if(issuer_itr == _issuer.end()){
Expand Down Expand Up @@ -110,7 +110,7 @@ ACTION cryptobadge::issuebadge( name issuer, name owner, uint64_t badge_id, uint
if(has_auth(ram_payer_system)) ram_payer = ram_payer_system;

v1_issuers _issuer(_self, _self.value);
community_table _community(g_state.governance_design, g_state.governance_design.value);
v1_community_table _community(g_state.governance_design, g_state.governance_design.value);

auto issuer_itr = _issuer.find( issuer.value );
if(issuer_itr == _issuer.end()) {
Expand Down

0 comments on commit 2e6949c

Please sign in to comment.