SpartanDev:10/05/21–16/05/21
GitBook Refresh | Upgrade/Claim $SPARTA v2| Testnet DAppV2
Summary
The development community over the last week have been working hard to improve and deploy version 2 of the SPARTA token. SPARTAv2 (token) has been tested and deployed onto the mainnet, please read the below medium article for more details on how to:
- Upgrade existing v1 tokens to v2 (Mainnet & Testnet)
- Claim your share of SPARTA allocated to users impacted by the LP drain (Mainnet & Testnet)
- Interact with DAppV2 to help test the V2 contracts (Testnet)
Spartan Protocol GitBook
Some new & old community members have put their hands up recently to help get the Spartan Protocol GitBook to reflect current progress and iterations of the protocol — head over and check it out to learn more.
This will be an ongoing focus for the wider community to contribute to.
Recent Medium Articles
The Road To SPARTAv2
The Road Ahead
What Happened
Spartan Socials — Twitter
Top Impressions:
Top Engagement:
Top Community Mention:
SpartanSocials — Medium
SpartanSocials — Telegram
Contributor’s Focus
The contributor focus moving forward has been broken into rough phases. This is done to highlight that the original goal has not changed but also acknowledges and embraces the fact that there is some rebuilding required in order to get there.
Phase 1 — SPARTA V2 (Token) — Completed!
Affected Users Snapshot
A snapshot of the state of all user’s liquidity holdings (Wallet Holdings, DaoVault Staked & Bond Locked) was taken from a block height of just before the V1 LP drain. This was cross-referenced with the depth of the pools to work out the SPARTA units that were taken from liquidity providers. See the result below:
Deploy New $SPARTA V2 (Token)
Deploy Upgrade DApp
- The above-weighted claims (from the snapshot) are plugged in for affected users to claim via the bridge dapp
- Implement deflationary mechanisms (burn SPARTA on each transfer etc)
Phase 2 — Spartan Protocol V2 (Protocol)
SPARTA V2 (Token)
- Work with the CEXs to ensure the SPARTA holders all have their tokens upgraded as easily as possible. One would expect the exchanges to handle this for them (Binance, BKEX, MXC etc)
- Work with DEXs & aggregators to ensure the new SPARTA token address is added to their lists
- Work with token-tracking information websites to ensure new token info is added and verified (BSCscan, CoinGecko, CoinMarketCap etc)
SpartanContracts
- Continue updating V2 contracts to suit the changes to the base contract and get it finalised ready for the CodeArena bounty
- Put the contracts through a code review process on CodeArena
- Continue the code review process within the community
DAppV2
- Update the DAppV2 to suit any changed contracts
Community Forum
A community forum for longer-form & categorised discussion has been created in GitHub: join the discussion here.
- Setup categories & get the community contributing good questions about DAO proposals & mechanics of AMMs so that they can be padded out into longer-form go-to guides to post in the channels
Phase 3 — Deploy & Iterate
- Deploy Protocol V2 to mainnet
- Enable Bond allocations to get TVL into the V2 pools
- Deploy Lending to testnet
- Continue ahead with the previous plans!
GitHub Activity — SpartanContractsV2
V2/RouterV2.sol
- Replace old transferTo() function with transferFrom()
contracts/DaoV2.sol
- Cull DAO right down to gradually move in functions as tests are built
contracts/FallenSpartans.sol
- Add event — SpartanAllocated
- Add event — SpartanClaimed
- Remove totalToClaim / params; instead allocate specific amount via function
- Added helper function to ‘getClaim’
contracts/Reserve.sol
- Created simple reserve contract for interim (before V2 protocol)
contracts/Sparta.sol
- Changed token name to: “Spartan Protocol Token V2”
- Changed ERC-20 refs to BEP-20
- Changed sFS -> savedSpartans
- Remove currentEra param
- Refactor onlyDao log: “Must be DAO” -> “!DAO” (to reduce contract size)
- Drop secondsPerEra to test emissions (temporary)
- decreaseAllowance() — add checks for whether allowance requires a decrease of that size; approval() goes after checks
- _approve() — add check if approval is already at max (if so; approval-increase can be skipped)
- transferFrom() — add check for allowance > amount
- Refactor some require() error messages
- _burn() — added check for balance > amount
- saveFallenSpartans() — added arg for amount (call in the amount instead of hard-coding it into the contract) can only be called once
- upgrade() — add comments
contracts/synthVault.sol
- Refactor out the interfaces for imports
test/8_Base.js
Add automated tests for base contract
- Test deploying the contract
- Test burn function
- Test approvals / allowance
- Test emissions
- Test feeBurn
- Test upgrade, mint and allocation to sFS
GitHub Activity — SpartanDAppV2
public/index.html
- Updated meta tags for DApp — still need to update the public folders images in the manifest but most of the of & twitter tags seem to be final now
src/Providers.js
- Added tryParse() so that if a relevant localStorage item is missing, modified or corrupted; the app doesn’t break
- Removed /dapp/ portion of the routes
src/components/Approval/Approval.js
- Made approval button less tall and wide
src/components/AssetSelect/AssetSelect.js
- Added tryParse() so that if a relevant localStorage item is missing, modified or corrupted; the app doesn’t break
- Added filter to not allow SPARTAv2 to show up in assetSelect (testnet pools are still using SPARTAv1 contract + mainnet has no pools)
- Replaced negative margins for ‘position: absolute’ and ‘left: right: top: bottom:’ designators (negative margins don't seem to work properly in safari)
- Added checks to ensure the app doesn't break if certain components load before the data is ready
src/components/Common/LanguageDropdown.js
- Added every locale from the community google sheet translation (we will need the community to now pull together to help translate each phrase for all languages; a lot of the translations won't make sense as they were from before there was the context within the dapp)
- Change icon to a relevant country flag (for community review; obviously flags don't = languages, but it’s fun and pretty to look at; open to ideas here)
- Converted the dropDown component into a popOver component
- Refactored each language item using .map()
src/components/Common/ThemeSwitcher.js
Added ThemeSwitcher component for switching between dark/light mode themes
src/components/Common/WrongNetwork.js
Added a WrongNetwork component, temporarily for use as an alert for mainnet users trying to interface with the features that are not eat available on mainnet. In the future, this will be an alert for users with their wallets connected to Ethereum and other non-supported networks
src/components/DataManager/DataManager.js
- Added tryParse() so that if a relevant localStorage item is missing, modified or corrupted; the app doesn’t break
- Refactor how the networks are handled in preparation for going live with the Upgrade DApp
- Check and change the network whenever the local storage ‘network’ item changes
- Update the listedTokens & curatedPools arrays every 10 seconds or if the network changes
- Check SPARTA token price every 10 seconds
- Update the tokenDetails & synthArray every 7.5 seconds or if the wallet or listedTokens change
- Update the listedPools whenever tokenDetails changes
- Update synthDetails & poolDetails whenever listedPools changes
- Removed refs to old store actions that no longer exist
src/components/Header/Header.js
- Remove commented-out code
- Add in the ThemeSwitcher component
src/components/RecentTxns/RecentTxns.js
- Cleaned up recentTxns component
- Changed old refs to old store actions to the new ones
src/components/Share/SharePool.js
- Added tryParse() so that if a relevant localStorage item is missing, modified or corrupted; the app doesn’t break
- Added checks to asset1 & asset2 for the same reason as above
src/components/Supply/Supply.js
- Added fallenSpartans contract item
- Added check for the selected network to handle hiding tokenomics on mainnet (until after new contracts)
- Added function to getTotalSupply
- Added function to getMarketCap
- Added placeholder function to getCirculatingSupply (need to plug in the relevant removals from supply ie. Reserve etc after new testnet contracts are deployed)
- Added selected network to supply popover
src/components/WalletSelect/WalletSelect.js
- Changed all ‘mainnet’ and ‘testnet’ checks to use chainId instead
- Reload window on wallet disconnect or network change (makes sense to clear all stores when a major change like ‘network’ or ‘wallet’ happens to ensure no crossover of front-facing information)
src/components/layout/Common.js
- Remove /dapp/ from routes
src/i18n.js
- Constructed the objects for every language/translation
- Removed the hard-coded ‘en’ selector (detects browser settings for language first, if fails then ‘en’)
- Will use the last setting you used within the dapp as a priority though
src/routes.js
- Added ‘upgrade’ component to the routes
- Made all nav icons smaller
- Removed /dapp/ from all routes
src/store/pool/actions.js
- Handle SPARTAv1 & SPARTAv2 differently in the poolArrays
- SPARTAv1 will show up as SPARTA (old) and SPARTAv2 will show up as SPARTA
src/store/sparta/actions.js
- Added genesis of fallenSpartans contract to the sparta store actions (to work out expiry())
- Added upgrade() function to actions (Upgrade V1 SPARTA to V2)
- Added claim() function to actions (Claim SPARTA from V1 LP-drain)
- Added helper function to check the claim (claimCheck())
- Removed old actions
src/utils/web3.js
- Added fallenSpartans ABI & address
- Added new base contract ABI & address
- Commented out a problematic testnet RPC: ‘https://data-seed-prebsc-2-s3.binance.org:8545/'
- Added in mainnet backup RPCs (but commented out)
- Added tryParse() so that if a relevant localStorage item is missing, modified or corrupted; the app doesn’t break
- Changed mainnet back to the default network
src/utils/web3Contracts.js
- ‘addr’ was causing stale addresses on network change; removed it and call the function direct throughout this file
- Added getTokenContract()
- Added getFallenSpartansContract()
src/utils/web3Utils.js
- Added calcBurnFee() function
src/views/pages/Bond/Bond.js && BondItem.js
- Hide bond component if mainnet is selected
- Inject the translations throughout the component
src/views/pages/Pools/Liquidity.js && all sub-components
- Added tryParse() so that if a relevant localStorage item is missing, modified or corrupted; the app doesn’t break
- Hide liq components if network = mainnet
- Handle ‘addr.spartav1’ throughout instead of ‘addr.sparta’
- Inject translations throughout
src/views/pages/Swap/Swap.js && all sub-components
- Added tryParse() so that if a relevant localStorage item is missing, modified or corrupted; the app doesn’t break
- Hide swap components if network = mainnet
- Handle ‘addr.spartav1’ throughout instead of ‘addr.sparta’
- Inject translations throughout
src/views/pages/Synths/Overview.js && all sub-components
- Added tryParse() so that if a relevant localStorage item is missing, modified or corrupted; the app doesn’t break
- Hide synth components if network = mainnet
- Handle ‘addr.spartav1’ throughout instead of ‘addr.sparta’
- Inject translations throughout
src/views/pages/Upgrade/Overview.js && Upgrade.js
- Created the ‘Upgrade DApp’ component
- Allow users to upgrade their V1 SPARTA into V2 SPARTA
- Allow users to check if they had LP affected by the v1 LP-Drain and make a claim if so
src/views/pages/Vault/Overview.js && all sub-components
- Added tryParse() so that if a relevant localStorage item is missing, modified or corrupted; the app doesn’t break
- Hide vault components if network = mainnet
- Handle ‘addr.spartav1’ throughout instead of ‘addr.sparta’
- Inject translations throughout
GitHub Activity — SpartanSite
dao.html
- Content added to DAO page
- Added GitBook link to footer
Project Information
Official Links
- Website: https://spartanprotocol.org/
- GitBook (Docs): https://docs.spartanprotocol.org/
Community Contribution
Spartan Protocol is at its core, a community-driven and led project. In this vein, the more contributors the better. There is a great opportunity for community members to contribute by making LP reward analysis tools, etc.
Recently, community members have been graciously funnelling in to contribute to explainer articles, ideas and even $SPARTA donations to support the growth of the platform.
Engage with the community and contributors
Where to find out about all the latest updates or suggest improvements — get involved.
- Medium: https://medium.com/spartanprotocol
- Twitter: https://twitter.com/spartanprotocol
- Telegram Community: https://t.me/spartanprotocolorg
- Telegram Announcements: https://t.me/spartanprotocolann