Skip to content

Commit

Permalink
Centrifuge App: Use HashZero to represent empty bytes for LP (#1827)
Browse files Browse the repository at this point in the history
* Use ethers HashZero to represent empty bytes

* Format zero bytes
  • Loading branch information
sophialittlejohn authored Dec 20, 2023
1 parent 9fa4218 commit 9debe0b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions centrifuge-js/src/modules/liquidityPools.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BigNumber } from '@ethersproject/bignumber'
import { Contract, ContractInterface } from '@ethersproject/contracts'
import type { JsonRpcProvider, TransactionRequest, TransactionResponse } from '@ethersproject/providers'
import { formatBytes32String } from '@ethersproject/strings'
import BN from 'bn.js'
import { signERC2612Permit } from 'eth-permit'
import { combineLatestWith, firstValueFrom, from, map, startWith, switchMap } from 'rxjs'
Expand Down Expand Up @@ -140,7 +141,7 @@ export function getLiquidityPoolsModule(inst: Centrifuge) {
const [lpAddress, order] = args
const user = inst.getSignerAddress('evm')
return pending(
contract(lpAddress, ABI.LiquidityPool).requestDeposit(order.toString(), user, user, 0x00, {
contract(lpAddress, ABI.LiquidityPool).requestDeposit(order.toString(), user, user, formatBytes32String(''), {
...options,
gasLimit: 300000,
})
Expand All @@ -151,7 +152,7 @@ export function getLiquidityPoolsModule(inst: Centrifuge) {
const [lpAddress, order] = args
const user = inst.getSignerAddress('evm')
return pending(
contract(lpAddress, ABI.LiquidityPool).requestRedeem(order.toString(), user, user, 0x00, {
contract(lpAddress, ABI.LiquidityPool).requestRedeem(order.toString(), user, user, formatBytes32String(''), {
...options,
gasLimit: 300000,
})
Expand All @@ -165,10 +166,19 @@ export function getLiquidityPoolsModule(inst: Centrifuge) {
const [lpAddress, order, { deadline, r, s, v }] = args
const user = inst.getSignerAddress('evm')
return pending(
contract(lpAddress, ABI.LiquidityPool).requestDepositWithPermit(order.toString(), user, '', deadline, v, r, s, {
...options,
gasLimit: 300000,
})
contract(lpAddress, ABI.LiquidityPool).requestDepositWithPermit(
order.toString(),
user,
formatBytes32String(''),
deadline,
v,
r,
s,
{
...options,
gasLimit: 300000,
}
)
)
}

Expand Down

0 comments on commit 9debe0b

Please sign in to comment.