Skip to content

Commit

Permalink
Check ERC20 token caps
Browse files Browse the repository at this point in the history
  • Loading branch information
sug0 committed Oct 9, 2023
1 parent 164b21e commit 1a94d9c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions shared/src/ledger/queries/shell/eth_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ pub struct Erc20FlowControl {
cap: Amount,
}

impl Erc20FlowControl {
/// Check if the `transferred_amount` exceeds the token caps of some ERC20
/// asset.
#[inline]
pub fn exceeds_token_caps(&self, transferred_amount: Amount) -> bool {
self.supply + transferred_amount > self.cap
}
}

/// Request data to pass to `generate_bridge_pool_proof`.
#[derive(Debug, Clone, Eq, PartialEq, BorshSerialize, BorshDeserialize)]
pub struct GenBridgePoolProofReq<'transfers, 'relayer> {
Expand Down

0 comments on commit 1a94d9c

Please sign in to comment.