Search…
Polygon

PolygonTransfers

PolygonTransfers Stream represents all possible native cryptocurrency (MATIC) transfers with positive (> 0) value.
Stream type
{
from: address'matic',
to: address'matic',
value: int256,
op: string,
transaction: {
gasUsed: int256,
gasLimit: int256,
gasPrice: int256,
fee: int256,
origin: address'matic',
nonce: int256,
index: int256,
hash: string,
blockHash: string,
balanceChange: {
senderBalanceBefore: int256,
senderBalanceAfter: int256,
receiverBalanceBefore: int256,
receiverBalanceAfter: int256,
}
},
block: {
number: int256,
hash: string,
parentHash: string,
coinbase: address'matic',
difficulty: int256,
timestamp: int256,
header: {
gasUsed: int256,
nonce: int256,
sha3Uncles: string,
extraData: string,
mixHash: string,
stateRoot: string,
logsBloom: string,
transactionsRoot: string,
receiptsRoot: string
},
rewards: {
value: {
beneficiary: address'matic',
reward: int256
}
}
}
}

Code Samples

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

PolygonErc20Transfers

PolygonErc20Transfers Stream represents all supported Polygon based ERC20 Token transfers with positive (> 0) value.
Stream type
{
from: address'matic',
to: address'matic',
value: int256,
token: {
verified: boolean,
name: string,
symbol: string,
contract: address'matic',
decimals: int256
},
transaction: {
gasUsed: int256,
gasLimit: int256,
gasPrice: int256,
fee: int256,
origin: address'matic',
nonce: int256,
index: int256,
hash: string,
blockHash: string
},
block: {
number: int256,
hash: string,
parentHash: string,
coinbase: address'matic',
difficulty: int256,
timestamp: int256,
header: {
gasUsed: int256,
nonce: int256,
sha3Uncles: string,
extraData: string,
mixHash: string,
stateRoot: string,
logsBloom: string,
transactionsRoot: string,
receiptsRoot: string
},
rewards: [
{
value: {
beneficiary: address'matic',
reward: int256
}
}
]
}
}

Code Samples

This example will monitor every transfer of all tokens on one address
stream _
from PolygonErc20Transfers
where @from == MATIC.address("0xAddress")
|| @to == MATIC.address("0xAddress")
process
let decimals = @token.decimals
let symbol = @token.symbol
emit { @from, @to, @value, decimals, symbol }
end
To monitor transfers of only one ERC20 token on an address, you should add a condition like this
stream _
from PolygonErc20Transfers
where @from == MATIC.address("0xAddress")
|| @to == MATIC.address("0xAddress")
process
let decimals = @token.decimals
let symbol = @token.symbol
if @token.symbol == "TEST" then
emit { @from, @to, @value, decimals, symbol }
end
end

PolygonErc721Transfers

PolygonErc721Transfers Stream represents all supported Polygon based ERC20 Token (NFT) transfers with positive (> 0) value.

Stream Type

{
from: address'matic',
to: address'matic',
transaction: {
gasUsed: int256,
gasLimit: int256,
gasPrice: int256,
fee: int256,
origin: address'matic',
nonce: int256,
index: int256,
hash: string,
blockHash: string
},
block: {
number: int256,
hash: string,
parentHash: string,
coinbase: address'matic',
difficulty: int256,
timestamp: int256,
header: {
gasUsed: int256,
nonce: int256,
sha3Uncles: string,
extraData: string,
mixHash: string,
stateRoot: string,
logsBloom: string,
transactionsRoot: string,
receiptsRoot: string
},
rewards: [
{
value: {
beneficiary: address'matic',
reward: int256
}
}
],
token: {
id: int256,
name: string,
symbol: string,
contract: address'matic',
verified: boolean
}
}

Code Samples

For NFT minting, you can see what the code should be like on Code Samples page

PolygonErc1155Transfers

PolygonErc1155Transfers includes transfers of ERC-1155 token standards, which are NFTs and tokens.

Stream type

{
from: address'matic',
to: address'matic',
operator: address'matic',
token: {
name: string,
symbol: string,
contract: address'matic',
tokenId: int256,
value: int256,
verified: boolean
},
transaction: {
gasUsed: int256,
gasLimit: int256,
gasPrice: int256,
fee: int256,
origin: address'matic',
nonce: int256,
index: int256,
hash: string,
blockHash: string
},
block: {
number: int256,
hash: string,
parentHash: string,
coinbase: address'matic',
difficulty: int256,
timestamp: int256,
header: {
gasUsed: int256,
nonce: int256,
sha3Uncles: string,
extraData: string,
mixHash: string,
stateRoot: string,
logsBloom: string,
transactionsRoot: string,
receiptsRoot: string
},
rewards: {
value: {
beneficiary: address'matic',
reward: int256
}
}
}
}