Giter Site home page Giter Site logo

aurora-staking-contracts's People

Contributors

0x3bfc avatar dependabot[bot] avatar diegofigs avatar paouvrard avatar rostyslav-ideasoft avatar rostyslavbortman avatar vzctl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

aurora-staking-contracts's Issues

Add a minimum period of time between current timestamp and the start of schedule

_JetStakingV1: function validateStreamParameters().

Currently, the start of rewards schedule must be greater than current block.timestamp(Validation on Line 1095), thus, it is possible to pass scheduleTimes[0] with low difference with current timestamp, so that the creator of stream will not have enough time to activate the stream.

Recommendation. Add a minimum period of time between scheduleTimes[0] and block.timestamp to make sure the stream creator has enough time to activate the stream.

Aurora Auto Compounding. How it works?

I was researching on the auto compounding mechanisms on the Aurora Staking Contract. What I understand is the staking service increases total staked aurora, so the newer participants will have lower shares of the aurora's staked, resulting in something of auto compounding.

My question is this: The Math is quite subtle to understand, so I do not really know if I am correct. I just wanted some points on how exactly Auto Compounding works, plus could you provide me to some codes that does this.

Missing validation

Description

According to the documentation, stake, unstake, unstakeAll, stakeOnBehalfOfOtherUsers, stakeOnBehalfOfAnotherUser functions should claim rewards if the selected user has actual staking.
Mentioned validation should be implemented to prevent human factors. Contract: JetStakingV1

Functions: initialize, updateTreasury, stake, unstake, unstakeAll, stakeOnBehalfOfOtherUsers, stakeOnBehalfOfAnotherUser

Recommendation: implement these checks.

Validate `tau` parameter

Description:

JetStakingV1: function _validateStreamParameters().
Parameter “tau” should be validated in order not to be equal to extremely big values, due to which users won’t be able to withdraw their pending rewards.

Recommendation.

  • Validate that “tau” is not equal to big value and doesn’t block users from withdrawing their pending rewards.

AdminControlled issues

Initiailize

  • AdminControlled initializer doesn't set admin field.
  • AdminControlled initializer (__AdminControlled_init) should be declared internal and without initializer modifier.

transferOwnership

To prevent the significant impact of the previous admin, it is better to revoke all actual roles on ownership transfer. Checks in transferOwnership can be bypassed with the functions in AccessControlUpgradeable.

The function transferOwnership tries to make sure that there is only one user with the admin role, and its address is also stored in the admin field. However, this is trivially bypassed using the function grantRole in AccessControlUpgradeable.

costly operations in a loop

  • totalStreamShares += weightedAmountOfSharesPerStream (contracts/JetStakingV1.sol#1042)
  • totalAmountOfStakedAurora += amount (contracts/JetStakingV1.sol#1034)
  • totalAuroraShares += _amountOfShares (contracts/JetStakingV1.sol#1033)

update the stream lifecycle logic

Update the stream life cycle to support the following features:

  • Allow multiple streams for the same token address.
  • Propose/whitelist stream by only admin then deploy stream
  • Creating the stream only by the stream owner
  • remove stream --> move unclaimed and rest of Aurora to the stream owner.

On `rewardsSchedule` we can use memory to store `Schedule`

in this function rewardsSchedule we can use memory to store Schedule as it does not update the storage. This is optional and if done, there should there should be test cases for max array values stored in the struct. Recommending it as this function is used in other external functions and would reduce gas cost if memory variable is used.

Originally posted by @UrAvgDeveloper in #173 (comment)

Add hardhat task for `grantRole` to multiple address for the same role

LGTM with minor comments. For the CLAIM_ROLE and AIRDROP_ROLE, we will need several keys to have these roles (10 ?) so that the airdrop script can process requests in parallel. Should we use _setRoleAdmin to setup these keys separately or also grant these roles in the deployment ?

We can call grantRole() separately to add as many keys as we want. I will prepare that in a separate PR for the hardhat tasks.

Originally posted by @0x3bfc in #89 (comment)

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.