Giter Site home page Giter Site logo

adex-staking's People

Contributors

dependabot[bot] avatar ivopaunov avatar rori4 avatar samparsky avatar simzzz avatar trtomasz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

adex-staking's Issues

Pool policies

Each pool should define it's own reward policy and slash policy, which should be displayed in the "Stake ADX" form (NewBondForm)

The pools are defined in the beginning of the main source file as a hardcoded JS object.

Parameters the pool should define:

  • minimum staking amount (should be enforced in the form)
  • reward policy: description (should be displayed in the form)
  • slash policy: description (should be displayed in the form)

Bounties: for supporting us on social media, chats, etc.

Summary

This was previously discussed in AIP 48 as "fun pool" but it better translates to a new bounties feature.

Add a new "Bounties" page where we reward users with ADX for joining our soical media or communities

Rewards

Reward users for:

  • Early supporter: held ADX in 2017
  • Community member: is in Telegram/Discord
    • we can make this interesting by having a "daily secret" or "daily password" and users have to enter at least 2-3 to get the reward, making it harder to sybil too
  • Retweets our tweets - you get ADX if your account has been created before a certaint time, has a certain number of followers, and you don't unretweet
  • Referring users to the platform - referral/affiliate program - get ADX minted for every DAI spent/earned by users you referred, up to a certain limit

We can gamify it by adding badges too, similarly to how the platform does it when you're a new user.

Implementation

Use an OUTPACE payment channel.

Checking stuff like whether you're an early supporter is easy: just use a preset list of all 2017 holder addrs, and if you're one of them, you can claim. No need to check for signed msgs or anything like that since the reward would go directly to the addr that requested it.

Challenges

  • How to prove the user is real (anti-sybil)?
  • How to prove the user has joined?
  • How to ensure the user is engaged?

Basically it's all very gamable so we have to figure it out as much as possible

Pool cards design: indicate APY, sustainability, lockup

  • show sustainability raiting with a link to a full explanation
  • cards to show more earning info: daily earning, show whether the APY is fixed/dynamic
  • show "dynamic APY" or "variable APY" vs "fixed APY"/"stable APY" vs "predictable APY"
  • cards to show lockup period

Support the new ADX token

  • refactor how ADX_MULTIPLER is used and make the NewBondForm use 10**18 units; use formatUnits/parseUnits
  • think of ways to minimize number of on chain transactions, such as using deployAndExecute if needed
  • total ADX: ADX old + ADX new + ADX old/new on identity
  • use replaceBond to stake more ADX if there's an active bond

show connected wallet on the top right corner

most Ethereum dapps show the connected wallet, usually in the top right corner

The point of this is so that the user knows which wallet they have connected, which has recently become pretty confusing with the latest metamask

Attaching a screenshot from uniswap

app uniswap org_

Logical separation between user data and total data

User data is:

  • your ADX balance (total)
    • your ADX staked
    • available on wallet
  • your rewards - ADX, DAI, total in USD; show tooltip explaienrs for both
    • show a + icon between ADX/DAI amounts to signify user earned both, and it's not an either-or
    • if we add more reward currencies in the future (eg other stables) we can just show the summarized USD amount
    • ... or alternatively, retain the same design but show total stablecoin amount instead of DAI amount
  • your bonds

While global data is:

  • Total ADX staked
  • any validator data (volume, etc.)

show projected APR/APY per pool

  • projected APR - this is calculated by poolValidatorFee * annualVolInUSD / totalStakedInUSD
  • projected yearly reward - multiply your bonds USD value by the APR
  • my stake - % - this is the least important

Rewards page

Show earnings from each payment channel individually

Show "Current APY" and "Aggregate APY" - initially we'll only show "Current"

allow the user to withdraw from specific pieces of reward separately

Farm: Incentivization program for liquidity providers

Summary

Use part of the the 5M tokens previously reserved for flash loans to incentivize ADX liquidity providers.

Liquidity providers are taking an additional inventory risk to help develop ADX markets. They are also getting fees but it'd be better if there was an additional incentive.

This was previously discussed in AIP 48.

Quick vs slow distribution

We can distribute the incentive quickly over a few weeks, or slower over months.

The quick distribution will lead to ultra high APY which might help publicity, especially since most farms are running dry.

The slow distribution will hold LPs on for longer, but in this case it becomes a competitor to normal staking pools like Tom and Loyalty. So we are leaning towards quick distribution.

