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}
163
164#[derive(Debug, Clone, PartialEq, EvmCdSerialise, EvmCdDeserialise)]
165#[evm_selector]
166pub enum Eip721MetadataDataSlice<const MAX_DATA: usize> {
167    BalanceOf {
168        owner: EvmCdAddress,
169    },
170    OwnerOf {
171        token_id: U,
172    },
173    SafeTransferFrom {
174        from: EvmCdAddress,
175        to: EvmCdAddress,
176        token_id: U,
177    },
178    #[evm_selector("safeTransferFrom(address,address,uint256,bytes)")]
179    SafeTransferFromWithData {
180        from: EvmCdAddress,
181        to: EvmCdAddress,
182        token_id: U,
183        data: EvmCdBytes<MAX_DATA>,
184    },
185    TransferFrom {
186        from: EvmCdAddress,
187        to: EvmCdAddress,
188        token_id: U,
189    },
190    Approve {
191        approved: EvmCdAddress,
192        token_id: U,
193    },
194    SetApprovalForAll {
195        operator: EvmCdAddress,
196        approved: bool,
197    },
198    GetApproved {
199        token_id: U,
200    },
201    IsApprovedForAll {
202        owner: EvmCdAddress,
203        operator: EvmCdAddress,
204    },
205    Name,
206    Symbol,
207    #[evm_selector("tokenURI(uint256)")]
208    TokenUri { token_id: U }
209}
210
211#[cfg(feature = "alloc")]
212#[derive(Debug, Clone, PartialEq, EvmCdSerialise, EvmCdDeserialise)]
213#[evm_selector]
214pub enum Eip721MetadataDataVec<const MAX_DATA: usize> {
215    BalanceOf {
216        owner: EvmCdAddress,
217    },
218    OwnerOf {
219        token_id: U,
220    },
221    SafeTransferFrom {
222        from: EvmCdAddress,
223        to: EvmCdAddress,
224        token_id: U,
225    },
226    #[evm_selector("safeTransferFrom(address,address,uint256,bytes)")]
227    SafeTransferFromWithData {
228        from: EvmCdAddress,
229        to: EvmCdAddress,
230        token_id: U,
231        data: Vec<u8>,
232    },
233    TransferFrom {
234        from: EvmCdAddress,
235        to: EvmCdAddress,
236        token_id: U,
237    },
238    Approve {
239        approved: EvmCdAddress,
240        token_id: U,
241    },
242    SetApprovalForAll {
243        operator: EvmCdAddress,
244        approved: bool,
245    },
246    GetApproved {
247        token_id: U,
248    },
249    IsApprovedForAll {
250        owner: EvmCdAddress,
251        operator: EvmCdAddress,
252    },
253    Name,
254    Symbol,
255    #[evm_selector("tokenURI(uint256)")]
256    TokenUri { token_id: U }
257}