Skip to main content

bobcat_entrypoints/
lib.rs

1#![no_std]
2
3use bobcat_cd::{U, EvmCdAddress, EvmCdBytes, EvmCdSerialise, EvmCdDeserialise};
4
5#[derive(Debug, Clone, PartialEq, EvmCdSerialise, EvmCdDeserialise)]
6#[evm_selector]
7pub enum Eip20 {
8    TotalSupply,
9    BalanceOf {
10        owner: EvmCdAddress,
11    },
12    Transfer {
13        to: EvmCdAddress,
14        value: U,
15    },
16    Allowance {
17        owner: EvmCdAddress,
18        spender: EvmCdAddress,
19    },
20    Approve {
21        spender: EvmCdAddress,
22        value: U,
23    },
24    TransferFrom {
25        from: EvmCdAddress,
26        to: EvmCdAddress,
27        value: U,
28    },
29    Name,
30    Symbol,
31    Decimals,
32}
33
34#[derive(Debug, Clone, PartialEq, EvmCdSerialise, EvmCdDeserialise)]
35#[evm_selector]
36pub enum Eip20Permit {
37    TotalSupply,
38    BalanceOf {
39        owner: EvmCdAddress,
40    },
41    Transfer {
42        to: EvmCdAddress,
43        value: U,
44    },
45    Allowance {
46        owner: EvmCdAddress,
47        spender: EvmCdAddress,
48    },
49    Approve {
50        spender: EvmCdAddress,
51        value: U,
52    },
53    TransferFrom {
54        from: EvmCdAddress,
55        to: EvmCdAddress,
56        value: U,
57    },
58    Name,
59    Symbol,
60    Decimals,
61
62    Permit {
63        owner: EvmCdAddress,
64        spender: EvmCdAddress,
65        value: U,
66        deadline: U,
67        v: u8,
68        r: [u8; 32],
69        s: [u8; 32],
70    },
71    Nonces {
72        owner: EvmCdAddress,
73    },
74    DomainSeparator,
75}
76
77#[derive(Debug, Clone, PartialEq, EvmCdSerialise, EvmCdDeserialise)]
78#[evm_selector]
79pub enum Eip721DataSlice<const MAX_DATA: usize> {
80    BalanceOf {
81        owner: EvmCdAddress,
82    },
83    OwnerOf {
84        token_id: U,
85    },
86    SafeTransferFrom {
87        from: EvmCdAddress,
88        to: EvmCdAddress,
89        token_id: U,
90    },
91    #[evm_selector("safeTransferFrom(address,address,uint256,bytes)")]
92    SafeTransferFromWithData {
93        from: EvmCdAddress,
94        to: EvmCdAddress,
95        token_id: U,
96        data: EvmCdBytes<MAX_DATA>,
97    },
98    TransferFrom {
99        from: EvmCdAddress,
100        to: EvmCdAddress,
101        token_id: U,
102    },
103    Approve {
104        approved: EvmCdAddress,
105        token_id: U,
106    },
107    SetApprovalForAll {
108        operator: EvmCdAddress,
109        approved: bool,
110    },
111    GetApproved {
112        token_id: U,
113    },
114    IsApprovedForAll {
115        owner: EvmCdAddress,
116        operator: EvmCdAddress,
117    },
118}
119
120#[cfg(feature = "alloc")]
121#[derive(Debug, Clone, PartialEq, EvmCdSerialise, EvmCdDeserialise)]
122#[evm_selector]
123pub enum Eip721DataVec {
124    BalanceOf {
125        owner: EvmCdAddress,
126    },
127    OwnerOf {
128        token_id: U,
129    },
130    SafeTransferFrom {
131        from: EvmCdAddress,
132        to: EvmCdAddress,
133        token_id: U,
134    },
135    #[evm_selector("safeTransferFrom(address,address,uint256,bytes)")]
136    SafeTransferFromWithData {
137        from: EvmCdAddress,
138        to: EvmCdAddress,
139        token_id: U,
140        data: Vec<u8>,
141    },
142    TransferFrom {
143        from: EvmCdAddress,
144        to: EvmCdAddress,
145        token_id: U,
146    },
147    Approve {
148        approved: EvmCdAddress,
149        token_id: U,
150    },
151    SetApprovalForAll {
152        operator: EvmCdAddress,
153        approved: bool,
154    },
155    GetApproved {
156        token_id: U,
157    },
158    IsApprovedForAll {
159        owner: EvmCdAddress,
160        operator: EvmCdAddress,
161    },
162}