-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpoap_plugin.h
64 lines (53 loc) · 1.58 KB
/
poap_plugin.h
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
#pragma once
#include "eth_internals.h"
#include "eth_plugin_interface.h"
#include <string.h>
#define NUM_SELECTORS 1
#define PLUGIN_NAME "Poap"
#define TOKEN_FOUND 1 << 1
#define SELECTOR_SIZE 4
#define PARAMETER_LENGTH 32
#define RUN_APPLICATION 1
typedef enum {
MINT_TOKEN,
} selector_t;
// Enumeration used to parse the smart contract data.
typedef enum {
EVENT_ID,
TOKEN,
BENEFICIARY,
FROM_ADDRESS,
NONE,
} parameter;
typedef enum {
TOKEN_SCREEN,
BENEFICIARY_SCREEN,
FROM_ADDRESS_SCREEN,
WARN_SCREEN,
ERROR,
} screens_t;
extern const uint8_t *const POAP_SELECTORS[NUM_SELECTORS];
// Shared global memory with Ethereum app. Must be at most 5 * 32 bytes.
typedef struct context_t {
// For display.
uint8_t beneficiary[ADDRESS_LENGTH];
uint8_t token_id[PARAMETER_LENGTH]; // not crypto token dedicated poap token value int number
char ticker[MAX_TICKER_LEN];
// For parsing data.
uint16_t offset;
uint16_t checkpoint;
uint8_t skip;
uint8_t decimals;
uint8_t next_param;
uint8_t tokens_found;
// For both parsing and display.
selector_t selectorIndex;
} context_t;
// Piece of code that will check that the above structure is not bigger than 5 * 32. Do not remove
// this check.
_Static_assert(sizeof(context_t) <= 5 * 32, "Structure of parameters too big.");
void handle_provide_parameter(void *parameters);
void handle_query_contract_ui(void *parameters);
void handle_init_contract(void *parameters);
void handle_finalize(void *parameters);
void handle_query_contract_id(void *parameters);