Ejemplo n.º 1
0
def main():

    route = input("""
Choose an option:
(1) Burn an asset on Matic
(2) Withdraw an asset on Ethereum
(3) Check burn tx checkpoint
Choice: """)
    try:
        route = int(route)
    except ValueError:
        exit()

    if route == 1:
        asset = input("Input token to burn on matic: ")
        amount = int(input("Input amount of token to burn: "))
        sender = (accounts.load(input("Account name: "))
                  if input("Do you want to load an account? [y/N] ") == "y"
                  else MSG_SENDER)
        burn_asset_on_matic(asset, amount, sender)
    elif route == 2:
        burn_tx_hash = input("Input matic burn tx hash: ")
        sender = (accounts.load(input("Account name: "))
                  if input("Do you want to load an account? [y/N] ") == "y"
                  else MSG_SENDER)
        withdraw_asset_on_ethereum(burn_tx_hash, sender)
    elif route == 3:
        burn_tx_hash = input("Enter burn tx hash: ")
        bar_fmt = "Blocks Mined: {n} blocks - Time Elapsed: {elapsed}"
        for block in tqdm(chain.new_blocks(1), bar_format=bar_fmt):
            if is_burn_checkpointed(burn_tx_hash, True):
                print(
                    f"Tx {burn_tx_hash} has been checkpointed in block {block['number']}"
                )
                break
Ejemplo n.º 2
0
def get_user():
    if rpc.is_active():
        return accounts.at("0x1A6224b5ADe2C6d52d75F5d8b82197bbc61007ee",
                           force=True)
    else:
        print("Available accounts:", accounts.load())
        return accounts.load(input("account: "))
Ejemplo n.º 3
0
def get_user():
    if rpc.is_active():
        return accounts.at("0x5E38b802525de11A54506801B296D2Aa93d033EF", force=True)
    else:
        return accounts.load(
            click.prompt("Account", type=click.Choice(accounts.load()))
        )
Ejemplo n.º 4
0
def main():
    print(f"You are using the '{network.show_active()}' network")
    dev = accounts.load(
        click.prompt("Account", type=click.Choice(accounts.load())))
    print(f"You are using: 'dev' [{dev.address}]")

    if input("Is there a Vault for this strategy already? y/[N]: ").lower(
    ) == "y":
        vault = Vault.at(get_address("Deployed Vault: "))
        assert vault.apiVersion() == API_VERSION
    else:
        print("You should deploy one vault using scripts from Vault project")
        return  # TODO: Deploy one using scripts from Vault project

    print(f"""
    Strategy Parameters

       api: {API_VERSION}
     token: {vault.token()}
      name: '{vault.name()}'
    symbol: '{vault.symbol()}'
    """)
    publish_source = click.confirm("Verify source on etherscan?")
    if input("Deploy Strategy? y/[N]: ").lower() != "y":
        return

    strategy = Strategy.deploy(
        vault,
        YFIStaker,
        SushiRouter,
        YFIToken,
        BankToken,
        {"from": dev},
        publish_source=publish_source,
    )
def main():
    dai = Contract.from_explorer("0x6B175474E89094C44Da98b954EedeAC495271d0F")
    dai_deposit = Contract.from_explorer(
        "0xF6f4526a05a38198dBEddFc226d30dbb5419951F")
    dai_vault = Contract.from_explorer(
        "0xBFa4D8AA6d8a379aBFe7793399D3DdaCC5bBECBB")
    user = accounts.load(
        click.prompt("Account", type=click.Choice(accounts.load())))
    # account_name = input(f"What account to use?: ")
    # user = accounts.load(account_name)
    signer = Account.from_key(user.private_key)
    balance = dai.balanceOf(user)
    print("DAI balance:", balance.to("ether"))
    amount = click.prompt("Deposit amount", type=click.FloatRange(min=0))
    amount = min(Wei(f"{amount} ether"), balance)
    permit = build_permit(str(user), str(dai_deposit), dai)
    signed = signer.sign_message(permit)
    if click.confirm("Send transaction?"):
        dai_deposit.deposit(
            amount,
            [user, dai_deposit, 0, 0, True, signed.v, signed.r, signed.s],
            {"from": user},
        )
    vault_balance = dai_vault.balanceOf(user)
    print("yvDAI balance", vault_balance.to("ether"))
