2020-04-16 23:19:03 +03:00
|
|
|
// https://etherscan.io/tx/0xd0c3c92c94e05bc71256055ce8c4c993e047f04e04f3283a04e4cb077b71f6c6
|
|
|
|
const blockNumberHalfDuplexDisabled = 9884448
|
2019-12-19 12:39:41 +03:00
|
|
|
|
|
|
|
/**
|
2020-04-16 23:19:03 +03:00
|
|
|
* Returns true if the event was before the bridge stopped supporting half duplex transfers.
|
2019-12-19 12:39:41 +03:00
|
|
|
*/
|
2020-04-16 23:19:03 +03:00
|
|
|
async function transferBeforeES(event) {
|
|
|
|
return event.blockNumber < blockNumberHalfDuplexDisabled
|
2019-12-19 12:39:41 +03:00
|
|
|
}
|
|
|
|
|
2020-04-16 23:19:03 +03:00
|
|
|
async function filterTransferBeforeES(array) {
|
2019-12-19 12:39:41 +03:00
|
|
|
const newArray = []
|
|
|
|
// Iterate events from newer to older
|
|
|
|
for (let i = array.length - 1; i >= 0; i--) {
|
2020-04-16 23:19:03 +03:00
|
|
|
const beforeES = await transferBeforeES(array[i])
|
2019-12-19 12:39:41 +03:00
|
|
|
if (beforeES) {
|
|
|
|
// add element to first position so the new array will have the same order
|
|
|
|
newArray.unshift(array[i])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return newArray
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2020-04-18 21:30:38 +03:00
|
|
|
filterTransferBeforeES,
|
|
|
|
blockNumberHalfDuplexDisabled
|
2019-12-19 12:39:41 +03:00
|
|
|
}
|