Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: scripts for assoc and treasury council funding #1492

Merged
merged 7 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions helpers/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@
"ops_harvester": "0x73433896620E71f7b1C72405b8D2898e951Ca4d5",
"ops_external_harvester": "0x64E2286148Fbeba8BEb4613Ede74bAc7646B2A2B",
},
"treasury_councillors": {
"councillor1": "0xc87e98867B392BDBA50FfCfE53014226FE1fAaE7",
"councillor2": "0xae3FB0474841D69AAE9446108F41D01f11E8BeF4",
"councillor3": "0xd1911EEDf284BCD3559de6A06ef67233023e0dFe",
"councillor4": "0x33Dd3EC6CCB2736dc285bde70aADe5C45bFaD588",
"councillor5": "0x3f993093c3917Fe7A117f37cFD008775249f59c8",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, councillor1/2/3/4 address looks pretty new and with zero balance (except councillor1 receiving a transfer from CoinBase a few days ago), are they created in advance out of create2 ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, councillors created new accounts in most cases for this purpose. They are all confirmed and the transaction will be ultimately reviewed and confirmed by themselves.

},
},
# scout stores prices for all tokens here, either from coingecko or
# interpolation. any token here that does not have a coingeco price must be
Expand Down Expand Up @@ -241,6 +248,7 @@
"GRT": "0xc944E90C64B2c07662A292be6244BDf05Cda44a7",
"LIQ": "0xD82fd4D6D62f89A1E50b1db69AD19932314aa408",
"LIQLIT": "0x03C6F0Ca0363652398abfb08d154F114e61c4Ad8",
"LUSD": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0",
},
# every slp token listed in treasury tokens above must also be listed here.
# the lp_tokens in this list are processed by scount to determine holdings
Expand Down Expand Up @@ -702,6 +710,7 @@
"quest_board_veliq": "0xcbd27bf506aB5580Ef86Fe6a169449bc24Be471B",
},
},
"llamapay": "0x3E67cc2C7fFf86d9870dB9D02c43e789B52FB296",
}

ADDRESSES_IBBTC = {
Expand Down
105 changes: 105 additions & 0 deletions scripts/issue/1489/assoc_and_treasury_council_funding.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
from great_ape_safe import GreatApeSafe
from helpers.addresses import r
from brownie import accounts

# flag
PROD = False
COEF = 0.99
DEADLINE = 60 * 60 * 4

# funding figures (treasury)
TREASURY_COUNCIL_YEARLY_FUNDING = 300_000e6

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this assume USDC precision of 6?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, of course it tends to be better to fetch decimals from the source but in this case I think it is safe to hardcode.

COUNCILLOR_PAYMENT_COVERED = 2927.777777777777784336e6

# funding figure (association)
ASSOC_Q1_FUNDING_STABLES = 1_154_918
ASSOC_Q1_FUNDING_BADGER = 137_706e18

# testing
USDC_WHALE = "0xD6153F5af5679a75cC85D8974463545181f48772"


def sell_stable_for_usdc():
vault = GreatApeSafe(r.badger_wallets.treasury_vault_multisig)
vault.init_cow(prod=PROD)

# tokens
usdc = vault.contract(r.treasury_tokens.USDC)
dai = vault.contract(r.treasury_tokens.DAI)
lusd = vault.contract(r.treasury_tokens.LUSD)

# 1. sell $dai for $usdc
vault.cow.market_sell(
asset_sell=dai,
asset_buy=usdc,
mantissa_sell=ASSOC_Q1_FUNDING_STABLES * 10 ** dai.decimals(),
deadline=DEADLINE,
coef=COEF,
)

# 2. sell $lusd (full balance) for $usdc
vault.cow.market_sell(
asset_sell=lusd,
asset_buy=usdc,
mantissa_sell=lusd.balanceOf(vault),
deadline=DEADLINE,
coef=COEF,
)

vault.post_safe_tx()


def assoc_and_council_funding(sim=False):
vault = GreatApeSafe(r.badger_wallets.treasury_vault_multisig)
payments = GreatApeSafe(r.badger_wallets.payments_multisig_2024)

# tokens
usdc = vault.contract(r.treasury_tokens.USDC)
badger = vault.contract(r.treasury_tokens.BADGER)

# for testing purposes (USDC acquisition)
if sim:
usdc_whale = accounts.at(USDC_WHALE, force=True)
usdc.transfer(vault.account, 2_000_000e6, {"from": usdc_whale})

vault.take_snapshot([usdc, badger])
payments.take_snapshot([usdc, badger])

# contracts
llamapay = vault.contract(r.llamapay)

# 1. transfer funding to assoc. wallet
usdc.transfer(
payments.account,
ASSOC_Q1_FUNDING_STABLES * 10 ** usdc.decimals(),
)
badger.transfer(payments.account, ASSOC_Q1_FUNDING_BADGER)

# 2. top-up yearly funding for treasury council
usdc.approve(llamapay, TREASURY_COUNCIL_YEARLY_FUNDING)
llamapay.deposit(TREASURY_COUNCIL_YEARLY_FUNDING)
# Accounting on LlamaPay is done in 1e20 units (https://etherscan.io/address/0x3e67cc2c7fff86d9870db9d02c43e789b52fb296#code#F1#L218)
assert llamapay.balances(
vault.account
) / 1e20 == TREASURY_COUNCIL_YEARLY_FUNDING / (10 ** usdc.decimals())

# 3. transfer $usdc to councillors members for covering payment before stream initialisation this month
usdc.transfer(
r.badger_wallets.treasury_councillors.councillor1, COUNCILLOR_PAYMENT_COVERED
)
usdc.transfer(
r.badger_wallets.treasury_councillors.councillor2, COUNCILLOR_PAYMENT_COVERED
)
usdc.transfer(
r.badger_wallets.treasury_councillors.councillor3, COUNCILLOR_PAYMENT_COVERED
)
usdc.transfer(
r.badger_wallets.treasury_councillors.councillor4, COUNCILLOR_PAYMENT_COVERED
)
usdc.transfer(
r.badger_wallets.treasury_councillors.councillor5, COUNCILLOR_PAYMENT_COVERED
)

payments.print_snapshot()
vault.print_snapshot()
vault.post_safe_tx()
Loading