Ejemplo n.º 6
0
def main():
    print(f"You are using the '{network.show_active()}' network")
    dev = accounts.load(
        click.prompt("Account", type=click.Choice(accounts.load())))
    print(f"You are using: 'dev' [{dev.address}]")

    if input("Is there a Vault for this strategy already? y/[N]: ").lower(
    ) != "y":
        vault = Vault.at(get_address("Deployed Vault: "))
        assert vault.apiVersion() == API_VERSION
    else:
        return  # TODO: Deploy one using scripts from Vault project

    print(f"""
    Strategy Parameters

       api: {API_VERSION}
     token: {vault.token()}
      name: '{vault.name()}'
    symbol: '{vault.symbol()}'
    """)
    if input("Deploy Strategy? y/[N]: ").lower() != "y":
        return

    strategy = Strategy.deploy(vault, {"from": dev})
Ejemplo n.º 7
0
def get_user():
    if rpc.is_active():
        return accounts.at("0x751B640E0AbE005548286B5e15353Edc996DE1cb",
                           force=True)
    else:
        print("Available accounts:", accounts.load())
        return accounts.load(input("account: "))
Ejemplo n.º 8
0
def main():
    print(f"You are using the '{network.show_active()}' network")
    dev = accounts.load(
        click.prompt("Account", type=click.Choice(accounts.load())))
    print(f"You are using: 'dev' [{dev.address}]")
    token = Contract.from_explorer(get_address("Underlying token"))
    registry = get_address("Registry address,", "v2.registry.ychad.eth")

    affiliateTokenName = click.prompt(
        "Enter the token name for your affiliate token")
    affiliateTokenSymbol = click.prompt(
        "Enter the token symbol for your affiliate token")

    print(f"""
    Affiliate Token Parameters
        name: '{affiliateTokenName}'
      symbol: '{affiliateTokenSymbol}'
       token: {token.address}
    """)

    publish_source = click.confirm("Verify source on etherscan?")

    if input("Deploy Affiliate Token? y/[N]: ").lower() != "y":
        return

    affiliatetoken = AffiliateToken.deploy(
        token,
        registry,
        affiliateTokenName,
        affiliateTokenSymbol,
        {"from": dev},
        publish_source=publish_source,
    )

    print(f"Deployed {affiliatetoken}")
Ejemplo n.º 9
0
def main():
    user = accounts.load(click.prompt("Account", type=click.Choice(accounts.load())))
    gc = GaugeCleaner.deploy({"from": user})

    gov = accounts.at("0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52", force=True)
    ctrl = Contract('0x9E65Ad11b299CA0Abefc2799dDB6314Ef2d91080', owner=gov)
    token = Contract("0xb19059ebb43466C323583928285a49f558E572Fd")
    voter = Contract("0xF147b8125d2ef93FB6965Db97D6746952a133934")
    strategy = Contract(ctrl.strategies(token), owner=gov)
    gauge = Contract.from_explorer(strategy.gauge())
    
    # switch gov
    voter.setGovernance(gc, {"from": gov})

    # migrate token from gauge to vault
    gc.clear(token, {"from": gov})

    assert gauge.balanceOf(voter) == 0
    print(f"gauge balance of voter: {gauge.balanceOf(voter)}")
    assert token.balanceOf(voter) == 0
    print(f"token balance on voter: {token.balanceOf(voter)}")

    # set voter back to vault
    print(f"voter gov: {voter.governance()}")
    gc.setVoterGovernance({"from": gov})
    print(f"voter gov: {voter.governance()}")
Ejemplo n.º 10
0
def main():
    print(f"You are using the '{network.show_active()}' network")
    dev = accounts.load(
        click.prompt("Account", type=click.Choice(accounts.load())))
    print(f"You are using: 'dev' [{dev.address}]")

    osmedianizer = OSMedianizer.deploy({
        'from': dev,
        'gas_price': Wei('80 gwei')
    })
