feat: Implement Permit2

- Retrieve allowance data from an RPC
- Encode approvals:
  - Create PermitSingle (and PermitDetails)
  - Use alloy eip712 to get signing hash on typed data
  - Sign data
- Add chrono and alloy eip712 and signer-local to Cargo.toml

--- don't change below this line ---
ENG-4063 Took 1 hour 58 minutes

Took 18 seconds

Took 32 seconds

Took 9 seconds

Took 1 minute


Took 32 minutes
This commit is contained in:
Diana Carvalho
2025-01-21 18:26:44 +00:00
parent 7bfd6c981c
commit ce9ae49e6f
5 changed files with 1330 additions and 55 deletions

View File

@@ -1,6 +1,8 @@
use num_bigint::BigUint;
use tycho_core::Bytes;
use crate::encoding::errors::EncodingError;
#[allow(dead_code)]
pub struct Approval {
pub spender: Bytes,
@@ -11,5 +13,5 @@ pub struct Approval {
pub trait UserApprovalsManager {
#[allow(dead_code)]
fn encode_approvals(&self, approvals: Vec<Approval>) -> Vec<Vec<u8>>;
fn encode_approvals(&self, approvals: Vec<Approval>) -> Result<Vec<Vec<u8>>, EncodingError>;
}