Exemplo n.º 1
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})
Exemplo n.º 2
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()
Exemplo n.º 3
0
def main():
    with open('snapshot/07-merkle-distribution.json') as fp:
        tree = json.load(fp)

    ychad = accounts.at("0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52")

    dai = interface.ERC20('0x6B175474E89094C44Da98b954EedeAC495271d0F')
    distributor = MerkleDistributor.deploy(dai, tree['merkleRoot'],
                                           {'from': ychad})

    dai.transfer(distributor, tree['tokenTotal'], {'from': ychad})

    for i, (address, claim) in enumerate(tree['claims'].items()):
        if not i % 50:
            print(f"Distribution in progress, {i} / {len(tree['claims'])}...")

        balance = dai.balanceOf(address)
        distributor.claim(claim['index'], address, claim['amount'],
                          claim['proof'], 0, {'from': ychad})

        assert dai.balanceOf(address) == balance + claim['amount']

    assert dai.balanceOf(distributor) == 0

    print("Distribution was successful!")
Exemplo n.º 4
0
def main():
    tree = json.load(open("snapshot/04-merkle.json"))
    whale = accounts.at("0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
                        force=True)
    dai = interface.ERC20("0x6B175474E89094C44Da98b954EedeAC495271d0F",
                          owner=whale)
    corn = Cornichon.at('0xa456b515303B2Ce344E9d2601f91270f8c2Fea5E',
                        owner=whale)
    distributor = MerkleDistributor.at(
        '0x8896C47Cf854644cDC4Dd949a11048a57bDBA9Bc', owner=whale)
    # a hacker sends everything back
    dai.transfer(corn, tree["tokenTotal"])

    for user, claim in tree["claims"].items():
        distributor.claim(claim["index"], user, claim["amount"],
                          claim["proof"])
        assert corn.balanceOf(user) == claim["amount"]
        print("remaining in distributor:",
              corn.balanceOf(distributor).to("ether"))
    assert corn.balanceOf(distributor) == 0

    for user in tree["claims"]:
        user = accounts.at(user, force=True)
        amount = corn.balanceOf(user)
        before = dai.balanceOf(user)
        assert corn.rate() == "1 ether"
        corn.burn(amount, {"from": user})
        assert corn.balanceOf(user) == 0
        assert dai.balanceOf(user) == before + amount
        print("rate:", corn.rate().to("ether"))
        print("remaining supply:", corn.totalSupply().to("ether"))
        print("remaining dai:", dai.balanceOf(corn).to("ether"))

    assert dai.balanceOf(corn) == 0
    assert corn.totalSupply() == 0
Exemplo n.º 5
0
def main():
    tree = json.load(open("snapshot/02-merkle.json"))
    whale = accounts.at("0x70178102aa04c5f0e54315aa958601ec9b7a4e08",
                        force=True)
    dai = interface.ERC20("0x6B175474E89094C44Da98b954EedeAC495271d0F",
                          owner=whale)
    piou = PercentIOU.at('0x4De840147DB6d0655917f43dA8a2e86c26AaFB0a',
                         owner=whale)
    distributor = MerkleDistributor.at(
        '0xA742Ce2E4426290017ab165b0F7d8Ab131E4a9f5', owner=whale)
    # a hacker sends everything back
    dai.transfer(piou, tree["tokenTotal"])

    for user, claim in tree["claims"].items():
        distributor.claim(claim["index"], user, claim["amount"],
                          claim["proof"])
        assert piou.balanceOf(user) == claim["amount"]
        print("remaining in distributor:",
              piou.balanceOf(distributor).to("ether"))
    assert piou.balanceOf(distributor) == 0

    for user in tree["claims"]:
        user = accounts.at(user, force=True)
        amount = piou.balanceOf(user)
        before = dai.balanceOf(user)
        assert piou.rate() == "1 ether"
        piou.burn(amount, {"from": user})
        assert piou.balanceOf(user) == 0
        assert dai.balanceOf(user) == before + amount
        print("rate:", piou.rate().to("ether"))
        print("remaining supply:", piou.totalSupply().to("ether"))
        print("remaining dai:", dai.balanceOf(piou).to("ether"))

    assert dai.balanceOf(piou) == 0
    assert piou.totalSupply() == 0
