Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Attribute Metatxn calldata (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
dekz authored Jun 4, 2020
1 parent 28e1214 commit a756ad5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/handlers/meta_transaction_handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export class MetaTransactionHandlers {
}
public async submitZeroExTransactionIfWhitelistedAsync(req: express.Request, res: express.Response): Promise<void> {
const apiKey = req.header('0x-api-key');
const affiliateAddress = req.query.affiliateAddress as string | undefined;
if (apiKey !== undefined && !isValidUUID(apiKey)) {
res.status(HttpStatus.BAD_REQUEST).send({
code: GeneralErrorCodes.InvalidAPIKey,
Expand Down Expand Up @@ -237,6 +238,7 @@ export class MetaTransactionHandlers {
zeroExTransaction,
signature,
protocolFee,
affiliateAddress,
);
res.status(HttpStatus.OK).send({
ethereumTransactionHash,
Expand Down
11 changes: 8 additions & 3 deletions src/services/meta_transaction_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,20 @@ export class MetaTransactionService {
zeroExTransaction: ZeroExTransactionWithoutDomain,
signature: string,
protocolFee: BigNumber,
affiliateAddress?: string,
): Promise<PostTransactionResponse> {
const data = serviceUtils.attributeCallData(
this._contractWrappers.exchange
.executeTransaction(zeroExTransaction, signature)
.getABIEncodedTransactionData(),
affiliateAddress,
);
const transactionEntity = TransactionEntity.make({
refHash: zeroExTransactionHash,
status: TransactionStates.Unsubmitted,
takerAddress: zeroExTransaction.signerAddress,
to: this._contractWrappers.exchange.address,
data: this._contractWrappers.exchange
.executeTransaction(zeroExTransaction, signature)
.getABIEncodedTransactionData(),
data,
value: protocolFee,
gasPrice: zeroExTransaction.gasPrice,
expectedMinedInSec: META_TXN_RELAY_EXPECTED_MINED_SEC,
Expand Down

0 comments on commit a756ad5

Please sign in to comment.