Skip to main content

bobcat_interfaces/
morpho.rs

1use 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(amount: &U, receiver: Address, owner: Address) -> [u8; 4 + 32 * 3] {
19    concat_arrays!(
20        SEL_WITHDRAW,
21        amount.0,
22        leftpad_addr(receiver),
23        leftpad_addr(owner)
24    )
25}