Skip to content

Commit

Permalink
fix/correct params name and remove encrypted data in cert state data (#…
Browse files Browse the repository at this point in the history
…12)

hotfixes
  • Loading branch information
danielvo11 authored Apr 10, 2020
1 parent dbf22c4 commit fa990b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode
*.abi
*.wasm
3 changes: 1 addition & 2 deletions include/cryptobadge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class[[eosio::contract]] cryptobadge : public contract
* 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.
*/
ACTION issuebadge( name issuer, name owner, uint64_t badge_id, uint64_t badge_revision, uint64_t cert_id, string& encripted_data, uint64_t expire_at, bool require_claim);
ACTION issuebadge( name issuer, name owner, uint64_t badge_id, uint64_t badge_revision, uint64_t cert_id, string& encrypted_data, uint64_t expire_at, bool require_claim);

/*
* Update certification state to expired.
Expand Down Expand Up @@ -190,7 +190,6 @@ class[[eosio::contract]] cryptobadge : public contract
name owner;
uint64_t state;
uint64_t expire_at;
string encripted_data;

auto primary_key() const
{
Expand Down
11 changes: 6 additions & 5 deletions src/cryptobadge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ACTION cryptobadge::updatebadge( name issuer, uint64_t badge_id, string name, st
});
}

ACTION cryptobadge::issuebadge( name issuer, name owner, uint64_t badge_id, uint64_t badge_revision, uint64_t cert_id, string& encripted_data, uint64_t expire_at, bool require_claim) {
ACTION cryptobadge::issuebadge( name issuer, name owner, uint64_t badge_id, uint64_t badge_revision, uint64_t cert_id, string& encrypted_data, uint64_t expire_at, bool require_claim) {

require_auth( issuer );
require_auth( _self );
Expand All @@ -100,7 +100,7 @@ ACTION cryptobadge::issuebadge( name issuer, name owner, uint64_t badge_id, uint

check (!(issuer.value == owner.value && require_claim == 1), "require_claim only issuer == owner.");

if (require_claim){
if (require_claim) {
certOwner = issuer;
//add info to offers table
offers _offert(_self, _self.value);
Expand All @@ -126,7 +126,6 @@ ACTION cryptobadge::issuebadge( name issuer, name owner, uint64_t badge_id, uint
s.owner = owner;
s.state = CertificationState::CERTIFIED;
s.expire_at = expire_at;
s.encripted_data = encripted_data;
});

}
Expand Down Expand Up @@ -195,15 +194,17 @@ ACTION cryptobadge::claimcert( name claimer, std::vector<uint64_t>& cert_ids) {

certs_t.emplace( claimer, [&]( auto& s ) {
s.id = itr->id;
s.badge_id = itr->badge_id;
s.badge_revision = itr->badge_revision;
s.owner = claimer;
s.encripted_data = itr->encripted_data; // immutable data
s.state = itr->state;
s.expire_at = itr->expire_at;
});

certs_f.erase(itr);
offert.erase(itrc);

}

}


Expand Down

0 comments on commit fa990b4

Please sign in to comment.