forked from EOS-Nation/escrow.bos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
escrow.hpp
74 lines (46 loc) · 1.76 KB
/
escrow.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <eosiolib/eosio.hpp>
#include <eosiolib/asset.hpp>
#include <eosiolib/time.hpp>
#include <optional>
#include "escrow_shared.hpp"
using namespace eosio;
using namespace std;
namespace bos {
class escrow : public contract {
private:
escrows_table escrows;
name sending_code;
public:
escrow(name s, name code, datastream<const char *> ds)
: contract(s, code, ds),
escrows(_self, _self.value) {
sending_code = name{code};
}
~escrow();
/**
* Escrow contract
*/
ACTION init(name sender, name receiver, name auditor, time_point_sec expires, string memo, std::optional<uint64_t> ext_reference);
ACTION transfer(name from, name to, asset quantity, string memo);
ACTION approve(uint64_t key, name approver);
ACTION unapprove(uint64_t key, name unapprover);
ACTION claim(uint64_t key);
ACTION refund(uint64_t key);
ACTION cancel(uint64_t key);
ACTION extend(uint64_t key, time_point_sec expires);
ACTION close(uint64_t key);
ACTION lock(uint64_t key, bool locked);
// Actions using the external reference key
ACTION approveext(uint64_t ext_key, name approver);
ACTION unapproveext(uint64_t ext_key, name unapprover);
ACTION claimext(uint64_t ext_key);
ACTION refundext(uint64_t ext_key);
ACTION cancelext(uint64_t ext_key);
ACTION extendext(uint64_t ext_key, time_point_sec expires);
ACTION closeext(uint64_t ext_key);
ACTION lockext(uint64_t ext_key, bool locked);
ACTION clean();
private:
std::optional<uint64_t> key_for_external_key(std::optional<uint64_t> ext_key);
};
};