Skip to content

Commit

Permalink
added add-vesting-code-hasheh.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshowlett977 committed Jun 9, 2021
1 parent 615fc26 commit b28d5cf
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 16 deletions.
46 changes: 46 additions & 0 deletions scripts/deployment/distribution/add-vesting-code-hasheh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from brownie import *

import time
import json
import csv
import math

def main():
thisNetwork = network.show_active()

# == Load config =======================================================================================================================
if thisNetwork == "development":
acct = accounts[0]
configFile = open('./scripts/contractInteraction/testnet_contracts.json')
elif thisNetwork == "testnet":
acct = accounts.load("rskdeployer")
configFile = open('./scripts/contractInteraction/testnet_contracts.json')
elif thisNetwork == "rsk-mainnet":
acct = accounts.load("rskdeployer")
configFile = open('./scripts/contractInteraction/mainnet_contracts.json')
else:
raise Exception("network not supported")

# load deployed contracts addresses
contracts = json.load(configFile)

balanceBefore = acct.balance()

# vesting: 0xb77d1aB6a498cDFE3Da422c23A7d90b531865a1F, codeHash: 0x846dfde806e34011ccb73e59643fcaaa4543af5ed5350c12faeacd260422fc0c
# vesting: 0xc96333eB5f715a0d813909Ed1083EF13424cffBF, codeHash: 0x4f2529e8f3c89a8fea3bc643e4b93cc67d468e6fcecdd151c72aa9c1e3f66d9e
# vesting: 0xa8779dD47c77BDBc95437bf5dC1b885336F30D9C, codeHash: 0xef7099d548e62d7a31e6254baf6023ef0cdc40f1fd542e2a733819ed88dddfaf

vestings = ["0xb77d1aB6a498cDFE3Da422c23A7d90b531865a1F", "0xc96333eB5f715a0d813909Ed1083EF13424cffBF", "0xa8779dD47c77BDBc95437bf5dC1b885336F30D9C"]
staking = Contract.from_abi("Staking", address=contracts['Staking'], abi=Staking.abi, owner=acct)
multisig = Contract.from_abi("MultiSig", address=contracts['multisig'], abi=MultiSigWallet.abi, owner=acct)

for vesting in vestings:
print(vesting)
data = staking.addContractCodeHash.encode_input(vesting)
print(data)
tx = multisig.submitTransaction(staking.address,0,data)
txId = tx.events["Submission"]["transactionId"]
print("txid",txId);

print("deployment cost:")
print((balanceBefore - acct.balance()) / 10**18)
31 changes: 15 additions & 16 deletions scripts/deployment/distribution/check_vestings_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,28 @@ def main():
# load deployed contracts addresses
contracts = json.load(configFile)

vestingRegistry = Contract.from_abi("VestingRegistry", address=contracts['VestingRegistry'], abi=VestingRegistry.abi, owner=acct)
vestingRegistry2 = Contract.from_abi("VestingRegistry", address=contracts['VestingRegistry2'], abi=VestingRegistry.abi, owner=acct)
vestingRegistry3 = Contract.from_abi("VestingRegistry", address=contracts['VestingRegistry3'], abi=VestingRegistry.abi, owner=acct)
stakingMockup = Contract.from_abi("StakingMockup", address="0xf0bd337474B63745a840C583B66808e2A0949459", abi=StakingMockup.abi, owner=acct)

registryAddresses = [contracts['VestingRegistry'], contracts['VestingRegistry2'], contracts['VestingRegistry3']]
registries = []
for i in registryAddresses:
registry = Contract.from_abi("VestingRegistry", address=i, abi=VestingRegistry.abi, owner=acct)
registries.append(registry)

data = parseFile('./scripts/deployment/distribution/token-owners-list.csv')

ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"