Incentivized pools

  • ADX-yUSD on balancer
  • ADX-ETH on uniswap
  • ADX-ETH on sushiswap* - if sushiswap adds ADX to their weekly menu
  • ADX-LOYALTY-yUSD on balancer* - when that pool is created and ADX-LOYALTY is whitelisted
    • this pool would gain rewards from 5 places: ADX from ADX-LOYALTY, interest from yUSD, BAL from Balancer, swap fees and ADX incentives
  • LINK-ETH on uniswap* - only in implementation B
  • BAL-ETH on balancer* - only in implementation B
  • UNI-ETH on uniswap* - only in implementation B

The ADX pools should receive a reward at least 5x higher than the non-ADX pools.

Why include non-ADX pools?

To improve ADX distribution by involving the communities of projects we use or collaborate with.

Implementation A: off-chain

The originally planned implementation, partially implemented in AmbireTech/adex-validator#326

Create a payment channel on OUTPACE and distribute ADX to LPs using a script that detects when those users aquired/parted with the LP tokens.

The UI would just be one card and modal, see #60.

Implementation B: on-chain

Use the MasterChef contract with two modifications:

  • no minting, ADX would be pre-transferred to it
  • no migration

Use a traditional farm UI (like sushiswap/sake/etc.) under a new page "Farm": multiple cards for various LP pools.

If the LP tokens are held by the identity, you can still seamlessly utilize your funds (by doing unstake, utilize, stake in one TX).

Implementation A vs implementation B

Advantages of B:

  • Might increase the number of ADX holders
  • Can allocate some ADX to non-ADX LP tokens too to involve other communities such as LINK; if we do that with A, a lot of rewards may end up unclaimed
  • Transparency: rewards are guaranteed on chain
  • Easier to market is like a farm, piggybacks on the momentum of all the sushi clones; may be a bit late for that but from another PoV it will be high APY; just copying what works is sometimes better than innovating
  • Less complex/bug prone

Disadvantages of B:

  • Unable to reward Loopring LPs
    • this is negated by the fact Loopring has it's own liquidity mining system - we can distribute more ADX there
  • Cannot change distribution logic
    • but we can adjust reward % per pool dynamically
  • Requires one additional on chain tx
  • Cannot play with the distribution mechanism (eg curve it in favor of early LPs)
  • Have to audit and deploy a smart contract

Encourage usage of liquidity pools

Implement a "Get ADX" page in the staking portal that allows the user to buy ADX with ETH or a stablecoin and auto-route this to Balancer/Uniswap pools.

UX

We can link to zapper.fi or uniswap.info to help users aquire LP tokens: zapper has a particularly nice one-tx tool to get LP tokens but it's costly in terms of gas.

Before launching, make sure it's localized to Chinese and Korean too.

Make sure the UI has proper disclaimers regarding the risks, impermanent loss and the fact that distribution will end quickly.

Launch

Tease that farming will start before it actually starts: allow at least a week for marketing.

Make sure to raise awareness in channels where LP farms are traditionally promoted, and in the channels of the involved projects

Disclaimers

There should be a large disclaimer addressing two questions

  • What are the risks?
    • Impermanent loss / inventory risk
    • smart contract risk
  • Why are you doing this?
    • to improve ADX distribution/community

bug: wrong APY if rebonding

if you're opening a new bond but under the hood it will replace an existing active bond (replaceBond), the APY does not factor in that the original bond might have an early bird slot

to correct this, just use the same early bird check as the script to distribute incentives, which is whether the user has an open bond before the deadline

Help section

There should be a question mark somewhere in the UI, which, upon click opens a modal with helpful information:

  • link to ToS
  • quick explanation/guide
  • link to source code and audits
  • where to buy ADX

NOTE: this can just be a link to a blog post?

use deployAndExecute for less on-chain transactions

Use deployAndExecute with one signed tx that calls into executeBySender

Here's why this is the only way to reduce number of txns when using the identity:

  • we can't change constructor; it'd change the id addr
  • we can't change factory; it'd change the id addr
  • we can't add another contract to setPrivileges; it'd change the id addr
    • using deployAndExecute requires a few txns to be signed: transferFrom, approve, addBond - this can be 'flattened' via executeBySender

Use it when:

  • opening new bonds
  • unbonding
  • withdrawing rewards
  • restaking

Swap ADX dialog

Implement a dialog that shows if you have the legacy ADX in your wallet that prompts you to swap it to the new ADX

Lp pool card and modal

Purpose: Pool for liquidity providers
APY: dynamic

Card appearance should be like the Tom card, except:

  • no gasless and no calculator
  • short description "earn ADX by supplying liqudity on Uniswap, Sushiswap and Loopring"
  • no unbond period
  • "Provide Liqudity" button instead of stake; when you click it you get a modal with 3 options: Uniswap, Sushiswap, Loopring
    • when you click on one of the options, you get redirected to the relevant page
    • there should also be a short explainer text (you will automatically start ADX rewards if you provide liquidity) and a warning (impermanent loss)

