Skip to content

Commit da093ee

Browse files
committed
Updated Deploy Published Contract Flow + ProcessTx
1 parent f2f2e40 commit da093ee

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

src/db/transactions/queueTx.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ export const queueTx = async ({
6060
return queueId;
6161
} else {
6262
const fromAddress = await tx.getSignerAddress();
63-
const toAddress = tx.getTarget();
63+
const toAddress =
64+
tx.getTarget() === "0x0000000000000000000000000000000000000000" &&
65+
txData.functionName === "deploy" &&
66+
extension === "deploy-published"
67+
? null
68+
: tx.getTarget();
6469

6570
const { id: queueId } = await queueTxRaw({
6671
pgtx,

src/db/transactions/updateTx.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type UpdateTxData =
2424
res: ethers.providers.TransactionRequest;
2525
sentAtBlockNumber: number;
2626
retryCount?: number;
27+
deployedContractAddress?: string;
2728
}
2829
| {
2930
status: TransactionStatus.UserOpSent;
@@ -84,6 +85,7 @@ export const updateTx = async ({ pgtx, queueId, data }: UpdateTxParams) => {
8485
maxFeePerGas: data.res?.maxFeePerGas?.toString(),
8586
maxPriorityFeePerGas: data.res?.maxPriorityFeePerGas?.toString(),
8687
value: data.res?.value?.toString(),
88+
deployedContractAddress: data.deployedContractAddress,
8789
},
8890
});
8991
break;

src/server/routes/deploy/published.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ requestBodySchema.examples = [
3535
// OUTPUT
3636
const responseSchema = Type.Object({
3737
queueId: Type.Optional(Type.String()),
38-
deployedAddress: Type.Optional(Type.String()),
38+
// deployedAddress: Type.Optional(Type.String()),
3939
});
4040

4141
export async function deployPublished(fastify: FastifyInstance) {
@@ -88,7 +88,7 @@ export async function deployPublished(fastify: FastifyInstance) {
8888
});
8989

9090
reply.status(StatusCodes.OK).send({
91-
deployedAddress,
91+
// deployedAddress,
9292
queueId,
9393
});
9494
},

src/worker/tasks/processTx.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
} from "../../utils/webhook";
3636
import { randomNonce } from "../utils/nonce";
3737
import { getWithdrawValue } from "../utils/withdraw";
38+
import { getContractAddress } from "ethers/lib/utils";
3839

3940
type RpcResponseData = {
4041
tx: Transactions;
@@ -288,6 +289,16 @@ export const processTx = async () => {
288289
if (rpcResponse.result) {
289290
// Transaction was successful.
290291
const transactionHash = rpcResponse.result;
292+
let contractAddress: string | undefined;
293+
if (
294+
tx.extension === "deploy-published" &&
295+
tx.functionName === "deploy"
296+
) {
297+
contractAddress = getContractAddress({
298+
from: txRequest.from!,
299+
nonce: BigNumber.from(txRequest.nonce!),
300+
});
301+
}
291302
await updateTx({
292303
pgtx,
293304
queueId: tx.id,
@@ -297,6 +308,7 @@ export const processTx = async () => {
297308
res: txRequest,
298309
sentAt: new Date(),
299310
sentAtBlockNumber: sentAtBlockNumber!,
311+
deployedContractAddress: contractAddress,
300312
},
301313
});
302314
reportUsageForQueueIds.push({

0 commit comments

Comments
 (0)