Skip to content

Commit 65462a4

Browse files
authored
Disable Passive and Predictoor OCEAN distribution (#796)
* Remove dispense predictoor OCEAN flow * Remove do_fund_predictoor_ocean_dispenser * Remove the transfer funds part from dispense_passive * Update cron to run at 00:10 * Update workflow and job name * Remove dispense_passive * Run checkpoint on Friday 00:10 * Remove other references of dispense passive * Black * Remove unused imports * Update checkpoint_feedist.yml * Checkpoint on friday
1 parent 7dfebac commit 65462a4

9 files changed

Lines changed: 3 additions & 305 deletions

File tree

.github/workflows/checkpoint_feedist.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Checkpoint FeeDistributor
33
on:
44
schedule:
55
- cron: "0 0 * * 4"
6+
- cron: "10 0 * * 5"
67
workflow_dispatch:
78

89
jobs:

.github/workflows/dispense_passive.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.github/workflows/dispense_predictoor_ocean.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ Now, you can use those networks simply by specifying a different chainid in `dft
140140

141141
Happens via regularly-scheduled Github Actions:
142142

143-
- Passive: [dispense_passive.yml](.github/workflows/dispense_passive.yml)
144143
- Active: [flow.yml](.github/workflows/flow.yml)
145144

146145
More info: [README-crons-ops.md](README-crons-ops.md)

df_py/util/dftool_arguments.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
dftool predictoor_data START_DATE END_DATE CSV_DIR CHAINID --RETRIES
2828
dftool calc volume|predictoor CSV_DIR TOT_OCEAN START_DATE - from stakes/etc csvs (or predictoor/volume data csvs), output rewards
2929
dftool dispense_active CSV_DIR CHAINID --DFREWARDS_ADDR --TOKEN_ADDR --BATCH_NBR - from rewards, dispense funds
30-
dftool dispense_passive CHAINID AMOUNT
3130
dftool nftinfo CSV_DIR CHAINID -- Query chain, output nft info csv
3231
3332
dftool new_acct - generate new account

df_py/util/dftool_module.py

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
)
5555
from df_py.util.retry import retry_function
5656
from df_py.util.vesting_schedule import (
57-
get_active_reward_amount_for_week_eth,
5857
get_active_reward_amount_for_week_eth_by_stream,
5958
)
6059
from df_py.volume import csvs, queries
@@ -936,76 +935,6 @@ def do_chain_info():
936935
print(f" # blocks: {block_number}")
937936

938937

939-
# ========================================================================
940-
@enforce_types
941-
def do_dispense_passive():
942-
parser = argparse.ArgumentParser(description="Dispense passive rewards")
943-
parser.add_argument("command", choices=["dispense_passive"])
944-
parser.add_argument("CHAINID", type=chain_type, help=CHAINID_EXAMPLES)
945-
parser.add_argument(
946-
"AMOUNT",
947-
type=float,
948-
help="total amount of TOKEN to distribute (decimal, not wei)",
949-
)
950-
parser.add_argument(
951-
"ST", type=valid_date_and_convert, help="week start date -- YYYY-MM-DD"
952-
)
953-
954-
arguments = parser.parse_args()
955-
print_arguments(arguments)
956-
957-
ADDRESS_FILE = _getAddressEnvvarOrExit()
958-
record_deployed_contracts(ADDRESS_FILE, arguments.CHAINID)
959-
960-
amount = arguments.AMOUNT
961-
962-
if amount == 0:
963-
start_date = arguments.ST
964-
amount = get_active_reward_amount_for_week_eth(start_date)
965-
966-
feedist = FeeDistributor(arguments.CHAINID)
967-
OCEAN = OCEAN_token(arguments.CHAINID)
968-
web3 = networkutil.chain_id_to_web3(arguments.CHAINID)
969-
retry_function(dispense.dispense_passive, 3, 60, web3, OCEAN, feedist, amount)
970-
971-
print("Dispensed passive rewards")
972-
973-
974-
# ========================================================================
975-
976-
977-
@enforce_types
978-
def do_fund_predictoor_ocean_dispenser():
979-
parser = argparse.ArgumentParser(description="Dispense predictoor rewards")
980-
parser.add_argument("command", choices=["fund_predictoor_ocean_dispenser"])
981-
parser.add_argument("CHAINID", type=chain_type, help=CHAINID_EXAMPLES)
982-
parser.add_argument("RECEIVER", type=str, help="Receiver address")
983-
parser.add_argument(
984-
"ST", type=valid_date_and_convert, help="week start date -- YYYY-MM-DD"
985-
)
986-
arguments = parser.parse_args()
987-
print_arguments(arguments)
988-
ADDRESS_FILE = _getAddressEnvvarOrExit()
989-
record_deployed_contracts(ADDRESS_FILE, arguments.CHAINID)
990-
991-
OCEAN = OCEAN_token(arguments.CHAINID)
992-
web3 = networkutil.chain_id_to_web3(arguments.CHAINID)
993-
994-
predictoor_budget_week = get_active_reward_amount_for_week_eth_by_stream(
995-
arguments.ST, "predictoor", arguments.CHAINID
996-
)
997-
998-
retry_function(
999-
dispense.multisig_transfer_tokens,
1000-
3,
1001-
60,
1002-
web3,
1003-
OCEAN,
1004-
arguments.RECEIVER,
1005-
predictoor_budget_week,
1006-
)
1007-
1008-
1009938
# ========================================================================
1010939
@enforce_types
1011940
def do_calculate_passive():

df_py/util/dispense.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22

33
# pylint: disable=logging-fstring-interpolation
4-
from typing import Dict, Optional, Union
4+
from typing import Dict, Optional
55

66
from enforce_typing import enforce_types
77
from web3.main import Web3
@@ -137,27 +137,6 @@ def approveAmt(amt):
137137
logger.info("dispense: done")
138138

139139

140-
@enforce_types
141-
def dispense_passive(web3, ocean, feedistributor, amount: Union[float, int]):
142-
amount_wei = to_wei(amount)
143-
transfer_data = ocean.contract.encodeABI(
144-
fn_name="transfer", args=[feedistributor.address, amount_wei]
145-
)
146-
147-
checkpoint_total_supply_data = feedistributor.contract.encodeABI(
148-
fn_name="checkpoint_total_supply"
149-
)
150-
checkpoint_token_data = feedistributor.contract.encodeABI(
151-
fn_name="checkpoint_token"
152-
)
153-
154-
multisig_addr = chain_id_to_multisig_addr(web3.eth.chain_id)
155-
send_multisig_tx(multisig_addr, web3, ocean.address, 0, transfer_data)
156-
157-
for data in [checkpoint_total_supply_data, checkpoint_token_data]:
158-
send_multisig_tx(multisig_addr, web3, feedistributor.address, 0, data)
159-
160-
161140
@enforce_types
162141
def multisig_transfer_tokens(web3, ocean, receiver_address, amount):
163142
amount_wei = to_wei(amount)

df_py/util/test/test_dftool_ganache.py

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import pytest
99
from enforce_typing import enforce_types
10-
from web3.main import Web3
1110

1211
from df_py.predictoor.csvs import (
1312
load_predictoor_data_csv,
@@ -19,12 +18,10 @@
1918
)
2019
from df_py.predictoor.models import PredictContract
2120
from df_py.predictoor.predictoor_testutil import create_mock_responses
22-
from df_py.util import dftool_module, dispense, networkutil, oceantestutil, oceanutil
21+
from df_py.util import dftool_module, networkutil, oceantestutil, oceanutil
2322
from df_py.util.base18 import from_wei, to_wei
24-
from df_py.util.constants import PREDICTOOR_OCEAN_BUDGET
2523
from df_py.util.contract_base import ContractBase
2624
from df_py.util.dftool_module import do_predictoor_data
27-
from df_py.util.oceanutil import FeeDistributor, OCEAN_token
2825
from df_py.volume import csvs
2926

3027
PREV, DFTOOL_ACCT = {}, None
@@ -716,52 +713,6 @@ def test_chain_info():
716713
dftool_module.do_chain_info()
717714

718715

719-
def test_dispense_passive():
720-
sys_argv = [
721-
"dftool",
722-
"dispense_passive",
723-
str(networkutil.DEV_CHAINID),
724-
"0",
725-
"2023-02-02",
726-
]
727-
728-
with patch.object(dftool_module, "retry_function") as mock:
729-
with sysargs_context(sys_argv):
730-
dftool_module.do_dispense_passive()
731-
732-
# pylint: disable=comparison-with-callable
733-
assert mock.call_args[0][0] == dispense.dispense_passive
734-
assert isinstance(mock.call_args[0][3], Web3)
735-
assert mock.call_args[0][4].name() == "Ocean Token"
736-
assert mock.call_args[0][4].address == OCEAN_token(networkutil.DEV_CHAINID).address
737-
assert (
738-
mock.call_args[0][5].address == FeeDistributor(networkutil.DEV_CHAINID).address
739-
)
740-
assert mock.call_args[0][6] == 0
741-
742-
743-
def test_dispense_predictoor():
744-
sys_argv = [
745-
"dftool",
746-
"fund_predictoor_ocean_dispenser",
747-
str(networkutil.DEV_CHAINID),
748-
"0x0000000000000000000000000000000000000001",
749-
"2023-11-20",
750-
]
751-
752-
with patch.object(dftool_module, "retry_function") as mock:
753-
with sysargs_context(sys_argv):
754-
dftool_module.do_fund_predictoor_ocean_dispenser()
755-
756-
# pylint: disable=comparison-with-callable
757-
assert mock.call_args[0][0] == dispense.multisig_transfer_tokens
758-
assert isinstance(mock.call_args[0][3], Web3)
759-
assert mock.call_args[0][4].name() == "Ocean Token"
760-
assert mock.call_args[0][4].address == OCEAN_token(networkutil.DEV_CHAINID).address
761-
assert mock.call_args[0][5] == "0x0000000000000000000000000000000000000001"
762-
assert mock.call_args[0][6] == PREDICTOOR_OCEAN_BUDGET
763-
764-
765716
@enforce_types
766717
def setup_function():
767718
global DFTOOL_ACCT

df_py/util/test/test_dispense.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,6 @@ def test_batch_number(w3):
9898
assert df_rewards.claimable(accounts[batch_size + 2], token.address) == 0
9999

100100

101-
def test_dispense_passive(w3):
102-
fee_distributor = oceanutil.FeeDistributor(networkutil.DEV_CHAINID)
103-
OCEAN = oceanutil.OCEAN_token(networkutil.DEV_CHAINID)
104-
with patch("df_py.util.dispense.chain_id_to_multisig_addr"):
105-
with patch("df_py.util.dispense.send_multisig_tx") as mock:
106-
dispense.dispense_passive(w3, OCEAN, fee_distributor, 1)
107-
108-
assert mock.call_count == 3
109-
110-
111101
def test_multisig_transfer_tokens(w3):
112102
OCEAN = oceanutil.OCEAN_token(networkutil.DEV_CHAINID)
113103
with patch("df_py.util.dispense.chain_id_to_multisig_addr"):

0 commit comments

Comments
 (0)