In "Staked ADX" (which should be renamed to just "Staked") there should be a new category, "Liquidity", that shows your current provided liquidity. Unlike the others, the entries in this one will show balance in ADX and the other currency of the market pair
Eg "Uniswap | 1000 ADX, 0.5 ETH". There would be an unstake button that redirects you to the relevant page

Handle Metamask errors

When a metamask error occurs, handle it.

The possible errors are:

  • any error on window.ethereum.enable() - the initial authorization - this will manifest itself as an error with code: 4001 from loadStats
  • any error on trying to execute transactions - like user cancelling

Display a SnackBar to show the error

Add page: "My staked ADX", "New Bond" dialog to support replaceBond

Divide it into two tables: "bonds" with an explanation "bonds can only be unstaked in full amounts"; vs deposits which are "can be partially unstaked at any time" or "you can add/remove ADX at any time"

Buttons for bonds:

  • request unbond - shows up when the bond is active
  • unbond - shows up after the bond is ready for unbonding
  • rebond - shows up when the bond is waiting for unbonding - will open the New Bond dialog but pre-configured to replaceBond
  • add more ADX - will do the same as the previous thing but show up when the bond is active

NOTE: when the new bond dialog is open in rebond mode, it should make it clear that the amount set is added to an existing bond.

By default, the new bond dialog should not use replaceBond unless the user used "Add more ADX"

potential bug if there's ADX on the identity

potential bug: if there's ADX on the identity and the account is created, the amnt will be automatically staked which is not taken into account in actions createNewBond - so there wouldn't be enough ADX to make the bond

this will make transactions fail if ADX is sent to the identity directly beforehand

Gasless restaking

add a re-stake button to the gasless staking page

should be disabled either in case of a relayer error or the user doesn't have more than 5k incurred ADX rewards

Better reward styling

  • more (pastel) color in the reward design
  • show DAI/ADX separately with explainers for both
  • maybe: ability to claim separately

support Trezor and Ledger directly

turns out the UX of MetaMask is quite confusing for many users, and as our priority is now on UX, it would be good to support Trezor and maybe Ledger directly through ethers providers

Most of the DeFi apps, including BASED and etc. have this multi provider dialog that we can use

We might try this https://github.com/Web3Modal/web3modal but it doesn't support Trezor/Ledger as of now; but this does: https://github.com/NoahZinsmeister/web3-react and it's used by yearn and BASED

Staking Landing page Texts

Screenshot 2020-09-23 at 11 43 37

H1: Earn rewards by staking ADX
Text box: Мaximize your ADX holdings by staking, rather than just let them sit in your wallet! By staking your assets you provide stability to the AdEx Platform and earn additional ADX as rewards in return. You can claim rewards right away or re-stake for compounding interest.

Button: Stake now
Button: FAQ

Disclaimer: ⚠️Warning: the annual percentage yield is calculated based on the current staked amount. With more ADX staked, the amount will decrease: Read more.

Screenshot 2020-09-23 at 12 00 11

H1: How to start
Step 1: Get ADX
Step 1 text: Buy ADX tokens or fund your wallet with ADX and some ETH for gas.

Step 2: Select a pool
Step 2 text: Choose from the available pools to stake your ADX to. Currently there's only one pool available but soon there will be more added.

Step 3: Earn ADX
Step 3 text: Check your dashboard to see accumulated rewards. You can claim them or re-stake them for compounding interest.

Gasless stake tooltip: Coming soon

Make "Generated rewards" number animated

image

Make this number grow all the time while user browses the website. Calculate the rate of how ADX rewards grow or just add 0.01$ each 5 seconds or whatever works, so that it triggers FOMO in users while browsing

Staking APY is calculated lower than it actually is because of unbonding

Staking APY is calculated lower than it actually is cause it does not account for requested-to-be-unbonded bonds

Potential solution: on the validator distribution scripts, add data to approximate the APY (approx reward per period) in each reward channel - then sum that up on the UI; this would also help #45 display individual APY for each reward source

Also, add a poolId prop to each reward channel on the validator side, as this can help the staking portal determine where each reward comes from

Update AdEx Staking Newsletter Subscribe Form

As we finished the staking subscribe promo, we need to update forms accordingly. There are 3 forms currently - on the Landing Page (1), on the Dashboard (2) and on Exit Intent Popup (3).

Screenshot 2020-11-02 at 16 35 11
2.
Screenshot 2020-11-02 at 16 35 23
3.
Screenshot 2020-11-02 at 16 35 49

On 1 and 2 we change the text to:

Subscribe for AdEx News for exclusive content [bold is in yellow]

On 3 we change the text to:

