contract optional blagorost agreement on registration

This commit is contained in:
Alex Ant
2026-01-26 10:54:53 +05:00
parent d47db969ea
commit e1538bb5ab
10 changed files with 138 additions and 43 deletions
+3 -3
View File
@@ -2,6 +2,6 @@ export const sourceProgramId = 3
export const capitalProgramId = 4
export const walletProgramId = 1
export const ratePerHour = '1000.0000 RUB'
export const sourceProgramName = 'source'
export const capitalProgramName = 'capital'
export const circulationAccountId = 80
export const sourceProgramName = 'generator'
export const capitalProgramName = 'blagorost'
export const circulationAccountId = 80
@@ -50,5 +50,21 @@ void capital::approvereg(eosio::name coopname, eosio::name username, checksum256
_source_program,
uint64_t(0)
);
};
}
// Проверяем наличие кошелька программы Благорост
auto blagorost_wallet = get_program_wallet(coopname, contributor -> username, _capital_program);
if (!blagorost_wallet.has_value()) {
// Открываем кошелек для пайщика для программы Благорост
Action::send<openprogwall_interface>(
_soviet,
Names::External::OPEN_PROGRAM_WALLET,
_capital,
coopname,
contributor -> username,
_capital_program,
uint64_t(0)
);
}
};
@@ -11,18 +11,24 @@
* @param rate_per_hour Почасовая ставка пайщика
* @param is_external_contract Флаг внешнего договора
* @param contract Договор УХД пайщика
* @param storage_agreement Договор хранения Имущества
* @param blagorost_agreement Соглашение о присоединении к целевой потребительской программе "Благорост" (опционально)
* @ingroup public_actions
* @ingroup public_capital_actions
* @note Авторизация требуется от аккаунта: @p coopname
*/
void capital::regcontrib(eosio::name coopname, eosio::name username, checksum256 contributor_hash, eosio::asset rate_per_hour, uint64_t hours_per_day, bool is_external_contract, document2 contract) {
void capital::regcontrib(eosio::name coopname, eosio::name username, checksum256 contributor_hash, eosio::asset rate_per_hour, uint64_t hours_per_day, bool is_external_contract, document2 contract, document2 storage_agreement, std::optional<document2> blagorost_agreement) {
require_auth(coopname);
// если договор не внешний, то проверяем его на корректность
if (!is_external_contract) {
// проверяем, что договор подписан пайщиком
verify_document_or_fail(contract, {username});
verify_document_or_fail(storage_agreement, {username});
if (blagorost_agreement.has_value()) {
verify_document_or_fail(blagorost_agreement.value(), {username});
}
}
Wallet::validate_asset(rate_per_hour);
@@ -37,6 +43,12 @@ void capital::regcontrib(eosio::name coopname, eosio::name username, checksum256
auto exist_by_hash = Capital::Contributors::get_contributor_by_hash(coopname, contributor_hash);
eosio::check(!exist_by_hash.has_value(), "Контрибьютор с данным хэшем уже зарегистрирован");
// Проверяем наличие кошелька программы Благорост
auto blagorost_wallet = get_program_wallet(coopname, username, _capital_program);
if (!blagorost_agreement.has_value() && !blagorost_wallet.has_value()) {
eosio::check(false, "У пользователя нет кошелька программы Благорост и не предоставлено соглашение о присоединении к программе");
}
Capital::Contributors::create_contributor(coopname, username, contributor_hash, is_external_contract, contract, rate_per_hour, hours_per_day);
std::string memo = "";
@@ -59,4 +71,29 @@ void capital::regcontrib(eosio::name coopname, eosio::name username, checksum256
memo
);
// Линковка дополнительных документов
Action::send<newlink_interface>(
_soviet,
"newlink"_n,
_capital,
coopname,
username,
Names::Capital::REGISTER_CONTRIBUTOR,
contributor_hash,
storage_agreement
);
if (blagorost_agreement.has_value()) {
Action::send<newlink_interface>(
_soviet,
"newlink"_n,
_capital,
coopname,
username,
Names::Capital::REGISTER_CONTRIBUTOR,
contributor_hash,
blagorost_agreement.value()
);
}
};
+1 -1
View File
@@ -254,7 +254,7 @@ public:
// Регистрация
[[eosio::action]]
void regcontrib(eosio::name coopname, eosio::name username, checksum256 contributor_hash, eosio::asset rate_per_hour, uint64_t hours_per_day, bool is_external_contract, document2 contract);
void regcontrib(eosio::name coopname, eosio::name username, checksum256 contributor_hash, eosio::asset rate_per_hour, uint64_t hours_per_day, bool is_external_contract, document2 contract, document2 storage_agreement, std::optional<document2> blagorost_agreement);
[[eosio::action]]
void approvereg(eosio::name coopname, eosio::name username, checksum256 contributor_hash, document2 contract);
[[eosio::action]]
+2 -3
View File
@@ -79,8 +79,8 @@ static constexpr eosio::name _result_action = "result"_n;
static constexpr eosio::name _wallet_program = "wallet"_n; ///< Главный Кошелёк
static constexpr eosio::name _marketplace_program = "marketplace"_n; ///< Кошелёк программы "Маркетплейс"
static constexpr eosio::name _source_program = "source"_n; ///< Кошелёк для генерации по договору УХД
static constexpr eosio::name _capital_program = "capital"_n; ///< Кошелёк программы "Капитализация"
static constexpr eosio::name _source_program = "generator"_n; ///< Кошелёк для генерации по договору УХД
static constexpr eosio::name _capital_program = "blagorost"_n; ///< Кошелёк программы "Капитализация"
static const std::set<eosio::name> soviet_actions = {
@@ -176,7 +176,6 @@ static constexpr uint64_t _capital_program_id = 4;
"eosio"_n,
"fund"_n,
"branch"_n,
"capital"_n,
"wallet"_n,
"meet"_n,
"loan"_n,
+17 -14
View File
@@ -67,13 +67,6 @@ export interface IApproveexpns {
approved_statement: IDocument2
}
export interface IApproveinvst {
coopname: IName
username: IName
invest_hash: IChecksum256
approved_statement: IDocument2
}
export interface IApprovepgprp {
coopname: IName
username: IName
@@ -272,6 +265,7 @@ export interface ICountsData {
total_propertors: IUint64
total_contributors: IUint64
total_commits: IUint64
total_converted_segments: IUint64
}
export interface ICreatecmmt {
@@ -428,13 +422,6 @@ export interface IDeclinedebt {
reason: string
}
export interface IDeclineinvst {
coopname: IName
username: IName
invest_hash: IChecksum256
decline_statement: IDocument2
}
export interface IDeclinepgprp {
coopname: IName
username: IName
@@ -553,11 +540,17 @@ export interface IFactPool {
program_invest_pool: IAsset
total_received_investments: IAsset
total_returned_investments: IAsset
total_used_for_compensation: IAsset
total_generation_pool: IAsset
total_contribution: IAsset
total: IAsset
}
export interface IFinalizeproj {
coopname: IName
project_hash: IChecksum256
}
export interface IFundprog {
coopname: IName
amount: IAsset
@@ -709,12 +702,14 @@ export interface IProject {
is_opened: boolean
is_planed: boolean
can_convert_to_project: boolean
is_authorized: boolean
master: IName
title: string
description: string
invite: string
data: string
meta: string
authorization: IDocument2
counts: ICountsData
plan: IPlanPool
fact: IFactPool
@@ -793,6 +788,8 @@ export interface IRegcontrib {
hours_per_day: IUint64
is_external_contract: boolean
contract: IDocument2
storage_agreement: IDocument2
blagorost_agreement?: IDocument2
}
export interface IRegshare {
@@ -816,6 +813,12 @@ export interface IResult {
act: IDocument2
}
export interface IReturntopool {
coopname: IName
project_hash: IChecksum256
amount: IAsset
}
export interface IReturnunused {
coopname: IName
project_hash: IChecksum256
@@ -14,6 +14,8 @@ export interface IAdd {
account_id: IUint64
quantity: IAsset
comment: string
hash: IChecksum256
username: IName
}
export interface IAuth {
@@ -26,6 +28,8 @@ export interface IBlock {
account_id: IUint64
quantity: IAsset
comment: string
hash: IChecksum256
username: IName
}
export interface IComplete {
@@ -84,6 +88,8 @@ export interface ISub {
account_id: IUint64
quantity: IAsset
comment: string
hash: IChecksum256
username: IName
}
export interface IUnblock {
@@ -91,6 +97,8 @@ export interface IUnblock {
account_id: IUint64
quantity: IAsset
comment: string
hash: IChecksum256
username: IName
}
export interface IWriteoff {
@@ -98,6 +106,8 @@ export interface IWriteoff {
account_id: IUint64
quantity: IAsset
comment: string
hash: IChecksum256
username: IName
}
export interface IWriteoffOp {
@@ -117,5 +127,7 @@ export interface IWriteoffcnsl {
account_id: IUint64
quantity: IAsset
comment: string
hash: IChecksum256
username: IName
}
@@ -217,6 +217,12 @@ export interface IConfirmapprv {
approved_document: IDocument2
}
export interface IConverttoaxn {
coopname: IName
amount: IAsset
statement: IDocument2
}
export interface ICounts extends ICountsBase {
}
@@ -546,6 +552,29 @@ export interface IProgwallet {
membership_contribution: IAsset$
}
export interface IRepairdec {
coopname: IName
decision_id: IUint64
username: IName
type: IName
batch_id: IUint64
statement: IDocument2
votes_for: IName[]
votes_against: IName[]
validated: boolean
approved: boolean
authorized: boolean
authorized_by: IName
authorization: IDocument2
created_at: ITimePointSec
expired_at: ITimePointSec
meta: string
callback_contract: IName
confirm_callback: IName
decline_callback: IName
hash: IChecksum256
}
export interface IRight {
contract: IName
action_name: IName
@@ -17,7 +17,8 @@ export interface IApprovewthd {
export interface IAuthwthd {
coopname: IName
withdraw_hash: IChecksum256
hash: IChecksum256
authorization: IDocument2
}
export interface ICompletedpst {
+17 -19
View File
@@ -24,11 +24,6 @@ export interface IAct2pgprp {
act: IDocument2
}
export interface IFinalizeproj {
coopname: IName
project_hash: IChecksum256
}
export interface IAddauthor {
coopname: IName
project_hash: IChecksum256
@@ -72,13 +67,6 @@ export interface IApproveexpns {
approved_statement: IDocument2
}
export interface IApproveinvst {
coopname: IName
username: IName
invest_hash: IChecksum256
approved_statement: IDocument2
}
export interface IApprovepgprp {
coopname: IName
username: IName
@@ -277,6 +265,7 @@ export interface ICountsData {
total_propertors: IUint64
total_contributors: IUint64
total_commits: IUint64
total_converted_segments: IUint64
}
export interface ICreatecmmt {
@@ -433,13 +422,6 @@ export interface IDeclinedebt {
reason: string
}
export interface IDeclineinvst {
coopname: IName
username: IName
invest_hash: IChecksum256
decline_statement: IDocument2
}
export interface IDeclinepgprp {
coopname: IName
username: IName
@@ -558,11 +540,17 @@ export interface IFactPool {
program_invest_pool: IAsset
total_received_investments: IAsset
total_returned_investments: IAsset
total_used_for_compensation: IAsset
total_generation_pool: IAsset
total_contribution: IAsset
total: IAsset
}
export interface IFinalizeproj {
coopname: IName
project_hash: IChecksum256
}
export interface IFundprog {
coopname: IName
amount: IAsset
@@ -714,12 +702,14 @@ export interface IProject {
is_opened: boolean
is_planed: boolean
can_convert_to_project: boolean
is_authorized: boolean
master: IName
title: string
description: string
invite: string
data: string
meta: string
authorization: IDocument2
counts: ICountsData
plan: IPlanPool
fact: IFactPool
@@ -798,6 +788,8 @@ export interface IRegcontrib {
hours_per_day: IUint64
is_external_contract: boolean
contract: IDocument2
storage_agreement: IDocument2
blagorost_agreement?: IDocument2
}
export interface IRegshare {
@@ -821,6 +813,12 @@ export interface IResult {
act: IDocument2
}
export interface IReturntopool {
coopname: IName
project_hash: IChecksum256
amount: IAsset
}
export interface IReturnunused {
coopname: IName
project_hash: IChecksum256