Last active
March 8, 2022 20:50
-
-
Save JTraversa/60aee901de38ecb4e9ff41f0c6e7a69c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import math | |
from web3 import Web3 | |
_cache = dict() | |
infura = "https://mainnet.infura.io/v3/b58baa11e019484890eff1543c3dc78f" | |
polygon = "https://polygon-mainnet.infura.io/v3/150d34e9b0294313991d57ac8200160a" | |
web3 = Web3(Web3.HTTPProvider(infura)) | |
def truncate(number, digits) -> float: | |
stepper = 10.0 ** digits | |
return math.trunc(stepper * number) / stepper | |
mainnetDrop = json.load(open('mainnetDrop.json')) | |
june = json.load(open('JuneVolumeAddresses.json')) | |
march = json.load(open('MarchVolumeAddresses.json')) | |
juneVolumeAddresses = june['users'] | |
marchVolumeAddresses = march['users'] | |
userAddressVolume = [] | |
for i in mainnetDrop: | |
for x in marchVolumeAddresses: | |
if i == x: | |
volumeAddress = {i: marchVolumeAddresses[x]} | |
userAddressVolume.append(volumeAddress) | |
for x in juneVolumeAddresses: | |
if i == x: | |
if i not in userAddressVolume: | |
volumeAddress = {i: juneVolumeAddresses[x]} | |
userAddressVolume.append(volumeAddress) | |
else: | |
userAddressVolume[i] = userAddressVolume[i] + juneVolumeAddresses[x] | |
retroactiveDrop = {} | |
for i in userAddressVolume: | |
unlockNum = truncate(int(list(i.values())[0])/2500000000,0) | |
unlockAmount = unlockNum * 100 * 1e18 | |
if unlockAmount > int(mainnetDrop[list(i.keys())[0]]): | |
print('unlockAmount > retroactiveAmount') | |
print(unlockAmount/1e18) | |
print(int(mainnetDrop[list(i.keys())[0]])/1e18) | |
retroactiveDrop[list(i.keys())[0]] = Web3.toHex(int(mainnetDrop[list(i.keys())[0]])) | |
print(retroactiveDrop[list(i.keys())[0]]) | |
if unlockAmount < int(mainnetDrop[list(i.keys())[0]]): | |
if unlockAmount == 0: | |
pass | |
else: | |
print('unlockAmount < retroactiveAmount') | |
print(unlockAmount/1e18) | |
print(int(mainnetDrop[list(i.keys())[0]])/1e18) | |
retroactiveDrop[list(i.keys())[0]] = Web3.toHex(int(unlockAmount)) | |
print(retroactiveDrop[list(i.keys())[0]]) | |
if unlockAmount == int(mainnetDrop[list(i.keys())[0]]): | |
print('unlockAmount == retroactiveAmount') | |
print(unlockAmount/1e18) | |
print(int(mainnetDrop[list(i.keys())[0]])/1e18) | |
retroactiveDrop[list(i.keys())[0]] = Web3.toHex(int(unlockAmount)) | |
print(retroactiveDrop[list(i.keys())[0]]) | |
#store retroactive drop to json file | |
with open("retroactiveDrop.json", "w", encoding="utf-8") as writeJsonfile: | |
json.dump(retroactiveDrop, writeJsonfile, indent=4,default=str) | |
total = 0 | |
for i in retroactiveDrop: | |
amount = int(Web3.toInt(hexstr=retroactiveDrop[i]))/10e17 | |
print(amount) | |
total = total + amount | |
print(total) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment