mirror of
https://github.com/Instadapp/Forta-Agents.git
synced 2024-07-29 21:47:22 +00:00
Merge pull request #1 from Instadapp/feat/show-dsa-address
checking transactions to/from dsa
This commit is contained in:
commit
ba88d00251
|
@ -26,4 +26,4 @@ npm start
|
|||
For verifying agent behaviour with transactions -
|
||||
```
|
||||
npm run tx <Transaction_Hash>
|
||||
``
|
||||
```
|
2
Token_Tracking_agent/publish.log
Normal file
2
Token_Tracking_agent/publish.log
Normal file
|
@ -0,0 +1,2 @@
|
|||
Thu, 02 Dec 2021 02:17:06 GMT: successfully pushed image with reference bafybeiapsyqgp2cgimwxsl4djbtd3opwym2gz5d7zraedl2mftdodtm2ci@sha256:c64dec59e9d46d2d93bb00fb579f8b7b2019038e156e4507297d0269916fcdfd
|
||||
Sat, 04 Dec 2021 09:58:23 GMT: successfully pushed image with reference bafybeiempcyy6x3m7h7cwotf6knwegqzpxdwybd4ie652oenzne6uuzq2e@sha256:eaf45f1698e54b90c09ebddb6c58e754a6da8c62ed894b9463077695cc92fced
|
|
@ -41,14 +41,35 @@ function provideHandleTransaction(amountThreshold) {
|
|||
const to = tokenTransfer.args.to;
|
||||
const from = tokenTransfer.args.from;
|
||||
|
||||
|
||||
const from_account = await instaList.accountID(from)
|
||||
const to_account = await instaList.accountID(to)
|
||||
|
||||
const from_account_id = from_account.toNumber();
|
||||
const to_account_id = to_account.toNumber();
|
||||
|
||||
// Not a dsa address if account_id is 0
|
||||
if (from_account_id == 0 && to_account_id == 0) {
|
||||
|
||||
let is_dsa_from = false;
|
||||
let is_dsa_to = false;
|
||||
|
||||
// address is dsa address if account_id is not 0
|
||||
let write_dsa_from = "";
|
||||
let write_dsa_to = "";
|
||||
|
||||
let check_dsa;
|
||||
|
||||
if (from_account_id != 0) {
|
||||
is_dsa_from = true;
|
||||
write_dsa_from = "(dsa)";
|
||||
check_dsa = "from a dsa";
|
||||
}
|
||||
if (to_account_id != 0) {
|
||||
is_dsa_to = true;
|
||||
write_dsa_to = "(dsa)";
|
||||
check_dsa = "to a dsa";
|
||||
}
|
||||
|
||||
if (is_dsa_from == false && is_dsa_to == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -61,16 +82,17 @@ function provideHandleTransaction(amountThreshold) {
|
|||
|
||||
const formattedAmount = amount.toFixed(2);
|
||||
|
||||
|
||||
findings.push(
|
||||
Finding.fromObject({
|
||||
name: `Large ${tokens[token].name} Transfer`,
|
||||
description: `${formattedAmount} ${tokens[token].name} Transferred`,
|
||||
description: `${formattedAmount} ${tokens[token].name} transferred ${check_dsa}`,
|
||||
alertId: "INST-41",
|
||||
severity: FindingSeverity.Info,
|
||||
type: FindingType.Info,
|
||||
metadata: {
|
||||
from: tokenTransfer.args.from,
|
||||
to: tokenTransfer.args.to,
|
||||
from: from.concat(write_dsa_from),
|
||||
to: to.concat(write_dsa_to),
|
||||
amount: formattedAmount,
|
||||
},
|
||||
})
|
||||
|
|
|
@ -73,12 +73,12 @@ describe("large transfer event agent", () => {
|
|||
expect(findings).toStrictEqual([
|
||||
Finding.fromObject({
|
||||
name: "Large DAI Transfer",
|
||||
description: `${formattedAmount} DAI Transferred`,
|
||||
description: `${formattedAmount} DAI transferred from a dsa address`,
|
||||
alertId: "INST-41",
|
||||
severity: FindingSeverity.Info,
|
||||
type: FindingType.Info,
|
||||
metadata: {
|
||||
from: mockDaiTransferEvent.args.from,
|
||||
from: mockDaiTransferEvent.args.from.concat("(dsa address)"),
|
||||
to: mockDaiTransferEvent.args.to,
|
||||
amount: formattedAmount,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user