Ejemplo n.º 11
0
    def __init__(self) -> None:
        super().__init__()
        with suppress(Exception):
            from brownie import accounts

            accounts.load("alpy.json", "alper")

        # load_dotenv(dotenv_path=self.env_file)

        self.SLURMUSER = self.cfg["provider"]["slurmuser"]
        self.GDRIVE = self.cfg["gdrive"]
        self.DATADIR = Path(self.cfg["datadir"])
        self.LOG_PATH = Path(self.cfg["log_path"])
        self.config = Yaml(self.LOG_PATH.joinpath("config.yaml"))
        self.IS_GETH_TUNNEL = self.cfg["provider"]["is_geth_tunnel"]
        self.IS_IPFS_USE = self.cfg["provider"]["is_ipfs_use"]
        self.IS_EUDAT_USE = self.cfg["provider"]["is_eudat_use"]
        self.IS_GDRIVE_USE = self.cfg["provider"]["is_gdrive_use"]
        self.RPC_PORT = self.cfg["rpc_port"]
        self.BASH_SCRIPTS_PATH = Path(
            self.cfg["ebloc_path"]) / "broker" / "bash_scripts"
        self.GDRIVE_METADATA = self._HOME.joinpath(".gdrive")
        self.IPFS_REPO = self._HOME.joinpath(".ipfs")
        self.IPFS_LOG = self.LOG_PATH.joinpath("ipfs.out")
        self.GANACHE_LOG = self.LOG_PATH.joinpath("ganache.out")
        self.OWNCLOUD_PATH = Path("/oc")
        self.PROGRAM_PATH = Path("/var") / "ebloc-broker"
        self.LINK_PATH = self.LOG_PATH.joinpath("links")
        self.JOBS_READ_FROM_FILE = self.LOG_PATH.joinpath("test.txt")
        self.CANCEL_JOBS_READ_FROM_FILE = self.LOG_PATH.joinpath(
            "cancelledJobs.txt")
        self.GPG_PASS_FILE = self.LOG_PATH.joinpath(".gpg_pass.txt")
        self.CANCEL_BLOCK_READ_FROM_FILE = self.LOG_PATH.joinpath(
            "cancelled_block_read_from.txt")
        self.OC_CLIENT = self.LOG_PATH.joinpath(".oc_client.pckl")
        self.PROVIDER_ID = cfg.w3.toChecksumAddress(
            self.cfg["eth_address"].lower())
        self.OC_USER = self.cfg["oc_user"]
        if "@b2drop.eudat.eu" not in self.OC_USER:
            self.F_ID = f"{self.OC_USER}@b2drop.eudat.eu"
        else:
            self.F_ID = self.OC_USER

        _log.DRIVER_LOG = self.LOG_PATH.joinpath("provider.log")
        mkdir(self.LOG_PATH / "transactions" / self.PROVIDER_ID)
        # self.BLOCK_READ_FROM_FILE = f"{self.LOG_PATH}/block_continue.txt"
        mkdir("/tmp/run")
        self.DRIVER_LOCKFILE = "/tmp/run/driver_popen.pid"
        self.DRIVER_DAEMON_LOCK = "/tmp/run/driverdaemon.pid"
        if isinstance(self.cfg["provider"]["is_thread"], bool):
            cfg.IS_THREADING_ENABLED = self.cfg["provider"]["is_thread"]
        else:
            raise Exception("is_thead should be bool variable")

        self.GMAIL = self.cfg["gmail"]
Ejemplo n.º 12
0
def main():
    print(f"You are using the '{network.show_active()}' network")
    dev = accounts.load(click.prompt("Account", type=click.Choice(accounts.load())))
    print(f"You are using: 'dev' [{dev.address}]")

    vault = Vault.at(get_address("Deployed Vault: "))
    strategy = get_address("Deployed strategy: ")

    if input("Add Strategy? y/[N]: ").lower() != "y":
        return

    vault.addStrategy(strategy, 0, 0, 1000, {"from": dev})