Exemplo n.º 6
0
def main():
    tree = json.load(open("snapshot/02-merkle.json"))
    whale = accounts.at("0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7", force=True)
    dai = interface.ERC20("0x6B175474E89094C44Da98b954EedeAC495271d0F", owner=whale)
    pytho = Pytho.deploy("Pytho", "PYTHO", tree["tokenTotal"], {"from": whale})
    distributor = MerkleDistributor.deploy(pytho, tree["merkleRoot"], {"from": whale})
    pytho.transfer(distributor, tree["tokenTotal"])
    # the hacker sends everything back
    dai.transfer(pytho, tree["tokenTotal"])

    for user, claim in tree["claims"].items():
        distributor.claim(claim["index"], user, claim["amount"], claim["proof"])
        assert pytho.balanceOf(user) == claim["amount"]
        print("remaining in distributor:", pytho.balanceOf(distributor).to("ether"))
    assert pytho.balanceOf(distributor) == 0

    for user in tree["claims"]:
        user = accounts.at(user, force=True)
        amount = pytho.balanceOf(user)
        before = dai.balanceOf(user)
        assert pytho.rate() == "1 ether"
        pytho.burn(amount, {"from": user})
        assert pytho.balanceOf(user) == 0
        assert dai.balanceOf(user) == before + amount
        print("rate:", pytho.rate().to("ether"))
        print("remaining supply:", pytho.totalSupply().to("ether"))
        print("remaining dai:", dai.balanceOf(pytho).to("ether"))

    assert dai.balanceOf(pytho) == 0
    assert pytho.totalSupply() == 0
Exemplo n.º 7
0
def main():
    tree = json.load(open("snapshot/02-merkle.json"))
    user = accounts[0] if rpc.is_active() else accounts.load(
        input("account: "))
    pytho = Pytho.deploy("Pytho", "PYTHO", tree["tokenTotal"], {"from": user})
    distributor = MerkleDistributor.deploy(pytho, tree["merkleRoot"],
                                           {"from": user})
    pytho.transfer(distributor, pytho.balanceOf(user))
Exemplo n.º 8
0
def main():
    deployer = accounts.load('deployer')
    lp_token = Token.deploy("Ellipsis.finance BUSD/USDC/USDT", "3EPS", 0,
                            {"from": deployer})
    fee_converter = FeeConverter.deploy({"from": deployer})
    airdrop_distro = MerkleDistributor.deploy(
        deployer, "0x7EeAC6CDdbd1D0B8aF061742D41877D7F707289a",
        {'from': deployer})

    coins = [
        "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",  # busd
        "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",  # usdc
        "0x55d398326f99059fF775485246999027B3197955"  # usdt
    ]
    swap = StableSwap.deploy(
        deployer,
        coins,  # coins,
        lp_token,
        1500,  # A
        4000000,  # fee
        5000000000,  # admin fee
        fee_converter,
        {"from": deployer},
    )
    lp_token.set_minter(swap, {"from": deployer})

    initial_supply = TOTAL_SUPPLY // 5 + (5000 * 10**18)
    eps = Token.deploy("Ellipsis", "EPS", initial_supply, {"from": deployer})

    cake = Contract('0x05ff2b0db69458a0750badebc4f9e13add608c7f')
    tx = cake.addLiquidityETH(eps, 5000 * 10**18, 5000 * 10**18, 10**18,
                              deployer, 2000000000, {'from': deployer})
    cakelp = tx.events['PairCreated']['pair']

    per_period = [
        int(i * 100000) * TOTAL_SUPPLY // 100000 for i in REWARD_AMOUNTS
    ]
    durations = [
        REWARD_OFFSETS[i + 1] - REWARD_OFFSETS[i]
        for i in range(len(REWARD_OFFSETS) - 1)
    ]
    rewards_per_block = [
        per_period[i] // durations[i] for i in range(len(durations))
    ] + [0]
    offsets = [i + LAUNCH_OFFSET for i in REWARD_OFFSETS]

    lp_staker = LpTokenStaker.deploy(offsets, rewards_per_block, cakelp,
                                     {"from": deployer})
    lp_staker.addPool(lp_token, 0, {'from': deployer})

    eps_staker = MultiFeeDistribution.deploy(eps, [lp_staker, airdrop_distro],
                                             {"from": deployer})
    eps_staker.addReward(coins[0], fee_converter, {'from': deployer})

    lp_staker.setMinter(eps_staker, {"from": deployer})
    eps.set_minter(eps_staker, {'from': deployer})
    fee_converter.setFeeDistributor(eps_staker, {"from": deployer})
    airdrop_distro.setMinter(eps_staker, {'from': deployer})
