Giter VIP home page Giter VIP logo

easy-staking-contracts's People

Contributors

andogro avatar dependabot[bot] avatar maxaleks avatar varasev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

easy-staking-contracts's Issues

Consider a negative `b` sigmoid param

The sigmoid function contains x - b expression which allows moving sigmoid to left and right (depending on the sign of b), but the current b in the contract is uint256, i.e. always positive. Consider making it int256.

Extending claimTokens

Currently, claimTokens doesn't allow claiming STAKE tokens from the balance of EasyStaking contract.

Consider changing that requirement from require(_token != address(token) to _token != address(token) || token.balanceOf(address(this)) > totalStaked and add the corresponding description for claimTokens outlining when such a case can occur (after the owner of STAKE token contract removes the address of EasyStaking contract from the list of minters).

Add `return true` to `EasyStaking.onTokenTransfer`

so that it would look like this:

    function onTokenTransfer(address _sender, uint256 _amount, bytes calldata) external returns(bool) {
        require(msg.sender == address(token), "only token contract is allowed");
        if (!locked) {
            _deposit(_sender, ++lastDepositIds[_sender], _amount);
        }
        return true;
    }

Do we really need `setToken` function?

EasyStaking contract assumes it will only work with the existing STAKE token contract which address won't be changed. I propose to remove setToken function from the EasyStaking contract.

Improve deposit/withdraw unit tests

Let's add the following scenarios to the tests:

  1. A user withdraws their entire deposit by several parts (more than two parts, different amounts for each part).

  2. A user withdraws their balance (and emission) with the amount parameter set to zero and with amount set to the total deposit amount. The result in both cases should match (entire deposit withdrawal).

  3. Different users make deposits and withdrawals and the totalStaked is changed correctly.

  4. Ensure that date is reset to the current when replenishing the existing deposit.

Deposit ID checking

I have a little concern regarding this line - AFAIU, it checks whether the deposit with the specified id exists, or not.

But what if some deposit was created and then fully closed? In this case, the specified id will be in the range _depositId > 0 && _depositId <= lastDepositIds[msg.sender], but balances[_sender][_id] and depositDates[_sender][_id] will be zero, so the user will be able to create a deposit with the same ID again.

Maybe we should also check the balance for zero? To avoid an ability to create a new deposit having an old ID.

Add events for the rest functions

We forgot to add events for the following functions:

setFee
setWithdrawalLockDuration
setWithdrawalUnlockDuration
setTotalSupplyFactor
setSigmoidParameters
setLiquidityProvidersRewardAddress

Options for staking multiple times

Is it possible to combine staking into one grouping rather than separate groups each time you buy STAKE. For example, I bought STAKE deposited it in easy stake and the next day bought some more. When I went to deposit it, it automatically placed it in a new stake of its own. It would be beneficial if you could add them into 1, even if that meant forfeiting some of the time you initially staked on.

Update README

Please fully review and update README according to the latest changes

Lock versions of all packages in `package.json`

Let's set explicit versions in package.json, e.g.

"@openzeppelin/contracts-ethereum-package": "2.5.0"

instead of

"@openzeppelin/contracts-ethereum-package": "^2.5.0"

This will help to prevent something in the code used from changing in the future.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.