Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocks to browser #622

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contracts/eden/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function(add_test_eden test_file suffix)
../token/include
../boot/include
../../external/atomicassets-contract/include
../../libraries/clchain/include
../../libraries/btb/include
./tests/include
)
target_link_libraries(${test_file}${suffix} catch2 cltestlib${suffix})
Expand All @@ -72,7 +72,7 @@ function(add_eden_microchain suffix)
add_executable(eden-micro-chain${suffix}
src/eden-micro-chain.cpp
)
target_link_libraries(eden-micro-chain${suffix} clchain${suffix} eosio-contracts-wasi-polyfill${suffix})
target_link_libraries(eden-micro-chain${suffix} btb${suffix} eosio-contracts-wasi-polyfill${suffix})
target_include_directories(eden-micro-chain${suffix} PRIVATE
include
../../libraries/eosiolib/contracts/include
Expand Down
57 changes: 28 additions & 29 deletions contracts/eden/include/eden.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <constants.hpp>
#include <eden-atomicassets.hpp>
#include <eden_dispatcher.hpp>
#include <encrypt.hpp>
#include <eosio/asset.hpp>
#include <eosio/bytes.hpp>
Expand Down Expand Up @@ -88,7 +87,7 @@ namespace eden
eosio::name eden_account,
const eosio::public_key& key);

void run(eosio::ignore<run_auth> auth, eosio::ignore<std::vector<verb>> verbs);
void run(eosio::ignore<eosio::run_auth> auth, eosio::ignore<std::vector<verb>> verbs);

void withdraw(eosio::name owner, const eosio::asset& quantity);

Expand Down Expand Up @@ -225,11 +224,11 @@ namespace eden
eosio::ignore<std::vector<eosio::asset>>);
};

EDEN_ACTIONS(
EOSIO_ACTIONS(
eden,
"eden.gm"_n,
action(newsession, eden_account, key, expiration, description),
eden_verb(delsession, 0, eden_account, key),
action_verb(delsession, 0, eden_account, key),
action(run, auth, verbs),
action(withdraw, owner, quantity, ricardian_contract(withdraw_ricardian)),
action(donate, owner, quantity),
Expand All @@ -251,41 +250,41 @@ namespace eden
action(addtogenesis, account, expiration),
action(gensetexpire, id, new_expiration),
action(clearall, ricardian_contract(clearall_ricardian)),
eden_verb(inductinit,
10,
id,
inviter,
invitee,
witnesses,
ricardian_contract(inductinit_ricardian)),
eden_verb(inductmeetin, 1, account, id, keys, data, old_data),
eden_verb(inductprofil,
2,
id,
new_member_profile,
ricardian_contract(inductprofil_ricardian)),
eden_verb(inductvideo, 3, account, id, video, ricardian_contract(inductvideo_ricardian)),
eden_verb(inductendors,
4,
account,
id,
induction_data_hash,
ricardian_contract(inductendors_ricardian)),
action_verb(inductinit,
10,
id,
inviter,
invitee,
witnesses,
ricardian_contract(inductinit_ricardian)),
action_verb(inductmeetin, 1, account, id, keys, data, old_data),
action_verb(inductprofil,
2,
id,
new_member_profile,
ricardian_contract(inductprofil_ricardian)),
action_verb(inductvideo, 3, account, id, video, ricardian_contract(inductvideo_ricardian)),
action_verb(inductendors,
4,
account,
id,
induction_data_hash,
ricardian_contract(inductendors_ricardian)),
action(setencpubkey, account, key),
action(electsettime, election_time),
action(electconfig, day, time, round_duration),
eden_verb(electopt, 5, member, participating),
action_verb(electopt, 5, member, participating),
action(electseed, btc_header),
eden_verb(electmeeting, 6, account, round, keys, data, old_data),
eden_verb(electvote, 7, round, voter, candidate),
eden_verb(electvideo, 8, round, voter, video),
action_verb(electmeeting, 6, account, round, keys, data, old_data),
action_verb(electvote, 7, round, voter, candidate),
action_verb(electvideo, 8, round, voter, video),
action(electprocess, max_steps),
action(bylawspropose, proposer, bylaws),
action(bylawsapprove, approver, bylaws_hash),
action(bylawsratify, approver, bylaws_hash),
action(distribute, max_steps),
action(inductdonate, payer, id, quantity, ricardian_contract(inductdonate_ricardian)),
eden_verb(inductcancel, 9, account, id, ricardian_contract(inductcancel_ricardian)),
action_verb(inductcancel, 9, account, id, ricardian_contract(inductcancel_ricardian)),
action(inducted, inductee, ricardian_contract(inducted_ricardian)),
action(resign, account),
action(gc, limit, ricardian_contract(gc_ricardian)),
Expand Down
20 changes: 0 additions & 20 deletions contracts/eden/include/eden_abi_generator.hpp

This file was deleted.

108 changes: 0 additions & 108 deletions contracts/eden/include/eden_dispatcher.hpp

This file was deleted.

53 changes: 1 addition & 52 deletions contracts/eden/include/sessions.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <eosio/contract_auth.hpp>
#include <eosio/crypto.hpp>
#include <utils.hpp>

Expand Down Expand Up @@ -46,58 +47,6 @@ namespace eden
void clearall_sessions(eosio::name contract);
void remove_sessions(eosio::name contract, eosio::name eden_account);

// No authorization provided
struct no_auth
{
};
EOSIO_REFLECT(no_auth)

// Case 1: eosio account. run() does a require_auth(eosio_account).
// * contract: ""
// * contract_account: ""
// * eosio_account: the account
//
// Case 2: contract-defined account. run() does a require_auth(eosio_account), verifies
// that eosio_account is associated with contract_account, verifies the recovered
// public key is registered for the account, and checks the sequence number. run()
// may delegate everything except the require_auth to another contract.
// * contract: the contract defining the account space
// * contract_account: the account
// * eosio_account: eosio account associated with contract_account.
//
// The Eden contract only supports Case 2 and requires contract == the Eden contract.
struct account_auth
{
eosio::name contract;
eosio::name contract_account;
eosio::name eosio_account;
};
EOSIO_REFLECT(account_auth, contract, contract_account, eosio_account)

// * signature: covers sha256(contract, account, sequence, verbs)
// * contract: the contract defining the account space, or "" if an eosio account
// * account: the contract account or eosio account
// * sequence: replay prevention
//
// The Eden contract requires contract == the Eden contract.
struct signature_auth
{
eosio::signature signature;
eosio::name contract;
eosio::name account;
eosio::varuint32 sequence;
};
EOSIO_REFLECT(signature_auth, signature, contract, account, sequence)

using run_auth = std::variant<no_auth, account_auth, signature_auth>;

enum class run_auth_type
{
no_auth,
account_auth,
signature_auth
};

struct session_info
{
std::optional<eosio::name> authorized_eden_account;
Expand Down
Loading