Exemplo n.º 9
0
def main():
    tree = json.load(open("snapshot/02-merkle.json"))
    user = accounts[0] if rpc.is_active() else accounts.load(input("account: "))
    root = tree["merkleRoot"]
    percentIOU = PercentIOU.deploy(
        "Percent IOU", "PIOU", tree["tokenTotal"], {"from": user}
    )
    distributor = MerkleDistributor.deploy(percentIOU, root, {"from": user})
    percentIOU.transfer(distributor, percentIOU.balanceOf(user))
Exemplo n.º 10
0
def main():
    tree = json.load(open("snapshot/04-merkle.json"))
    user = accounts[0] if rpc.is_active() else accounts.load(input("account: "))
    root = tree["merkleRoot"]
    cornichon = Cornichon.deploy(
        "Cornichon", "CORN", tree["tokenTotal"], {"from": user}
    )
    distributor = MerkleDistributor.deploy(cornichon, root, {"from": user})
    cornichon.transfer(distributor, cornichon.balanceOf(user))
Exemplo n.º 11
0
def main():
    tree = json.load(open("snapshot/04-merkle.json"))
    user = get_user()
    dist = MerkleDistributor.at(DISTRIBUTOR, owner=user)
    if user not in tree["claims"]:
        return click.secho(f"{user} is not included in the distribution", fg="red")
    claim = tree["claims"][user]
    if dist.isClaimed(claim["index"]):
        return click.secho(f"{user} has already claimed", fg="yellow")

    amount = Wei(claim["amount"]).to("ether")
    _amount = click.style(f"{amount:,.2f} PYTHO", fg="green", bold=True)
    print(f"Claimable amount: {_amount}")
    dist.claim(claim["index"], user, claim["amount"], claim["proof"])
Exemplo n.º 12
0
def claim():
    claimer = accounts.load(input("account: "))
    dist = MerkleDistributor.at(DISTRIBUTOR_ADDRESS)
    tree = json.load(open("snapshot/10-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} UNI", fg="green")
    dist.claim(claim["index"], user, claim["amount"], claim["proof"],
               {"from": claimer})
Exemplo n.º 13
0
def main():
    with open('snapshot/10-usdc-merkle-distribution.json') as fp:
        tree = json.load(fp)
    deployer = accounts.at(DEPLOYER_ADDRESS)
    usdc = interface.ERC20(USDC_ADDRESS)
    print(f'Deployer address {DEPLOYER_ADDRESS}')
    print(f'Deployer USDC balance: {usdc.balanceOf(deployer)}')
    print(f'Deployer eth balance: {deployer.balance()}')
    distributor = MerkleDistributor.deploy(usdc, tree['merkleRoot'], {'from': deployer})

    usdc.transfer(distributor, tree['tokenTotal'], {'from': deployer})
    for i, (address, claim) in enumerate(tree['claims'].items()):
        if not i % 50:
            print(f"Distribution in progress, {i} / {len(tree['claims'])}...")
        balance = usdc.balanceOf(address)
        distributor.claim(
            claim['index'], address, claim['amount'], claim['proof'], 0, {'from': deployer}
        )
        assert usdc.balanceOf(address) == balance + claim['amount']
    assert usdc.balanceOf(distributor) == 0
    print("Distribution was successful!")
Exemplo n.º 14
0
def deploy():
    user = accounts.load(input("account: "))
    tree = json.load(open("snapshot/10-merkle-distribution.json"))
    root = tree["merkleRoot"]
    token = str(spank)
    MerkleDistributor.deploy(token, root, {"from": user})