2015-06-08 15:50:35 +00:00
|
|
|
/*
|
2015-10-12 17:48:40 +00:00
|
|
|
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
|
|
|
|
|
*
|
2016-01-06 09:51:18 +00:00
|
|
|
* The MIT License
|
2015-10-12 17:48:40 +00:00
|
|
|
*
|
2016-01-06 09:51:18 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2015-10-12 17:48:40 +00:00
|
|
|
*
|
2016-01-06 09:51:18 +00:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
|
* all copies or substantial portions of the Software.
|
2015-10-12 17:02:59 +00:00
|
|
|
*
|
2016-01-06 09:51:18 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
* THE SOFTWARE.
|
2015-06-08 15:50:35 +00:00
|
|
|
*/
|
|
|
|
|
#include <graphene/chain/database.hpp>
|
|
|
|
|
#include <graphene/chain/account_object.hpp>
|
|
|
|
|
#include <graphene/chain/proposal_object.hpp>
|
|
|
|
|
|
|
|
|
|
namespace graphene { namespace chain {
|
|
|
|
|
|
2015-06-29 21:29:04 +00:00
|
|
|
bool proposal_object::is_authorized_to_execute(database& db) const
|
2015-06-08 15:50:35 +00:00
|
|
|
{
|
2015-06-29 21:29:04 +00:00
|
|
|
transaction_evaluation_state dry_run_eval(&db);
|
2015-07-16 22:13:11 +00:00
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
verify_authority( proposed_transaction.operations,
|
|
|
|
|
available_key_approvals,
|
|
|
|
|
[&]( account_id_type id ){ return &id(db).active; },
|
|
|
|
|
[&]( account_id_type id ){ return &id(db).owner; },
|
NFT Marketplace HRP Beatrice Merge (#371)
* private-key option update
* ppy marketplace 1 - add evaluators and objects
* NFT object and basic operations
* ci: update .gitlab-ci.yml
* ci: update .gitlab-ci.yml
* NFT evaluators and basic tests, no evaluator checks
* Evaluator checks in place
* ppy marketplace 2 - batch sale, offer_object escrow
* Database API
* Wallet API
* NFT metadata implemented
* Fix NFT tests
* Database API for NFT metadata and enumerables
* ppy marketplace 4 - Add tests NFT+Marketplace
* ppy marketplace 5 - Add revenue split
* ppy marketplace 6 - Remove unnecessary files
* ppy marketplace 7 - Add db, wallet changes and some NFT fixes
* ppy marketplace 8 - Add pagination for list APIs
* ci: update .gitlab-ci.yml
* New DB API, list all NFTs, list NFTs by owner
* Marketplace + NFT + RBAC (#368)
* rbac1 - evaluators and op validators added
* rbac2 - op_type hf checks
* rbac3 - tx auth verify changes
* Update .gitlab-ci.yml
* rbac4 - basic op tests
* rbac5 - clear expired and deleted permission linked auths
* rbac6 - more tests
* rbac7 - more tests
* rbac8 - more tests
* rbac9 - wallet and db api changes
* rbac10 - db api changes for required signature fetch
* rbac11 - add db_api tests
* rbac12 - add missing code for key auths
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: sierra19XX <15652887+sierra19XX@users.noreply.github.com>
* Fix nft_get_token_uri returning empty string
* Fix nft_mint_evaluator to save token_uri
* Fix cli_wallet to properly pass metadata id for nft_create
* ppy marketplace 9 - FC_REFLECT offer create op
* Add stricter checks to NFTs
* GPOS2 HF - Handle rolling period on missing blocks (#369)
* Mainnet chain halt 5050 Issue (#370)
* Unlisting offers, add result in offer history object
* Reverting genesis.json wrong commit
* Add non-transferable non-sellable properties to NFTs
* Review comments - change variable names, use scoped enums
* nft_metadata_update changes
* NFT HF checks and op fee addition changes
* NFT make revenue_split integer from double
* revenue_split condition check allow zero or above
* Peerplays Marketplace + NFT (#367)
* ppy marketplace 1 - add evaluators and objects
* NFT object and basic operations
* ci: update .gitlab-ci.yml
* ci: update .gitlab-ci.yml
* NFT evaluators and basic tests, no evaluator checks
* Evaluator checks in place
* ppy marketplace 2 - batch sale, offer_object escrow
* Database API
* Wallet API
* NFT metadata implemented
* Fix NFT tests
* Database API for NFT metadata and enumerables
* ppy marketplace 4 - Add tests NFT+Marketplace
* ppy marketplace 5 - Add revenue split
* ppy marketplace 6 - Remove unnecessary files
* ppy marketplace 7 - Add db, wallet changes and some NFT fixes
* ppy marketplace 8 - Add pagination for list APIs
* New DB API, list all NFTs, list NFTs by owner
* Marketplace + NFT + RBAC (#368)
* rbac1 - evaluators and op validators added
* rbac2 - op_type hf checks
* rbac3 - tx auth verify changes
* Update .gitlab-ci.yml
* rbac4 - basic op tests
* rbac5 - clear expired and deleted permission linked auths
* rbac6 - more tests
* rbac7 - more tests
* rbac8 - more tests
* rbac9 - wallet and db api changes
* rbac10 - db api changes for required signature fetch
* rbac11 - add db_api tests
* rbac12 - add missing code for key auths
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: sierra19XX <15652887+sierra19XX@users.noreply.github.com>
* Fix nft_get_token_uri returning empty string
* Fix nft_mint_evaluator to save token_uri
* Fix cli_wallet to properly pass metadata id for nft_create
* ppy marketplace 9 - FC_REFLECT offer create op
* Add stricter checks to NFTs
* Unlisting offers, add result in offer history object
* Reverting genesis.json wrong commit
* Add non-transferable non-sellable properties to NFTs
* Review comments - change variable names, use scoped enums
* nft_metadata_update changes
* NFT HF checks and op fee addition changes
* NFT make revenue_split integer from double
* revenue_split condition check allow zero or above
Co-authored-by: Srdjan Obucina <obucinac@gmail.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: obucina <11353193+obucina@users.noreply.github.com>
* Beatrice NFT HF
Co-authored-by: pbattu123 <43043205+pbattu123@users.noreply.github.com>
Co-authored-by: pbattu123 <p.battu@pbsa.info>
Co-authored-by: Srdjan Obucina <obucinac@gmail.com>
Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com>
Co-authored-by: obucina <11353193+obucina@users.noreply.github.com>
2020-08-10 15:42:59 +00:00
|
|
|
[&]( account_id_type id, const operation& op ){
|
|
|
|
|
return db.get_account_custom_authorities(id, op); },
|
2015-07-17 13:41:08 +00:00
|
|
|
db.get_global_properties().parameters.max_authority_depth,
|
2019-05-13 22:18:12 +00:00
|
|
|
true, /* allow committee */
|
2015-07-16 22:13:11 +00:00
|
|
|
available_active_approvals,
|
|
|
|
|
available_owner_approvals );
|
2015-07-17 04:41:43 +00:00
|
|
|
}
|
|
|
|
|
catch ( const fc::exception& e )
|
2015-07-16 22:13:11 +00:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2015-06-08 15:50:35 +00:00
|
|
|
}
|
|
|
|
|
|
2015-06-29 21:29:04 +00:00
|
|
|
void required_approval_index::object_inserted( const object& obj )
|
|
|
|
|
{
|
|
|
|
|
assert( dynamic_cast<const proposal_object*>(&obj) );
|
|
|
|
|
const proposal_object& p = static_cast<const proposal_object&>(obj);
|
|
|
|
|
|
|
|
|
|
for( const auto& a : p.required_active_approvals )
|
|
|
|
|
_account_to_proposals[a].insert( p.id );
|
|
|
|
|
for( const auto& a : p.required_owner_approvals )
|
|
|
|
|
_account_to_proposals[a].insert( p.id );
|
|
|
|
|
for( const auto& a : p.available_active_approvals )
|
|
|
|
|
_account_to_proposals[a].insert( p.id );
|
|
|
|
|
for( const auto& a : p.available_owner_approvals )
|
|
|
|
|
_account_to_proposals[a].insert( p.id );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void required_approval_index::remove( account_id_type a, proposal_id_type p )
|
|
|
|
|
{
|
|
|
|
|
auto itr = _account_to_proposals.find(a);
|
|
|
|
|
if( itr != _account_to_proposals.end() )
|
2015-06-30 15:01:32 +00:00
|
|
|
{
|
|
|
|
|
itr->second.erase( p );
|
|
|
|
|
if( itr->second.empty() )
|
|
|
|
|
_account_to_proposals.erase( itr->first );
|
|
|
|
|
}
|
2015-06-29 21:29:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void required_approval_index::object_removed( const object& obj )
|
|
|
|
|
{
|
|
|
|
|
assert( dynamic_cast<const proposal_object*>(&obj) );
|
|
|
|
|
const proposal_object& p = static_cast<const proposal_object&>(obj);
|
|
|
|
|
|
|
|
|
|
for( const auto& a : p.required_active_approvals )
|
|
|
|
|
remove( a, p.id );
|
|
|
|
|
for( const auto& a : p.required_owner_approvals )
|
|
|
|
|
remove( a, p.id );
|
|
|
|
|
for( const auto& a : p.available_active_approvals )
|
|
|
|
|
remove( a, p.id );
|
|
|
|
|
for( const auto& a : p.available_owner_approvals )
|
|
|
|
|
remove( a, p.id );
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-08 15:50:35 +00:00
|
|
|
} } // graphene::chain
|
2019-05-13 22:18:12 +00:00
|
|
|
|
|
|
|
|
GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::proposal_object )
|