bobcat_interfaces/
morpho.rs1use array_concat::concat_arrays;
2use bobcat_cd::leftpad_addr;
3use bobcat_maths::U;
4
5use crate::selectors;
6
7type Address = [u8; 20];
8
9selectors! {
10 SEL_DEPOSIT = b"deposit(uint256,address)",
11 SEL_WITHDRAW = b"withdraw(uint256,address,address)"
12}
13
14pub const fn make_fn_deposit(amount: &U, receiver: Address) -> [u8; 4 + 32 * 2] {
15 concat_arrays!(SEL_DEPOSIT, amount.0, leftpad_addr(receiver))
16}
17
18pub const fn make_fn_withdraw(
19 amount: &U,
20 receiver: Address,
21 owner: Address,
22) -> [u8; 4 + 32 * 3] {
23 concat_arrays!(
24 SEL_WITHDRAW,
25 amount.0,
26 leftpad_addr(receiver),
27 leftpad_addr(owner)
28 )
29}