Skip to content

Commit

Permalink
return receipt in amplified orders methods (#1849)
Browse files Browse the repository at this point in the history
* return receipt in amplified orders methods

Signed-off-by: belbazanas <[email protected]>

* update changelog

Signed-off-by: belbazanas <[email protected]>

---------

Signed-off-by: belbazanas <[email protected]>
  • Loading branch information
anasbelbaz authored Mar 11, 2024
1 parent 37069db commit cef83d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Next version

# 2.0.5-39

- add tx receipt in amplified orders methods

# 2.0.5-38

- fix gasreq for zerolend again
Expand Down
17 changes: 10 additions & 7 deletions src/amplifier/mangroveAmplifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class MangroveAmplifier {
*/
public async updateBundle(
data: z.input<typeof updateBundleParams>,
): Promise<void> {
): Promise<ethers.ContractReceipt> {
const {
bundleId,
outboundToken,
Expand All @@ -268,14 +268,14 @@ class MangroveAmplifier {
contextInfo: "amplifiedOrder.updateBundle",
data: { receipt },
});
return;
return receipt;
}

/**
*/
public async updateOfferInBundle(
data: z.input<typeof updateBundleOfferParams>,
): Promise<void> {
): Promise<ethers.ContractReceipt | undefined> {
const { bundleId, inboundToken, newTick, newInboundLogic, outboundToken } =
updateBundleOfferParams.parse(data);

Expand All @@ -292,6 +292,8 @@ class MangroveAmplifier {

const olKeyHash = this.mgv.getOlKeyHash(olKey);

let receipt: ethers.ContractReceipt | undefined;

if (newTick) {
const base = await this.mgv.tokenFromAddress(inboundToken);
const quote = await this.mgv.tokenFromAddress(outboundToken);
Expand Down Expand Up @@ -321,7 +323,8 @@ class MangroveAmplifier {
{},
[olKey, newTick, gives.gives.toString(), gasReq, offerId],
);
const receipt = await response.wait();

receipt = await response.wait();

logger.debug("Amplified order update tick receipt", {
contextInfo: "amplifiedOrder.updateOfferInBundle",
Expand All @@ -339,7 +342,7 @@ class MangroveAmplifier {
if (newInboundLogic) {
await this.setRoutingLogic(newRoutingLogicParams, {});
}
return;
return receipt;
}

private async setRoutingLogic(
Expand Down Expand Up @@ -380,7 +383,7 @@ class MangroveAmplifier {
*/
public async retractBundle(
data: z.input<typeof retractBundleParams>,
): Promise<void> {
): Promise<ethers.ContractReceipt> {
const { bundleId, outboundToken } = retractBundleParams.parse(data);
const response = await createTxWithOptionalGasEstimation(
this.amplifier.retractBundle,
Expand All @@ -395,7 +398,7 @@ class MangroveAmplifier {
contextInfo: "amplifiedOrder.retractBundle",
data: { receipt },
});
return;
return receipt;
}
}

Expand Down

0 comments on commit cef83d0

Please sign in to comment.