Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/integration/blockchain/shared/evm/evm-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export abstract class EvmClient extends BlockchainClient {
): Promise<ethers.providers.TransactionResponse> {
let { gasPrice, value } = request;

request.from ??= wallet.address;
const currentNonce = await this.getNonce(request.from);
const txNonce = request.nonce ? +request.nonce.toString() : currentNonce;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class CustodyJobService {
private async executeStep() {
const newSteps = await this.custodyOrderStepRepo.find({
where: { status: CustodyOrderStepStatus.CREATED },
relations: { order: { sell: true, swap: true, user: true } },
relations: { order: { sell: { deposit: true }, swap: { deposit: true }, user: true } },
});

for (const step of newSteps) {
Expand Down
11 changes: 7 additions & 4 deletions src/subdomains/core/custody/services/custody-order.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { JwtPayload } from 'src/shared/auth/jwt-payload.interface';
import { Asset } from 'src/shared/models/asset/asset.entity';
import { AssetService } from 'src/shared/models/asset/asset.service';
import { FiatService } from 'src/shared/models/fiat/fiat.service';
import { AmountType, Util } from 'src/shared/utils/util';
import { User } from 'src/subdomains/generic/user/models/user/user.entity';
import { UserService } from 'src/subdomains/generic/user/models/user/user.service';
import { TransactionRequest } from 'src/subdomains/supporting/payment/entities/transaction-request.entity';
Expand Down Expand Up @@ -327,6 +328,8 @@ export class CustodyOrderService {
const estimatedAmount =
equityPair.direction === EquityDirection.MINT ? sourceAmount / equityPrice : sourceAmount * equityPrice;

const exchangeRate = equityPair.direction === EquityDirection.MINT ? equityPrice : 1 / equityPrice;

const zeroFee = { min: 0, rate: 0, fixed: 0, dfx: 0, network: 0, platform: 0, bank: 0, total: 0 };

return Object.assign(new CustodyOrderResponseDto(), {
Expand All @@ -340,11 +343,11 @@ export class CustodyOrderService {
fees: zeroFee,
feesTarget: zeroFee,
minVolumeTarget: 0,
maxVolumeTarget: estimatedAmount,
exchangeRate: equityPair.direction === EquityDirection.MINT ? equityPrice : 1 / equityPrice,
rate: equityPair.direction === EquityDirection.MINT ? equityPrice : 1 / equityPrice,
maxVolumeTarget: Util.roundReadable(estimatedAmount, AmountType.ASSET),
exchangeRate: Util.roundReadable(exchangeRate, AmountType.ASSET),
rate: Util.roundReadable(exchangeRate, AmountType.ASSET),
priceSteps: [],
estimatedAmount,
estimatedAmount: Util.roundReadable(estimatedAmount, AmountType.ASSET),
isValid: true,
});
}
Expand Down
Loading