def main():
    print(f"You are using the '{network.show_active()}' network")
    dev = accounts.load(
        click.prompt("Account", type=click.Choice(accounts.load())))
    print(f"You are using: 'dev' [{dev.address}]")
    if input("Is there a Vault for this strategy already? y/[N]: ").lower(
    ) == "y":
        vault = Vault.at(get_address("Deployed Vault: "))
        # assert vault.apiVersion() == API_VERSION
    else:
        print("You should deploy one vault using scripts from Vault project")
        return  # TODO: Deploy one using scripts from Vault project
    print(f"""
    Strategy Parameters

       api: {API_VERSION}
     token: {vault.token()}
      name: '{vault.name()}'
    symbol: '{vault.symbol()}'
    """)
    publish_source = click.confirm("Verify source on etherscan?")
    if input("Deploy Strategy? y/[N]: ").lower() != "y":
        return
    masterchef = "0xd7fa57069E4767ddE13aD7970A562c43f03f8365"
    reward = "0xf33121A2209609cAdc7349AcC9c40E41CE21c730"
    router = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"

    pid = get_pid(vault.token(), Contract.from_explorer(masterchef))
    print(pid)

    legacyVault = vault.apiVersion() == "0.3.0"

    if not legacyVault:
        strategy = Strategy.deploy(
            vault,
            masterchef,
            reward,
            router,
            pid,
            {"from": dev},
            publish_source=publish_source,
        )
    else:
        strategy = StrategyLegacy.deploy(
            vault,
            masterchef,
            reward,
            router,
            pid,
            {"from": dev},
            publish_source=publish_source,
        )
Ejemplo n.º 14
0
def main():
    click.echo(f"You are using the '{network.show_active()}' network")
    deployer = accounts.load(
        click.prompt("Account", type=click.Choice(accounts.load())))
    click.echo(f"You are using: 'deployer' [{deployer.address}]")

    kv2of = KV2OF()
    pair = get_address("Pair")
    click.echo(f"You are deploying: 'pair' [{pair}]")

    kv2of.deploy(pair, {'from': deployer})
    feed = kv2of.feeds(pair)
    click.echo(f"Deployed: pair [{pair}] to feed [{feed}]")
Ejemplo n.º 15
0
def main():
    StrategyRookDAI = Contract("0xB361a3E75Bc2Ae6c8A045b3A43E2B0c9aD890d48")
    StrategyRookUSDC = Contract("0x2B1a6CB0168aA540ee8D853aB1d10d7A89d6351b")
    StrategyRookWETH = Contract("0xbC0F2FF495eE2eb74A145EDAA457FA4Fa310DAC5")

    dev = accounts.load(
        click.prompt("Account", type=click.Choice(accounts.load())))

    with urllib.request.urlopen(
            f"https://indibo-lpq3.herokuapp.com/reward_of_liquidity_provider/{StrategyRookDAI.address}"
    ) as url:
        data = json.loads(url.read().decode())
        amount = int(data["earnings_to_date"], 16)
        nonce = int(data["nonce"], 16)
        signature = data["signature"]

    before = StrategyRookDAI.balanceOfReward()

    StrategyRookDAI.claimRewards(amount, nonce, signature, {'from': dev})
    print(
        f'\n{(StrategyRookDAI.balanceOfReward() - before)/1e18} rooks claimed\n'
    )

    with urllib.request.urlopen(
            f"https://indibo-lpq3.herokuapp.com/reward_of_liquidity_provider/{StrategyRookUSDC.address}"
    ) as url:
        data = json.loads(url.read().decode())
        amount = int(data["earnings_to_date"], 16)
        nonce = int(data["nonce"], 16)
        signature = data["signature"]

    before = StrategyRookUSDC.balanceOfReward()
    StrategyRookUSDC.claimRewards(amount, nonce, signature, {'from': dev})
    print(
        f'\n{(StrategyRookUSDC.balanceOfReward() - before)/1e18} rooks claimed\n'
    )

    with urllib.request.urlopen(
            f"https://indibo-lpq3.herokuapp.com/reward_of_liquidity_provider/{StrategyRookWETH.address}"
    ) as url:
        data = json.loads(url.read().decode())
        amount = int(data["earnings_to_date"], 16)
        nonce = int(data["nonce"], 16)
        signature = data["signature"]

    before = StrategyRookWETH.balanceOfReward()

    StrategyRookWETH.claimRewards(amount, nonce, signature, {'from': dev})
    print(
        f'\n{(StrategyRookWETH.balanceOfReward() - before)/1e18} rooks claimed\n'
    )
Ejemplo n.º 16
0
def _import(id_, path):
    source_path = Path(path).absolute()
    if not source_path.suffix:
        source_path = source_path.with_suffix(".json")
    dest_path = _get_data_folder().joinpath(f"accounts/{id_}.json")
    if dest_path.exists():
        raise FileExistsError(f"A keystore file already exists with the id '{id_}'")
    accounts.load(source_path)
    shutil.copy(source_path, dest_path)
    notify(
        "SUCCESS",
        f"Keystore '{color('bright magenta')}{source_path}{color}'"
        f" has been imported with the id '{color('bright blue')}{id_}{color}'",
    )