Subscribe for AdEx News and don't miss Staking tips and insights [bold is in yellow]

On all forms we can remove the checkpoint that says: "I agree to the promotional T&C" . The other one stays

Implement reward distribution

rewards will be distributed via an OUTPACE channel - a separate channel will be used for each month

There'd be a script on the validators which will monitor Log* events and calculate the reward for each staker

Tasks for the script:

  • every day, it withdraws all the earned validator fees from existing campaigns - this is already handled by routineAuthsLoop
  • monitor Log events for bonds, divides into daily periods, calculates distribution
  • opens a payment channel for each past month (distribution period) and uploads the balance tree and signatures to the validator DB

Tasks for the UI:

  • pull info from the outpace channels
  • calculate total rewards
  • button for withdrawing rewards that issues a channelWithdraw tx

Design for email leadgen subscribe field on the Staking platform and landing page

We need to include a simple yet eye-catching promotional leadgen form and add it to the staking landing page and the staking portal (not sure about the latter, but however the design is one). This is related to this issue in Marketing .

To incentivize people to give us their emails we will run a promotion - 5 lucky subscribers will get 1000 ADX each. This is pretty good number for just giving your email address so it should be appealing and straightforward.

The form itself will containing placeholder for email, Subscribe button and "I want AdEx Network to send me information about news and promotions"

The form has to be in a box or something and have a promotional heading: "Subscribe for AdEx News and win 5x1000 ADX!"

Can you please design the form so that it can "live" in a popup window too? It will be optimal if we test exit-intent popup but more important is to have the form on the landing page on first place.

Form validation: max amount

Right now, the form doesn't allow you to enter a higher amount than the maximum

It should allow you, but display an error

This would prevent mistakes like sloppily entering an amount, adding another 0, and having the amount automatically set to the max amount you have.

EDIT: as Vanina pointed out, this is also good in case you're opening the UI with 0 ADX. Cause otherwise it looks broken (you're not able to enter any amount)

Gasless staking

Implement a feature where users can simply send ADX to an address (no matter where from) and it will be staked via the AdEx Relayer, if it's over a given threshold, upon calling a route (newly implemented) on it

If under the threshold, the user may stil stake it through the UI

Using this feature, you will be able to stake directly from Binance

Originally this feature was planned to be automatic but later on we decided to have it be triggered manually with a button, cause:

  • enables users to 'gather' ADX from multiple places to reach the threshold
  • enables users to send test transactions to ensure things are working - reflect this in the UI (@alesinka)
  • enables doing this more than once, as well as if the identity is already deployed - as we can prompt the user to sign the transactions authorizing addBond
  • easier implementation in the relayer

We must also explain to the user by "explain this address" note: explain it's an autogenerated smart contract

Relayer route

The relayer route must:

  • use the staking code to calculate the identity addr on demand to ensure that it's the correct one
  • measure the total ADX staked/owned by this account - allow transactions only if it's over the threshold amount
  • allow transactions only if there isn't one in the last N hours

Otherwise it will be a pretty generic deploy-or-execute type of thing, same as /identity/execute

"Stake more"/"Reinvest" button

Feature description: when the user withdraws rewards, ask if they'd like to withdraw or they'd like to "stake more", which will buy ADX with the DAI and add another bond

this willenable users to opt into generating more revenue for the future vs withdrawing it all now

Under the hood, it can work via uniswap v2

This will be especially useful if we implement staking for publishers: they'll be able to increase their limit by buying ADX with DAI and staking.

Prerequisite dialog for two step processes

Implement a stepper or a prerequisite dialog in cases where two consecutive transactions are required\


If all txes can be generalized in a way that they're two that have pre-requeisites, make a dialog that shows up and doesn't disappear until the first thing is done

  • an exception can be first-time bonding which could be gasless
  • convert tokens (approve + swap)
  • open a bond (transfer+deploy OR approve+call OR approve+deployAndExecute with a sign popup)

Calculate post-slashing amount to show it in the bond table

Instead of Amount, show "Initial amount" and "Amount"

The initial amount is the original bond.amount

The current amount should be the amount we can withdraw. We can calculate it by getting all LogSlash, keeping the last slash points for each pool, and using bond.slashedAtStart and the final slash pts for each pool.

Popup "Stake your ADX" after successfully upgrading your ADX

The AdEx upgrade modal should transform to "Sucess! You've upgraded your ADX" popup which also includes a suggestion to stake the ADX for added rewards

Even though this is the staking portal and the ability to stake is everywhere, a popup should help with the psychological appeal of staking

Show staking pool cards

show cards for each staking pool, including the ones that are not launched yet (with a "Coming soon" tag)

Each card should show the approx APY, slashing conditions, button to stake, button to stake gasless

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.