Skip to content

Commit

Permalink
fix: upvote election badges are not created by default
Browse files Browse the repository at this point in the history
They are onoy created and assigned through upvote elections.
  • Loading branch information
n13 committed Oct 16, 2024
1 parent 0bb1057 commit 32f681e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
1 change: 1 addition & 0 deletions deploy_pangea_mainnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cleos -u https://pangea.eosusa.io set contract dao.hypha build/dao dao_O3.wasm dao.abi
1 change: 1 addition & 0 deletions deploy_pangea_testnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cleos -u https://test.pangea.eosusa.io set contract dao.hypha build/dao dao_O3.wasm dao.abi
12 changes: 8 additions & 4 deletions include/badges/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ enum class SystemBadgeType
Admin,
Enroller,
NorthStar,
Voter,
Delegate,
ChiefDelegate,
HeadDelegate,
// Upvote Election badges are system badges but they work differently from other badges
// These are only assigned through the upvote election process
Voter, // Upvote Election Voter
Delegate, // Upvote Election Delegate
ChiefDelegate, // Upvote Election Chief Delegate
HeadDelegate, // Upvote Election Head Delegate
None,
};

Expand All @@ -33,6 +35,8 @@ namespace links {
inline constexpr auto ADMIN_BADGE = eosio::name("adminbdg");
inline constexpr auto ENROLLER_BADGE = eosio::name("enrollerbdg");
inline constexpr auto NORTH_STAR_BADGE = eosio::name("northstarbdg");

// Upvote Election badges
inline constexpr auto VOTER = eosio::name("voter");
inline constexpr auto DELEGATE = eosio::name("delegate");
inline constexpr auto HEAD_DELEGATE = eosio::name("headdelegate");
Expand Down
4 changes: 0 additions & 4 deletions include/upvote_election/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ namespace links {
inline constexpr auto UP_VOTE_VOTE = eosio::name("ue.vote");
inline constexpr auto UPVOTE_GROUP_WINNER = eosio::name("ue.winner");
inline constexpr auto VOTE = eosio::name("vote"); // ??

// these are defined in badges::common::links
// inline constexpr auto CHIEF_DELEGATE
// inline constexpr auto HEAD_DELEGATE
}

namespace items {
Expand Down
6 changes: 6 additions & 0 deletions src/badges/badges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ void onBadgeActivated(dao& dao, RecurringActivity& badgeAssign)
common::links::ENROLLER_BADGE
);
} break;

// Note:
// Upvote Election Badges should be a separate type since they
// work differently from normal badges, e.g. nobody can apply
// for these badges except through an upvote election...

case SystemBadgeType::Voter: {
createLink(badges_links::VOTER);
} break;
Expand Down
9 changes: 0 additions & 9 deletions src/dao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,9 +1400,6 @@ void dao::initSysBadges() {

createSystemBadge(badges::common::links::ADMIN_BADGE, "Admin Badge", "https://assets.hypha.earth/badges/badge_admin.png");
createSystemBadge(badges::common::links::ENROLLER_BADGE, "Enroller Badge", "https://assets.hypha.earth/badges/badge_enroller.png");
createSystemBadge(badges::common::links::DELEGATE, "Upvote Delegate Badge", "");
createSystemBadge(badges::common::links::CHIEF_DELEGATE, "Chief Delegate Badge", "");
createSystemBadge(badges::common::links::HEAD_DELEGATE, "Head Delegate Badge", "");
createSystemBadge(badges::common::links::TREASURY_BADGE, "Treasurer Badge", "https://assets.hypha.earth/badges/badge_treasurer.png");
createSystemBadge(badges::common::links::NORTH_STAR_BADGE, "North Star Badge", "https://assets.hypha.earth/badges/badge_north_star.png");

Expand All @@ -1419,12 +1416,6 @@ void dao::createSystemBadge(name badge_edge, string label, string icon) {
systemBadgeType = badges::SystemBadgeType::NorthStar;
} else if (badge_edge == badges::common::links::TREASURY_BADGE) {
systemBadgeType = badges::SystemBadgeType::Treasurer;
} else if (badge_edge == badges::common::links::DELEGATE) {
systemBadgeType = badges::SystemBadgeType::Delegate;
} else if (badge_edge == badges::common::links::CHIEF_DELEGATE) {
systemBadgeType = badges::SystemBadgeType::ChiefDelegate;
} else if (badge_edge == badges::common::links::HEAD_DELEGATE) {
systemBadgeType = badges::SystemBadgeType::HeadDelegate;
} else {
eosio::check(false, "unknown system type");
}
Expand Down

0 comments on commit 32f681e

Please sign in to comment.