Skip to content

Commit

Permalink
add fraxsDAI deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Nov 10, 2023
1 parent bdab80a commit eeb3773
Showing 1 changed file with 71 additions and 29 deletions.
100 changes: 71 additions & 29 deletions scripts/deploy_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import boa
from boa.network import NetworkEnv
from deployment_utils import FIDDYDEPLOYER
from eth_account import Account
from eth_typing import Address
from rich.console import Console as RichConsole
Expand Down Expand Up @@ -93,37 +94,22 @@ class PoolSettings:


pool_settings = {
"gnosis:mainnet": {
"ethereum:mainnet": {
"plain": [
"WXDAI/USDC/USDT", # name
"3pool-ng", # symbol
"FRAXsDAI", # name
"FRAXSDAI", # symbol
[
"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d", # wxdai
"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83", # usdc
"0x4ECaBa5870353805a9F068101A40E0f32ed605C6", # usdt
"0x853d955aCEf822Db058eb8505911ED77F175b99e", # frax
"0x83F20F44975D03b1b09e64809B757c47f942BEeA", # sdai
],
1000, # A
1000000, # fee
20000000000, # offpeg_fee_multiplier
865, # ma_exp_time
0, # implementation index
[0, 0, 0], # asset_types
[b"", b"", b""], # method_ids
[ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS], # oracles
],
"meta": [
"0x7f90122bf0700f9e7e1f688fe926940e8839f353", # base_pool
"EURE/3CRV", # name
"eure3crvng", # symbol
"0xcb444e90d8198415266c6a2724b7900fb12fc56e", # eure
500, # A
1500, # A
1000000, # fee
20000000000, # offpeg_fee_multiplier
10000000000, # offpeg_fee_multiplier
865, # ma_exp_time
0, # implementation index
0, # asset_types
b"", # method_ids
ZERO_ADDRESS, # oracles
[0, 3], # asset_types
[b"", b""], # method_ids
[ZERO_ADDRESS, ZERO_ADDRESS], # oracles
],
}
}
Expand All @@ -136,14 +122,65 @@ def deploy_pool(network, url, account, pool_type, fork):
if fork:
boa.env.fork(url)
logger.log("Forkmode ...")
boa.env.eoa = "" # set eoa address here
boa.env.eoa = FIDDYDEPLOYER # set eoa address here
else:
logger.log("Prodmode ...")
boa.set_env(NetworkEnv(url))
boa.env.add_account(Account.from_key(os.environ[account]))

factory = boa.load_partial("./contracts/main/CurveStableSwapFactoryNG.vy")
factory = factory.at(deployments[network]["factory"])

logger.log("Deploying pool ...")
args = pool_settings[network][pool_type]
if pool_type == "plain":
amm_address = factory.deploy_plain_pool(*args)
elif pool_type == "meta":
amm_address = factory.deploy_metapool(*args)

logger.log(f"Deployed Plain pool {amm_address}.")

return amm_address


def deploy_gauge(network, url, account, pool_addr, fork):

logger.log(f"Deploying gauge for pool {pool_addr} on {network} ...")

if fork:
boa.env.fork(url)
logger.log("Forkmode ...")
boa.env.eoa = FIDDYDEPLOYER # set eoa address here
assert boa.env.eoa # EOA NOT SET!
else:
logger.log("Prodmode ...")
boa.set_env(NetworkEnv(url))
boa.env.add_account(Account.from_key(os.environ[account]))

factory = boa.load_partial("./contracts/main/CurveStableSwapFactoryNG.vy")
factory = factory.at(deployments[network]["factory"])

logger.log("Deploying gauge ...")
gauge_address = factory.deploy_gauge(pool_addr)

logger.log(f"Deployed Gauge {gauge_address} for pool {pool_addr}.")


def deploy_pool_and_gauge(network, url, account, pool_type, fork):

logger.log(f"Deploying pool on {network} ...")

if fork:
boa.env.fork(url)
logger.log("Forkmode ...")
boa.env.eoa = FIDDYDEPLOYER # set eoa address here
else:
logger.log("Prodmode ...")
boa.set_env(NetworkEnv(url))
boa.env.add_account(Account.from_key(os.environ[account]))

factory = boa.load_partial("./contracts/main/CurveStableSwapFactoryNG.vy")
factory = factory.at(deployments["gnosis:mainnet"]["factory"])
factory = factory.at(deployments[network]["factory"])

logger.log("Deploying pool ...")
args = pool_settings[network][pool_type]
Expand All @@ -154,10 +191,15 @@ def deploy_pool(network, url, account, pool_type, fork):

logger.log(f"Deployed Plain pool {amm_address}.")

gauge_address = factory.deploy_gauge(amm_address)

logger.log(f"Deployed Gauge {gauge_address} for pool {amm_address}.")


def main():
fork = True
deploy_pool("gnosis:mainnet", "https://gnosis.drpc.org", "FIDDYDEPLOYER", "meta", fork)

fork = False
deploy_pool_and_gauge("ethereum:mainnet", os.environ["RPC_ETHEREUM"], "FIDDYDEPLOYER", "plain", fork)


if __name__ == "__main__":
Expand Down

0 comments on commit eeb3773

Please sign in to comment.