Exemple #1
0
def _deployBPool():
    brownie.chain.reset()
    router = oceanv4util.deployRouter(account0)
    fundOCEANFromAbove(address0, toBase18(100000))

    (dataNFT,
     erc721_factory) = oceanv4util.createDataNFT("dataNFT", "DATANFTSYMBOL",
                                                 account0, router)

    DT_cap = 10000
    datatoken = oceanv4util.createDatatokenFromDataNFT("DT", "DTSYMBOL",
                                                       DT_cap, dataNFT,
                                                       account0)

    OCEAN_init_liquidity = 80000
    DT_OCEAN_rate = 0.1
    DT_vest_amt = 1000
    DT_vest_num_blocks = 600
    pool = oceanv4util.createBPoolFromDatatoken(
        datatoken,
        erc721_factory,
        account0,
        OCEAN_init_liquidity,
        DT_OCEAN_rate,
        DT_vest_amt,
        DT_vest_num_blocks,
    )

    return pool
def test_createBPool_via_util():
    brownie.chain.reset()
    router = oceanv4util.deployRouter(account0)
    (dataNFT,
     erc721_factory) = oceanv4util.createDataNFT("dataNFT", "DATANFT",
                                                 account0, router)
    DT = oceanv4util.createDatatokenFromDataNFT("DT", "DTSymbol", 10000,
                                                dataNFT, account0)

    fundOCEANFromAbove(address0, toBase18(10000.0))
    OCEAN = oceanv4util.OCEANtoken()

    OCEAN_init_liquidity = 2000.0
    DT_OCEAN_rate = 0.1
    DT_vest_amt = 100
    DT_vest_num_blocks = 600
    LP_swap_fee = 0.03
    mkt_swap_fee = 0.01
    pool = oceanv4util.createBPoolFromDatatoken(
        DT,
        erc721_factory,
        account0,
        OCEAN_init_liquidity,
        DT_OCEAN_rate,
        DT_vest_amt,
        DT_vest_num_blocks,
        LP_swap_fee,
        mkt_swap_fee,
    )
    pool_address = pool.address

    assert pool.getBaseTokenAddress() == OCEAN.address
    assert OCEAN.balanceOf(pool_address) < toBase18(10000.0)
    assert pool.getMarketFee() == toBase18(mkt_swap_fee)
    assert pool.getSwapFee() == toBase18(LP_swap_fee)
def test_createDT_via_util():
    router = oceanv4util.deployRouter(account0)
    (dataNFT, _) = oceanv4util.createDataNFT("dataNFT", "DATANFT", account0,
                                             router)
    DT = oceanv4util.createDatatokenFromDataNFT("DT", "DTSymbol", 10000,
                                                dataNFT, account0)
    assert DT.name() == "DT"
    assert DT.symbol() == "DTSymbol"
    assert DT.cap() == toBase18(10000)
    assert DT.balanceOf(account0.address) == 0
def _deployBPool(
    OCEAN_base_funding=10000,
    do_extra_funding: bool = True,
    OCEAN_extra_funding=10000,
    OCEAN_init_liquidity=2000,
    DT_OCEAN_rate=0.1,
    DT_cap=10000,
    DT_vest_amt=1000,
    DT_vest_num_blocks=600,
):  # pylint: disable=too-many-arguments

    fundOCEANFromAbove(address0, toBase18(OCEAN_base_funding))

    router = oceanv4util.deployRouter(account0)

    (data_NFT,
     erc721_factory) = oceanv4util.createDataNFT("dataNFT", "DATANFTSYMBOL",
                                                 account0, router)

    DT = oceanv4util.createDatatokenFromDataNFT("DT", "DTSYMBOL", DT_cap,
                                                data_NFT, account0)

    pool = oceanv4util.createBPoolFromDatatoken(
        DT,
        erc721_factory,
        account0,
        OCEAN_init_liquidity,
        DT_OCEAN_rate,
        DT_vest_amt,
        DT_vest_num_blocks,
    )

    ssbot_address = pool.getController()
    ssbot = BROWNIE_PROJECT080.SideStaking.at(ssbot_address)

    if do_extra_funding:
        fundOCEANFromAbove(address0, toBase18(OCEAN_base_funding))
        OCEAN = OCEANtoken()
        OCEAN.approve(pool.address, toBase18(OCEAN_extra_funding),
                      {"from": account0})

    return (DT, pool, ssbot)
Exemple #5
0
 def _createDataToken(self, DT_name, DT_symbol, DT_cap, dataNFT):
     account = self._wallet._account
     DT = oceanv4util.createDatatokenFromDataNFT(DT_name, DT_symbol, DT_cap,
                                                 dataNFT, account)
     return DT