Skip to content

Commit

Permalink
Remove stake, unstake functions from side_staking.py (#767)
Browse files Browse the repository at this point in the history
* Remove pool interface functions related to staking.
* Remove duplicate dispenser property.
  • Loading branch information
mariacarmina authored Mar 30, 2022
1 parent 250f8a8 commit 1c9ffac
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 48 deletions.
24 changes: 0 additions & 24 deletions ocean_lib/models/side_staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,6 @@ def get_vesting_last_block(self, datatoken: str) -> int:
def get_vesting_amount_so_far(self, datatoken: str) -> int:
return self.contract.caller.getvestingAmountSoFar(datatoken)

@enforce_types
def can_stake(self, datatoken: str, amount: int) -> bool:
return self.contract.caller.canStake(datatoken, amount)

@enforce_types
def stake(self, datatoken: str, amount: int, from_wallet: Wallet) -> str:
return self.send_transaction("Stake", (datatoken, amount), from_wallet)

@enforce_types
def can_unstake(self, datatoken: str, liquidity_pool_token_in: int) -> bool:
return self.contract.caller.canUnStake(datatoken, liquidity_pool_token_in)

@enforce_types
def unstake(
self,
datatoken: str,
dt_amount_in: int,
pool_amount_out: int,
from_wallet: Wallet,
) -> str:
return self.send_transaction(
"UnStake", (datatoken, dt_amount_in, pool_amount_out), from_wallet
)

@enforce_types
def notify_finalize(
self, datatoken: str, decimals: int, from_wallet: Wallet
Expand Down
24 changes: 0 additions & 24 deletions ocean_lib/models/test/test_side_staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,27 +392,3 @@ def test_side_staking(

# Get vesting should be callable by anyone
side_staking.get_vesting(erc20.address, another_consumer_wallet)

# Only pool can call this function
with pytest.raises(exceptions.ContractLogicError) as err:
side_staking.can_stake(erc20.address, 10)
assert (
err.value.args[0]
== "execution reverted: VM Exception while processing transaction: revert ERR: Only pool can call this"
)

# Only pool can call this function
with pytest.raises(exceptions.ContractLogicError) as err:
side_staking.stake(erc20.address, 10, consumer_wallet)
assert (
err.value.args[0]
== "execution reverted: VM Exception while processing transaction: revert ERR: Only pool can call this"
)

# Only pool can call this function
with pytest.raises(exceptions.ContractLogicError) as err:
side_staking.unstake(erc20.address, 10, 5, consumer_wallet)
assert (
err.value.args[0]
== "execution reverted: VM Exception while processing transaction: revert ERR: Only pool can call this"
)

0 comments on commit 1c9ffac

Please sign in to comment.