Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return receipt in amplified orders methods #1849

Merged
merged 2 commits into from
Mar 11, 2024
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
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
Loading