@@ -45,7 +45,7 @@ void cambiatus::create(eosio::asset cmm_asset, eosio::name creator, std::string
4545 eosio::action netlink = eosio::action (eosio::permission_level{get_self (), eosio::name{" active" }}, // Permission
4646 get_self (), // Account
4747 eosio::name{" netlink" }, // Action
48- std::make_tuple (cmm_asset, creator, creator));
48+ std::make_tuple (cmm_asset, creator, creator, " natural " ));
4949 netlink.send ();
5050
5151 // Notify creator
@@ -77,7 +77,7 @@ void cambiatus::update(eosio::asset cmm_asset, std::string logo, std::string nam
7777 });
7878}
7979
80- void cambiatus::netlink (eosio::asset cmm_asset, eosio::name inviter, eosio::name new_user)
80+ void cambiatus::netlink (eosio::asset cmm_asset, eosio::name inviter, eosio::name new_user, std::string user_type )
8181{
8282 eosio::check (is_account (new_user), " new user account doesn't exists" );
8383
@@ -98,6 +98,9 @@ void cambiatus::netlink(eosio::asset cmm_asset, eosio::name inviter, eosio::name
9898 require_auth (backend_account);
9999 }
100100
101+ // Validate user type
102+ eosio::check (user_type == " natural" || user_type == " juridical" , " User type must be 'natural' or 'juridical'" );
103+
101104 // Validates community
102105 eosio::symbol cmm_symbol = cmm_asset.symbol ;
103106 communities community (_self, _self.value );
@@ -123,6 +126,7 @@ void cambiatus::netlink(eosio::asset cmm_asset, eosio::name inviter, eosio::name
123126 r.community = cmm_symbol;
124127 r.invited_user = new_user;
125128 r.invited_by = inviter;
129+ r.user_type = user_type;
126130 });
127131
128132 // Notify user
@@ -991,6 +995,15 @@ void cambiatus::clean(std::string t)
991995 itr = communities_table.erase (itr);
992996 }
993997 }
998+
999+ if (t == " network" )
1000+ {
1001+ networks network_table (_self, _self.value );
1002+ for (auto itr = network_table.begin (); itr != network_table.end ();)
1003+ {
1004+ itr = network_table.erase (itr);
1005+ }
1006+ }
9941007}
9951008
9961009void cambiatus::migrateafter (std::uint64_t claim_id, std::uint64_t increment)
0 commit comments