Flex
Flex exchange system
AuthIndex.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <tvm/schema/message.hpp>
10 #include <tvm/smart_switcher.hpp>
11 #include <tvm/contract_handle.hpp>
12 
13 namespace tvm {
14 
21 __interface IAuthIndex {
22 
24  [[deploy, internal]]
25  void onDeploy() = 10;
26 
28  [[internal]]
29  void remove(address dst) = 11;
30 };
31 using IAuthIndexPtr = handle<IAuthIndex>;
32 
34 struct DAuthIndex {
35  uint256 pubkey_;
36  opt<address> owner_;
37 };
38 
41 __interface EAuthIndex {
42 };
43 
45 template<>
46 struct preparer<IAuthIndex, DAuthIndex> {
47  __always_inline
48  static std::pair<StateInit, uint256> execute(DAuthIndex data, cell code) {
49  cell data_cl = prepare_persistent_data<IAuthIndex, void>({}, data);
50  StateInit init { {}, {}, code, data_cl, {} };
51  cell init_cl = build(init).make_cell();
52  return { init, uint256(tvm_hash(init_cl)) };
53  }
54 };
55 
56 } // namespace tvm
AuthIndex persistent data struct.
Definition: AuthIndex.hpp:34
uint256 pubkey_
dApp public key
Definition: AuthIndex.hpp:35
opt< address > owner_
UserIDIndex address.
Definition: AuthIndex.hpp:36
AuthIndex events interface.
Definition: AuthIndex.hpp:41
AuthIndex contract interface. Auth index is a contract that helps dApp find user_id and FlexClient ad...
Definition: AuthIndex.hpp:21
void onDeploy()
Deploy the contract.
void remove(address dst)
Remove the contract and send the remaining evers to dst.