Ejemplo n.º 17
0
 def sign_transaction(self, safe_tx: SafeTx, signer: Union[LocalAccount, str] = None) -> SafeTx:
     """
     Sign a Safe transaction with a local Brownie account.
     """
     if signer is None:
         signer = click.prompt('signer', type=click.Choice(accounts.load()))
     
     if isinstance(signer, str):
         # Avoids a previously impersonated account with no signing capabilities
         accounts.clear()
         signer = accounts.load(signer)
     
     safe_tx.sign(signer.private_key)
     return safe_tx
Ejemplo n.º 18
0
def main():
    print(f"You are using the '{network.show_active()}' network")
    dev = accounts.load(
        click.prompt("Account", type=click.Choice(accounts.load())))
    print(f"You are using: 'dev' [{dev.address}]")

    router = get_address("Uniswap router")

    publish_source = click.confirm("Verify source on etherscan?")
    if input("Deploy Strategy? y/[N]: ").lower() != "y":
        return

    marketplace = Marketplace.deploy(router, {"from": dev},
                                     publish_source=publish_source)
Ejemplo n.º 19
0
def main():
    if network.show_active() in ["mainnet", "mainnet-fork", "rinkeby"]:
        if network.show_active() == "mainnet":
            priority_fee("2 gwei")
            max_fee("25 gwei")
            account_name = "minnow"
        else:
            account_name = "husky"

        if network.show_active() == "mainnet-fork":
            publish = False
        else:
            publish = False
        deployer = accounts.load(account_name)

    else:
        deployer = accounts[0]
        publish = False

    beneficiary_address = deployer
    return Margarita.deploy(
        "MARGARITA",
        "MARG",
        18,
        0,
        beneficiary_address,
        {"from": deployer},
        publish_source=publish,
    )
Ejemplo n.º 20
0
def main():
    print(f"You are using the '{network.show_active()}' network")
    account_name = input(f"What account to use?: ")
    dev = accounts.load(account_name)
    print(f"You are using: 'dev' [{dev.address}]")
    token = Token.at(get_address("ERC20 Token: "))
    #token = Token.at("0x6B175474E89094C44Da98b954EedeAC495271d0F")
    #gov = get_address("yEarn Governance: ")
    gov = dev
    #rewards = get_address("Rewards contract: ")
    rewards = dev
    #name = input(f"Set description ['yearn {token.name()}']: ") or ""
    name = "yDAI Test Vault V2"
    #symbol = input(f"Set symbol ['y{token.symbol()}']: ") or ""
    symbol = 'ytDAI'
    print(f"""
    Vault Parameters

   version: {PACKAGE_VERSION}
     token: {token.address}
  governer: {gov}
   rewards: {rewards}
      name: '{name or 'yearn ' + token.name()}'
    symbol: '{symbol or 'y' + token.symbol()}'
    """)
    if input("Deploy New Vault? y/[N]: ").lower() != "y":
        return
    print("Deploying Vault...")
    vault = Vault.deploy(token, gov, rewards, name, symbol, {
        'from': dev,
        'gas_price': Wei("15 gwei")
    })
Ejemplo n.º 21
0
def main(coin):
    deployer = accounts.load('deployer')
    base_pool = StableSwap.at('0x160CAed03795365F3A589f10C379FfA7d75d4E76')
    lp_staker = LpTokenStaker.at('0xcce949De564fE60e7f96C85e55177F8B9E4CF61b')
    eps_staker = MultiFeeDistribution.at(
        '0x4076CC26EFeE47825917D0feC3A79d0bB9a6bB5c')
    coins = [coin, "0xaF4dE8E872131AE328Ce21D909C74705d3Aaf452"]

    fee_converter = MetapoolFeeConverter.deploy({"from": deployer})
    fee_converter.setFeeDistributor(eps_staker, {'from': deployer})
    symbol = coin.symbol()
    lp_token = RewardsToken.deploy(f"Ellipsis.finance {symbol}/3EPS",
                                   f"{symbol.lower()}3EPS", lp_staker,
                                   {'from': deployer})

    swap = StableSwapMeta.deploy(
        deployer,
        coins,  # coins,
        lp_token,
        base_pool,
        600,  # A
        4000000,  # fee
        5000000000,  # admin fee
        fee_converter,
        {"from": deployer},
    )
    lp_token.setMinter(swap, {'from': deployer})
