Polygon
The ERC-721 (NFTs) support will be coming soon!
The Polygon User Defined Stream (ABI) support will be coming soon!

PolygonTransfers

PolygonTransfers Stream represents all possible native cryptocurrency (MATIC) transfers with positive (> 0) value.
Stream type
1
{
2
from: address'matic',
3
to: address'matic',
4
value: int256,
5
op: string,
6
transaction: {
7
gasUsed: int256,
8
gasLimit: int256,
9
gasPrice: int256,
10
fee: int256,
11
origin: address'matic',
12
nonce: int256,
13
index: int256,
14
hash: string,
15
blockHash: string,
16
balanceChange: {
17
senderBalanceBefore: int256,
18
senderBalanceAfter: int256,
19
receiverBalanceBefore: int256,
20
receiverBalanceAfter: int256,
21
}
22
},
23
block: {
24
number: int256,
25
hash: string,
26
parentHash: string,
27
coinbase: address'matic',
28
difficulty: int256,
29
timestamp: int256,
30
header: {
31
gasUsed: int256,
32
nonce: int256,
33
sha3Uncles: string,
34
extraData: string,
35
mixHash: string,
36
stateRoot: string,
37
logsBloom: string,
38
transactionsRoot: string,
39
receiptsRoot: string
40
},
41
rewards: {
42
value: {
43
beneficiary: address'matic',
44
reward: int256
45
}
46
}
47
}
48
}
Copied!

Code Samples

This simple code will monitor native (MATIC) withdrawals and deposits on a single address.
1
stream _
2
from PolygonTransfers
3
where @to == MATIC.address("0xAddress")
4
|| @from == MATIC.address("0xAddress")
5
​
6
process
7
emit { @from, @to, @value }
8
end
Copied!
​
This code will send a notification to a user when more than 1 MATIC were withdrawn from an address.
1
stream _
2
from PolygonTransfers
3
where @from == MATIC.address("0xAddress")
4
​
5
process
6
if @value >= 1000000000000000000 then
7
emit { @from, @to, @value }
8
end
9
10
end
Copied!

PolygonErc20Transfers

PolygonErc20Transfers Stream represents all supported Polygon based ERC20 Token transfers with positive (> 0) value.
Stream type
1
{
2
from: address'matic',
3
to: address'matic',
4
value: int256,
5
token: {
6
verified: boolean,
7
name: string,
8
symbol: string,
9
contract: address'matic',
10
decimals: int256
11
},
12
transaction: {
13
gasUsed: int256,
14
gasLimit: int256,
15
gasPrice: int256,
16
fee: int256,
17
origin: address'matic',
18
nonce: int256,
19
index: int256,
20
hash: string,
21
blockHash: string
22
},
23
block: {
24
number: int256,
25
hash: string,
26
parentHash: string,
27
coinbase: address'matic',
28
difficulty: int256,
29
timestamp: int256,
30
header: {
31
gasUsed: int256,
32
nonce: int256,
33
sha3Uncles: string,
34
extraData: string,
35
mixHash: string,
36
stateRoot: string,
37
logsBloom: string,
38
transactionsRoot: string,
39
receiptsRoot: string
40
},
41
rewards: [
42
{
43
value: {
44
beneficiary: address'matic',
45
reward: int256
46
}
47
}
48
]
49
}
50
}
Copied!

Code Samples

This example will monitor every transfer of all tokens on one address
1
stream _
2
from PolygonErc20Transfers
3
where @from == MATIC.address("0xAddress")
4
|| @to == MATIC.address("0xAddress")
5
​
6
process
7
let decimals = @token.decimals
8
let symbol = @token.symbol
9
emit { @from, @to, @value, decimals, symbol }
10
end
Copied!
​
To monitor transfers of only one ERC20 token on an address, you should add a condition like this
1
stream _
2
from PolygonErc20Transfers
3
where @from == MATIC.address("0xAddress")
4
|| @to == MATIC.address("0xAddress")
5
​
6
process
7
​
8
let decimals = @token.decimals
9
let symbol = @token.symbol
10
11
if @token.symbol == "TEST" then
12
emit { @from, @to, @value, decimals, symbol }
13
end
14
15
end
Copied!
Last modified 11d ago