for teamVesting in data:
tokenOwner = teamVesting
vestingAddress = vestingRegistry.getTeamVesting(tokenOwner)
if (vestingAddress == ZERO_ADDRESS):
vestingAddress = vestingRegistry.getVesting(tokenOwner)
if (vestingAddress == ZERO_ADDRESS):
vestingAddress = vestingRegistry2.getTeamVesting(tokenOwner)
if (vestingAddress == ZERO_ADDRESS):
vestingAddress = vestingRegistry2.getVesting(tokenOwner)
if (vestingAddress == ZERO_ADDRESS):
vestingAddress = vestingRegistry3.getTeamVesting(tokenOwner)
if (vestingAddress == ZERO_ADDRESS):
vestingAddress = vestingRegistry3.getVesting(tokenOwner)

print(vestingAddress)
vestingAddress = ZERO_ADDRESS
for registry in registries:
if (vestingAddress == ZERO_ADDRESS):
vestingAddress = registry.getTeamVesting(tokenOwner)
if (vestingAddress == ZERO_ADDRESS):
vestingAddress = registry.getVesting(tokenOwner)
codeHash = stakingMockup.getCodeHash(vestingAddress)
print("vesting: " + str(vestingAddress) + ", codeHash: " + str(codeHash))

def parseFile(fileName):
print(fileName)
Expand Down
17 changes: 17 additions & 0 deletions scripts/deployment/distribution/vesting-codehash.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
vesting: 0xb77d1aB6a498cDFE3Da422c23A7d90b531865a1F, codeHash: 0x846dfde806e34011ccb73e59643fcaaa4543af5ed5350c12faeacd260422fc0c
vesting: 0xc96333eB5f715a0d813909Ed1083EF13424cffBF, codeHash: 0x4f2529e8f3c89a8fea3bc643e4b93cc67d468e6fcecdd151c72aa9c1e3f66d9e
vesting: 0xa8779dD47c77BDBc95437bf5dC1b885336F30D9C, codeHash: 0xef7099d548e62d7a31e6254baf6023ef0cdc40f1fd542e2a733819ed88dddfaf


vesting: 0x466D1503d338D448EA0dBF236061CA8aAD941e2C, codeHash: 0x846dfde806e34011ccb73e59643fcaaa4543af5ed5350c12faeacd260422fc0c
vesting: 0xD4BaA26Dd9FC0a3D62Db7c8A8cb2872268d58019, codeHash: 0x846dfde806e34011ccb73e59643fcaaa4543af5ed5350c12faeacd260422fc0c
vesting: 0x3330C1dE5ED7ec70aBB2A1Dd519A53F93B14037A, codeHash: 0x846dfde806e34011ccb73e59643fcaaa4543af5ed5350c12faeacd260422fc0c
vesting: 0xB943F2194977ADa97Ef85c9784821b4C38a6d65B, codeHash: 0x846dfde806e34011ccb73e59643fcaaa4543af5ed5350c12faeacd260422fc0c
vesting: 0xAB201F26d72B6B864Cb65cD8ed21A00FEf35148F, codeHash: 0x846dfde806e34011ccb73e59643fcaaa4543af5ed5350c12faeacd260422fc0c

vesting: 0x20B5CF254776cEd6eee76B692A7Ca9178b2cE3C6, codeHash: 0x4f2529e8f3c89a8fea3bc643e4b93cc67d468e6fcecdd151c72aa9c1e3f66d9e
vesting: 0xFD473cB40e4A6a73De6Ce9f0C311Cb7a2cA64454, codeHash: 0x4f2529e8f3c89a8fea3bc643e4b93cc67d468e6fcecdd151c72aa9c1e3f66d9e
vesting: 0xd5f72E163902b8e9Db61387C0A7ce2847E2E02fd, codeHash: 0x4f2529e8f3c89a8fea3bc643e4b93cc67d468e6fcecdd151c72aa9c1e3f66d9e
vesting: 0xF68E6eD84443EB0405E05EBB5038d70922BDbf72, codeHash: 0x4f2529e8f3c89a8fea3bc643e4b93cc67d468e6fcecdd151c72aa9c1e3f66d9e

vesting: 0xb914e8385359931d7c8178Dbbb43C24971d12433, codeHash: 0xef7099d548e62d7a31e6254baf6023ef0cdc40f1fd542e2a733819ed88dddfaf

0 comments on commit b28d5cf

Please sign in to comment.