-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into oracle_v1pool
- Loading branch information
Showing
4 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from brownie import * | ||
|
||
import calendar | ||
import time | ||
import json | ||
|
||
def main(): | ||
thisNetwork = network.show_active() | ||
|
||
DAY = 24 * 60 * 60 | ||
TWO_WEEKS = 2 * 7 * DAY | ||
|
||
# == 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) | ||
|
||
staking = Contract.from_abi("Staking", address=contracts['Staking'], abi=Staking.abi, owner=acct) | ||
|
||
ts = calendar.timegm(time.gmtime()) | ||
lockedTS = staking.timestampToLockDate(ts) | ||
|
||
totalAmount = 0 | ||
for i in range(1, 79): | ||
lockedTS += TWO_WEEKS | ||
amount = staking.getCurrentStakedUntil(lockedTS) | ||
totalAmount += amount | ||
print(amount / 10**18) | ||
|
||
print("totalAmount: ", totalAmount / 10**18) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from brownie import * | ||
|
||
import calendar | ||
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) | ||
|
||
staking = Contract.from_abi("Staking", address=contracts['Staking'], abi=Staking.abi, owner=acct) | ||
|
||
DAY = 24 * 60 * 60 | ||
TWO_WEEKS = 2 * 7 * DAY | ||
# parse data | ||
|
||
ts = calendar.timegm(time.gmtime()) | ||
totalLockedAmount = 0 | ||
with open('./scripts/staking/processed-list.csv', 'r') as file: | ||
reader = csv.reader(file) | ||
for row in reader: | ||
user = row[0] | ||
|
||
stakes = staking.getStakes(user) | ||
stakeDates = stakes[0] | ||
stakeAmounts = stakes[1] | ||
|
||
userLockedAmount = 0 | ||
for index, value in enumerate(stakeDates): | ||
if (int(value) > ts): | ||
userLockedAmount += stakeAmounts[index] | ||
|
||
totalLockedAmount += userLockedAmount | ||
print(user + ", " + str(userLockedAmount) + ", " + str(stakeDates) + ", " + str(stakeAmounts)) |