ambiretech / adex-staking Goto Github PK
View Code? Open in Web Editor NEWThe Staking UI: allows users to stake ADX tokens on the AdEx Registry (Validator pools)
The Staking UI: allows users to stake ADX tokens on the AdEx Registry (Validator pools)
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:
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
Reward users for:
We can gamify it by adding badges too, similarly to how the platform does it when you're a new user.
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.
Basically it's all very gamable so we have to figure it out as much as possible
Consider showing all staking pools, with icons/images, APY and risks
@samparsky already started working on this in #41
Assigning to @paunov to merge and test
NewBondForm
use 10**18
units; use formatUnits
/parseUnits
deployAndExecute
if neededreplaceBond
to stake more ADX if there's an active bondUser data is:
+
icon between ADX/DAI amounts to signify user earned both, and it's not an either-orWhile global data is:
poolValidatorFee * annualVolInUSD / totalStakedInUSD
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
Will enable using the staking portal with Argent, TrustWallet, imToken, among others
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.
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.
The ADX pools should receive a reward at least 5x higher than the non-ADX pools.
To improve ADX distribution by involving the communities of projects we use or collaborate with.
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.
Use the MasterChef contract with two modifications:
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).
Advantages of B:
Disadvantages of B:
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.
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.
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
There should be a large disclaimer addressing two questions
Similar to #33
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
There should be a question mark somewhere in the UI, which, upon click opens a modal with helpful information:
NOTE: this can just be a link to a blog post?
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:
deployAndExecute
requires a few txns to be signed: transferFrom, approve, addBond - this can be 'flattened' via executeBySenderUse it when:
Implement a dialog that shows if you have the legacy ADX in your wallet that prompts you to swap it to the new ADX
Purpose: Pool for liquidity providers
APY: dynamic
Card appearance should be like the Tom card, except:
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
When a metamask error occurs, handle it.
The possible errors are:
window.ethereum.enable()
- the initial authorization - this will manifest itself as an error with code: 4001
from loadStats
Display a SnackBar to show the error
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:
replaceBond
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 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
Can be solved by adding a "Rebond" button on the table in "Staked ADX"
This can be done via replaceBond
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
solution would be to apply OUTSTANDING_REWARD_THRESHOLD
only on DAI channels
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
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:
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
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
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).
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
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:
Tasks for the UI:
channelWithdraw
txWe 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.
Enable withdrawing rewards, either with executeBySender
or deployAndExecute
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)
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:
addBond
We must also explain to the user by "explain this address" note: explain it's an autogenerated smart contract
The relayer route must:
Otherwise it will be a pretty generic deploy-or-execute type of thing, same as /identity/execute
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.
because the nonce is always set to 0, you won't be able to open two identical bonds
This hasn't been tested though
A simple solution would be to set the nonce to seconds since epoch
Split out certain methods or components from App.js
since it's pretty large and monolithic
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
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.
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 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.