Ejemplo n.º 22
0
def _release(project_path, registry_address, sender):
    network.connect("mainnet")
    with project_path.joinpath("ethpm-config.yaml").open() as fp:
        project_config = yaml.safe_load(fp)
    print("Generating manifest and pinning assets to IPFS...")
    manifest, uri = ethpm.create_manifest(project_path, project_config, True,
                                          False)
    if sender in accounts:
        account = accounts.at(sender)
    else:
        try:
            account = accounts.load(sender)
        except FileNotFoundError:
            raise UnknownAccount(f"Unknown account '{sender}'")
    name = f'{manifest["package_name"]}@{manifest["version"]}'
    print(f'Releasing {name} on "{registry_address}"...')
    try:
        tx = ethpm.release_package(registry_address, account,
                                   manifest["package_name"],
                                   manifest["version"], uri)
        if tx.status == 1:
            notify("SUCCESS", f"{name} has been released!")
            print(
                f"\nURI: {color('bright magenta')}ethpm://{registry_address}:1/{name}{color}"
            )
            return
    except Exception:
        pass
    notify(
        "ERROR",
        f'Transaction reverted when releasing {name} on "{registry_address}"')
Ejemplo n.º 23
0
def main():
    """
    $ brownie run deploy.py --network rinkeby
    :return:
    """
    acct = accounts.load('flyer')
    Token.deploy("My Real Token", "RLT", 18, 1e28, {'from': acct})
Ejemplo n.º 24
0
def main():
    #user1 = accounts.load("user1")
    acct = accounts.load("AAVE")

    A = Token.at("0x982328095bC12d3a8b0B75be1e9FDce4c011202a")
    man = Manager.at("0x7927b309535ba4B1D6F42c1aF76a6757Fe45AB58")

    print("BEFORE REDEEM Atoken and Eth balance")
    # #token A balance
    print(A.balanceOf(acct))
    # # eth balance
    print(acct.balance())
    man.requestState("0x4712020ca7e184c545fd2483696c9dc36cb7c36a",
                     "ca0d86424890466f856de3e868087f81", {'from': acct})
    time.sleep(90)
    man.redeem({'from': acct})
    print("~~~~~~~~~~~~~~~~~~~~~~~~~")
    print("post redeem, pre fufill")
    #token A balance
    print(A.balanceOf(acct))
    # eth balance
    print(user1.balance())

    print("~~~~~~~~~~~~~~~~~~~~~~~~~")
    print("post redeem, POST FUFILL")
    #token A balance
    print(A.balanceOf(user1))
    # eth balance
    print(user1.balance())
Ejemplo n.º 25
0
def main():
    deployer = accounts.load("curve-deploy")
    admin = interface.ProxyAdmin("0x7EAfd3cd937628b9671d5f8B9c823f4AAc914808")

    # withdraw admin fees to the burner
    swap = StableSwapAave.at("0x445FE580eF8d70FF569aB36e80c647af338db351")
    admin.execute(swap, swap.withdraw_admin_fees.encode_input(),
                  {"from": deployer})

    # burn - unwrap aTokens to underlying assets, swap for USDC and transfer to the bridge
    burner = ABurner.at("0xA237034249290De2B07988Ac64b96f22c0E76fE0")
    for i in range(3):
        burner.burn(swap.coins(i), {"from": deployer})

    # send USDC over the bridge
    usdc = interface.BridgeToken("0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174")
    bridge = ChildBurner.at("0x4473243A61b5193670D1324872368d015081822f")
    amount = usdc.balanceOf(bridge)
    tx = admin.execute(bridge, bridge.withdraw.encode_input(usdc),
                       {"from": deployer})

    print(
        f"Burning phase 1 complete!\nAmount: {amount/1e6:,.2f} USDC\nBridge txid: {tx.txid}"
    )
    print(
        "\nUse `brownie run exit --network mainnet` to claim on ETH once the checkpoint is added"
    )
