def main(): user = accounts.load('box') boxId = 1 # NEEDS TO BE CHANGED IF SCRIPT CRASHES offset = 79 box = NFTBoxesBox.at('0x5f8061f9d6a2bb4688f46491cca7658e214e2cb6') dissArr = [] ids = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] # this line would be ids = [1, 2, 3, 4, 5, 6, 7] and be changed each month with open(f'boxHolders_{boxId}.csv') as csvfile: reader = csv.reader(csvfile) for row in reader: dissArr.append(row) batchSize = 20 // len(dissArr[0]) loops = len(dissArr) // batchSize + (1 if len(dissArr) % batchSize > 0 else 0) print(f'Batch size: {batchSize} - loops: {loops}') for i in range(offset, loops): print(f'Sending batch #{i + 1} out of {loops}') if i == loops - 1: print(f'range[{i * batchSize}:end]') users = dissArr[i * batchSize:] else: print(f'range[{i * batchSize}:{(i + 1) * batchSize}]') users = dissArr[i * batchSize:(i + 1) * batchSize] box.distributeOffchain(boxId, users, ids, { 'from': user, 'gas_price': '145 gwei' })
def main(): user = accounts.load('moist') boxId = 1 # NEEDS TO BE CHANGED IF SCRIPTS F***S UP offset = 0 box = NFTBoxesBox.at('0xB9134aef577b7cb43B03856E308ebDC80d51E126') dissArr = [] ids = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] # this line would be ids = [1, 2, 3, 4, 5, 6, 7] and be changed each month with open(f'boxHolders_{boxId}.csv') as csvfile: reader = csv.reader(csvfile) for row in reader: dissArr.append(row) batchSize = 50 // len(dissArr[0]) loops = len(dissArr) // batchSize + (1 if len(dissArr) % batchSize > 0 else 0) print(f'Batch size: {batchSize} - loops: {loops}') for i in range(offset, loops): print(f'Sending batch #{i + 1} out of {loops}') if i == loops - 1: print(f'range[{i * batchSize}:end]') users = dissArr[i * batchSize:] else: print(f'range[{i * batchSize}:{(i + 1) * batchSize}]') users = dissArr[i * batchSize:(i + 1) * batchSize] box.distributeOffchain(boxId, users, ids, {'from': user})
def main(): user = accounts.load('moist') box = NFTBoxesBox.deploy({'from': user}, publish_source=False) box.setCaller(user, True, {'from': user}) box.setCaller('0x63a9dbCe75413036B2B778E670aaBd4493aAF9F3', True, {'from': user}) artists = [ '0xca2b6756486E598580792CC5C0A27F13D57E630f', '0x576a655161B5502dCf40602BE1f3519A89b71658', '0x707611854951352F9Fda16D6b5162b299112Dfba', '0xa8E376248FB85dD9680FdbeEcC3ec72e20C37CAc', '0x7535Da202d79cA57299918c60C218f9b779AA14c', '0x84300dCc7ca9Cf447e886fA17C11fa22557d1AF0', '0x7485ac6d8534691993348D51ab0F131a19FfF763' ] artist_shares = [200, 20, 20, 20, 40, 20, 20] box.createBoxMould(500, 5, '0.5 ether', artists, artist_shares, 'Genesis Box', 'Main', 'Innovators', 'QmNSWXCtpk8YEZWUcp5X9yFYXyRJbCbm5FCRJvZyvK29sy', 'bSFksvslqiyEGj7ABWOUkx2wJZkkrSca5Puts3CTFYc', {'from': user}) box.transferOwnership('0xAd67593b01385792CA671ABe6d975801c2e86D22', {'from': user})
def main(): user = accounts.load('box') boxId = 3 # NEEDS TO BE CHANGED IF SCRIPT CRASHES offset = 0 box = NFTBoxesBox.at('0xf876bBc810E84854C9C37018103C0045544a6Af9') dissArr = [] ids = [ 17, 18, 19, 20, 21, 22, 23, 24, 25 ] # this line would be ids = [1, 2, 3, 4, 5, 6, 7] and be changed each month with open(f'boxHolders_{boxId}.csv') as csvfile: reader = csv.reader(csvfile) for row in reader: dissArr.append(row) batchSize = 18 // len(dissArr[0]) loops = len(dissArr) // batchSize + (1 if len(dissArr) % batchSize > 0 else 0) print(f'Batch size: {batchSize} - loops: {loops}') for i in range(offset, loops): print(f'Sending batch #{i + 1} out of {loops}') if i == loops - 1: print(f'range[{i * batchSize}:end]') users = dissArr[i * batchSize:] else: print(f'range[{i * batchSize}:{(i + 1) * batchSize}]') users = dissArr[i * batchSize:(i + 1) * batchSize] box.distributeOffchain(boxId, users, ids, { 'from': user, 'gas_price': '125 gwei' })
def main(): boxId = 4 seedOffset = 0 nonMint = True fileName = f'boxHolders_{boxId}_1.csv' seedStr = '0x54279ad7faff7f0ff1322f048798a80f987c394899e5a0a146e5415f4ad40d0a' byteSeed = web3.toBytes(hexstr=seedStr) seed = web3.soliditySha3(['bytes32'], [byteSeed]) seedInt = web3.toInt(seed) if seedOffset > 0: (seed, seedInt) = offsetSeed(seed, seedOffset, web3) box = NFTBoxesBox.at('0xf876bBc810E84854C9C37018103C0045544a6Af9') print(f'Box contract at {box.address}\nFetching holders of box edition {boxId}...') ids = 8 box_contract = web3.eth.contract(address=box.address, abi=box.abi) filt = box_contract.events.BoxBought.createFilter(fromBlock=0, toBlock= 'latest', argument_filters={'boxMould':boxId}) res = filt.get_all_entries() holders = [box.ownerOf(e.args.tokenId) for e in res] print(f'Box holders fetched. Size: {len(holders)}\nExecuting distribution from initial seed: {seedStr}') dissArr = [] for i in range(ids): dissArr.append([h for h in holders]) winnerArray = [] for i in range(len(holders)): tempWinnerArray = [] for j in range(ids): indexWinner = seedInt % len(dissArr[j]) winner = dissArr[j][indexWinner] (seed, seedInt) = newSeed(seed, web3) tempWinnerArray.append(winner) dissArr[j].pop(indexWinner) winnerArray.append([w for w in tempWinnerArray]) tempWinnerArray.clear() print(f'Distribution finished, writing data onto {fileName}...') strcsv = '' for row in winnerArray: for i in range(len(row)): strcsv += row[i] if i != len(row) - 1: strcsv += ',' strcsv += '\n' file = open (fileName, 'w') file.write(strcsv) file.close() print('done')
def main(): boxId = 2 seedStr = '0x4f22a72b37e5acea8fc863522419e05e71bc9947bd0559995ee58702533bbb44' byteSeed = web3.toBytes(hexstr=seedStr) seed = web3.soliditySha3(['bytes32'], [byteSeed]) seedInt = web3.toInt(seed) box = NFTBoxesBox.at('0x067ab2FbdBED63401aF802d1DD786E6D83b0ff1B') print( f'Box contract at {box.address}\nFetching holders of box edition {boxId}...' ) ids = 6 box_contract = web3.eth.contract(address=box.address, abi=box.abi) filt = box_contract.events.BoxBought.createFilter( fromBlock=0, toBlock='latest', argument_filters={'boxMould': boxId}) res = filt.get_all_entries() holders = [box.ownerOf(e.args.tokenId) for e in res] print( f'Box holders fetched. Size: {len(holders)}\nExecuting distribution from initial seed: {seedStr}' ) dissArr = [] for i in range(ids): dissArr.append([h for h in holders]) winnerArray = [] for i in range(len(holders)): tempWinnerArray = [] for j in range(ids): indexWinner = seedInt % len(dissArr[j]) winner = dissArr[j][indexWinner] (seed, seedInt) = newSeed(seed, web3) tempWinnerArray.append(winner) dissArr[j].pop(indexWinner) winnerArray.append([w for w in tempWinnerArray]) tempWinnerArray.clear() print( f'Distribution finished, writing data onto boxHolders_{boxId}.csv...') strcsv = '' for row in winnerArray: for i in range(len(row)): strcsv += row[i] if i != len(row) - 1: strcsv += ',' strcsv += '\n' file = open(f'boxHolders_{boxId}.csv', 'w') file.write(strcsv) file.close() print('done')
def main(): boxId = 1 seedStr = '0xc63e18417049d1aed1dc4bea9f25838f3423fcd552bb316546f6b92e4979065c' byteSeed = web3.toBytes(hexstr=seedStr) seed = web3.soliditySha3(['bytes32'], [byteSeed]) seedInt = web3.toInt(seed) box = NFTBoxesBox.at('0xB9134aef577b7cb43B03856E308ebDC80d51E126') print( f'Box contract at {box.address}\nFetching holders of box edition {boxId}...' ) ids = 9 box_contract = web3.eth.contract(address=box.address, abi=box.abi) filt = box_contract.events.BoxBought.createFilter( fromBlock=0, toBlock='latest', argument_filters={'boxMould': boxId}) res = filt.get_all_entries() holders = [box.ownerOf(e.args.tokenId) for e in res] print( f'Box holders fetched. Size: {len(holders)}\nExecuting distribution from initial seed: {seedStr}' ) dissArr = [] for i in range(ids): dissArr.append([h for h in holders]) winnerArray = [] for i in range(len(holders)): tempWinnerArray = [] for j in range(ids): indexWinner = seedInt % len(dissArr[j]) winner = dissArr[j][indexWinner] (seed, seedInt) = newSeed(seed, web3) tempWinnerArray.append(winner) dissArr[j].pop(indexWinner) winnerArray.append([w for w in tempWinnerArray]) tempWinnerArray.clear() print( f'Distribution finished, writing data onto boxHolders_{boxId}.csv...') wtr = csv.writer(open(f'boxHolders_{boxId}.csv', 'w'), delimiter=',', lineterminator='\n') for x in winnerArray: wtr.writerow(x) print('done')