Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Mar 11, 2024
1 parent 166f6b4 commit 119e8fb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions crates/erc20_payment_lib/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ pub fn encode_create_deposit(
)
}
pub fn encode_payout_single(
id: u32,
id: U256,
recipient: Address,
amount: U256,
) -> Result<Vec<u8>, web3::ethabi::Error> {
contract_encode(
&LOCK_CONTRACT_TEMPLATE,
"payoutSingle",
"depositSingleTransfer",
(id, recipient, amount),
)
}
Expand Down
8 changes: 6 additions & 2 deletions crates/erc20_payment_lib/src/sender/batching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ pub async fn gather_transactions_batch_multi(
"Lock contract address not set for chain id: {}",
token_transfer.chain_id
))?;
let deposit_id = u32::from_str(deposit_id).map_err(err_from!())?;
let deposit_id = U256::from_str(deposit_id).map_err(
|err| err_custom_create!("Invalid deposit id: {}", err),
)?;
create_erc20_deposit_transfer(
Address::from_str(&token_transfer.from_addr).map_err(err_from!())?,
erc20_to[0],
Expand Down Expand Up @@ -350,7 +352,9 @@ pub async fn gather_transactions_batch(
"Lock contract address not set for chain id: {}",
token_transfer.chain_id
))?;
let deposit_id = u32::from_str(deposit_id).map_err(err_from!())?;
let deposit_id = U256::from_str(deposit_id).map_err(
|err| err_custom_create!("Invalid deposit id: {}", err),
)?;
create_erc20_deposit_transfer(
Address::from_str(&token_transfer.from_addr).map_err(err_from!())?,
Address::from_str(&token_transfer.receiver_addr).map_err(err_from!())?,
Expand Down
7 changes: 3 additions & 4 deletions crates/erc20_payment_lib/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,17 @@ pub fn create_erc20_transfer(
})
}

#[allow(clippy::too_many_arguments)]
pub fn create_erc20_deposit_transfer(
from: Address,
erc20_to: Address,
erc20_amount: U256,
chain_id: u64,
gas_limit: Option<u64>,
lock_contract_address: Address,
deposit_id: u32,
deposit_id: U256,
) -> Result<TxDbObj, PaymentError> {
Ok(TxDbObj {
method: "LOCK.payoutSingle".to_string(),
method: "LOCK.depositSingleTransfer".to_string(),
from_addr: format!("{from:#x}"),
to_addr: format!("{lock_contract_address:#x}"),
chain_id: chain_id as i64,
Expand Down Expand Up @@ -218,7 +217,7 @@ pub fn create_erc20_transfer_multi_deposit(

let data = encode_deposit_transfer(multi_args.deposit_id, packed).map_err(err_from!())?;
Ok(TxDbObj {
method: "payoutMultipleInternal".to_string(),
method: "LOCK.depositTransfer".to_string(),
from_addr: format!("{:#x}", multi_args.from),
to_addr: format!("{:#x}", multi_args.lock_contract),
chain_id: multi_args.chain_id as i64,
Expand Down

0 comments on commit 119e8fb

Please sign in to comment.