Ejemplo n.º 26
0
def claim():
    claimer = accounts.load(input('Enter brownie account: '))
    dist = MerkleDistributor.at(DISTRIBUTOR_ADDRESS)
    tree = json.load(open('snapshot/07-merkle-distribution.json'))
    claim_other = input('Claim for another account? y/n [default: n] ') or 'n'
    assert claim_other in {'y', 'n'}
    user = str(claimer) if claim_other == 'n' else input(
        'Enter address to claim for: ')

    if user not in tree['claims']:
        return secho(f'{user} is not included in the distribution', fg='red')
    claim = tree['claims'][user]
    if dist.isClaimed(claim['index']):
        return secho(f'{user} has already claimed', fg='yellow')

    amount = Wei(int(claim['amount'], 16)).to('ether')
    secho(f'Claimable amount: {amount} DAI', fg='green')
    if claim_other == 'n':  # no tipping for others
        secho(
            '\nThe return of funds to you was made possible by a team of volunteers who worked for free to make this happen.'
            '\nPlease consider tipping them a portion of your recovered funds as a way to say thank you.\n',
            fg='yellow',
        )
        tip = input('Enter tip amount in percent: ')
        tip = int(float(tip.rstrip('%')) * 100)
        assert 0 <= tip <= 10000, 'invalid tip amount'
    else:
        tip = 0

    tx = dist.claim(claim['index'], user, claim['amount'], claim['proof'], tip,
                    {'from': claimer})
    tx.info()
Ejemplo n.º 27
0
def deploy():
    user = accounts[0] if rpc.is_active() else accounts.load(
        input('account: '))
    tree = json.load(open('snapshot/07-merkle-distribution.json'))
    root = tree['merkleRoot']
    token = str(DAI)
    MerkleDistributor.deploy(token, root, {'from': user})
Ejemplo n.º 28
0
def _password(id_):
    a = accounts.load(id_)
    a.save(id_, overwrite=True)
    notify(
        "SUCCESS",
        f"Password has been changed for account '{color('bright blue')}{id_}{color}'"
    )
Ejemplo n.º 29
0
def main():
    user = accounts.load(input("brownie account: "))
    print(f"loaded keeper account: {user}")

    registry = load_registry()
    vaults = load_vaults(registry)
    secho(f"loaded {len(vaults)} vaults", fg="yellow")

    keepers = [
        keeper_registry[str(vault.strategy)] for vault in vaults
        if hasattr(vault.strategy, "strategist") and vault.strategy.strategist(
        ) == user and str(vault.strategy) in keeper_registry
    ]
    if not keepers:
        secho("nothing to keep, exiting", fg="yellow")
        return

    secho(f"keeping {len(keepers)} vaults", fg="green")

    for block in chain.new_blocks():
        for keeper in keepers:
            secho(f">>> {block.number}", dim=True)
            gas_price = gas_price_geth()
            secho(f"gas price: {gas_price.to('gwei')} gwei")
            if keeper.harvest_trigger(gas_price):
                keeper.harvest(gas_price, user)

        time.sleep(600)
Ejemplo n.º 30
0
def main():
    badger = connect_badger("deploy-final.json")

    multi = GnosisSafe(badger.opsMultisig)

    account = accounts.load("badger_proxy_deployer")
    print(account.address)

    amount = Wei("10000 ether")

    # print(badger.deployer)
    # print(badger.token.balanceOf(badger.deployer), badger.token.balanceOf(badger.opsMultisig))

    # multi.execute(MultisigTxMetadata(description="Transfer badger to EOA"), {
    #     "to": badger.token.address,
    #     "data": badger.token.transfer.encode_input(account, Wei("10000 ether"))
    # })

    # print(badger.token.balanceOf(account), badger.token.balanceOf(badger.opsMultisig))

    # assert badger.token.balanceOf(account) >= amount

    bBadger = badger.getSett("native.badger")
    # badger.token.approve(bBadger, amount, {"from": account})

    # bBadger.deposit(amount, {"from": account})
    # tx_wait()
    print(bBadger.balanceOf(account))

    airdropProxy = AirdropDistributor.at(
        "0xd17c7effa924b55951e0f6d555b3a3ea34451179")
    bBadger.transfer(airdropProxy, bBadger.balanceOf(account),
                     {"from": account})