SpartanDev:17/05/21–23/05/21

Deflationary feeBurn | TokenV2 | Ongoing BUIDl

SpartanProtocol
11 min readMay 24, 2021

Summary

With the SPARTAv2 (Token) now deployed to mainnet; a contributor took the time to discuss some of the intricacies and opportunities involved with the new ‘feeBurn’ in the transfer function.

The feeBurn has been in action since the first SPARTAv2 token transfer. It starts at 0% and grows/shrinks with the token’s total supply. The feeBurn is set to be 1% *if* the token’s total supply is at the max (300M) however the max supply is programmatically impossible to reach. Read more about this new deflationary aspect below:

In just over a week of SPARTAv2 (token) upgrade DApp going live, we have already seen over 700 users and 32 Million SPARTA upgraded to SPARTAv2. (This was also during a period where seasoned crypto participants have probably taken a smart move in steering clear of socials/blockchain and enjoying some fresh air)

BSCSCAN.com Screenshot 23 MAY 21: https://bscscan.com/token/0x3910db0600ea925f63c36ddb1351ab6e2c6eb102

To acquire SPARTAv2 (token), 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 towards.

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 has been done to highlight that the original goal has not changed. This 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:

Massive thanks to PeckShield for helping provide resources to one of our community contributors who worked on getting this snapshot! They were also very swift to reach out after the LP-drain and provide their advice and support to help understand and move forward.

Huge thanks also to Chiachih Wu for personally reaching out to some of the contributors and providing generous advice and support with the exploit and also the snapshot process.

All contributors who had interactions with PeckShield & Chiachih Wu throughout this process have reported very incredible generosity with their time and impressive knowledge. Can pretty confidently state that we wouldn’t have this snapshot right now without your help!

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

Add Deflationary Mechanism

Implement deflationary mechanisms (burn SPARTA on each transfer)

Phase 2 — Spartan Protocol V2 (Protocol)

SPARTA V2 (Token) — CEXs

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 CEX: Pending completion
  • BKEX: Pending completion
  • MXC: Pending completion

SPARTA V2 (Token) — DEXs

Work with DEXs & aggregators to ensure the new SPARTA token address is added to their lists. All AMMs that already have SPARTAv1 in their selection lists have been reached out to and the ball is rolling on getting SPARTAv2 added or SPARTAv1 replaced with SPARTAv2.

SPARTA V2 (Token) — BSC Scan (Complete):

SPARTA V2 (Token) — TrustWallet (Complete):

SPARTA V2 (Token) — CoinGecko (Submitted):

SPARTA V2 (Token) — CoinMarketCap (Submitted):

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
  • At the same time; continue adding automated tests and review the code within the community
  • Update contracts based on results from CodeArena and other reviews

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 Spartan 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

Project-Level

  • Rename/adjust file structure to highlight contracts from each state (V1 before, V1 mainnet, current state, V2 previous & V2 future)

contracts/Dao.sol

  • Initial DAO contract to work from

contracts/Pool.sol

  • Refactor out interfaces to imports reducing the contract size
  • Decimals — unit256 changed to unit8
  • Cull newDAO code (migration feature; no longer relevant) to reduce lines of code
  • transfer() — Add ‘virtual’ & change ‘to’ to ‘recipient’
  • Bring in the new increase/decrease allowance, approve and transferFrom functions
  • Bring in approveAndCall & transferAndCall
  • _transfer() — Add/update checks and make the arguments more human-readable. Also add ‘virtual’
  • _mint() — Add check for 0x address. Also add ‘virtual’
  • burnFrom() — More human readable args. Remove ‘override’. Use the new allowance/approval functions
  • transferTo() — Remove function; no longer relevant
  • addLiquidity() — Changed to add() & ‘public’ changed to ‘external’
  • addLiquidityForMember() — changed to addForMember()
  • removeLiquidity() — Changed to remove() & ‘public’ changed to ‘external’
  • removeLiquidityForMember() — changed to removeForMember()
  • swap() — ‘public’ changed to ‘external’
  • mintSynths() — Changed to mintSynth()
  • burnSynths() — changed to burnSynth()
  • sync() moved to ‘Balances’ section

contracts/Reserve.sol

  • onlyGrantor() — Updated with relevant addresses
  • Added setIncentiveAddresses()
  • Added purgeDeployer()
  • Removed newDao refs (No longer relevant)
  • addLiquidity() — Changed ‘public’ to ‘external’
  • Updated refs to changed POOL contract function names (see above)
  • zapLiquidity() — Changed token-scope to pool-scope. Changed ‘public’ to ‘external’
  • Changed ‘Asym’ refs to ‘single’ (mostly in function names)
  • removeLiquidity() — Changed ‘public’ to ‘external’
  • removeLiquidityAsymForMember() — Changed to shorter removeLiquiditySingle() & changed to ‘external’. Refactored function
  • buyTo() — Changed to return only the ‘fee’
  • swap() & swapTo() — Removed the return
  • currentPoolRevenue() — changed to ‘view’
  • pastPoolRevenue() — changed to ‘view’

contracts/Sparta.sol

  • approveAndCall() & transferAndCall() & flipEmissions() — changed to ‘external’
  • purgeDeployer() — removed return
  • feeOnTransfer — hard-coded max set to 500 bp

contracts/Synth.sol

  • Refactor out interfaces to imports reducing the contract size
  • Cull newDAO code (migration feature; no longer relevant) to reduce lines of code
  • transfer() — Add ‘virtual’ & change ‘to’ to ‘recipient’
  • Bring in the new increase/decrease allowance, approve and transferFrom functions
  • Bring in approveAndCall & transferAndCall
  • _transfer() — Add/update checks and make the arguments more human-readable. Also, add ‘virtual’
  • _mint() — Add check for 0x address. Also, add ‘virtual’
  • burnFrom() — More human-readable args. Remove ‘override’. Use the new allowance/approval functions
  • transferTo() — Remove function; no longer relevant

contracts/Utils.sol

  • Initial UTILS contract to work from

contracts/poolFactory.sol

  • Add DAO interface import
  • Remove newDao refs; no longer relevant
  • Remove curatedPools
  • Removed sorting and challenging lowest curated pools logic
  • Add isPool() helper
  • Remove curated pools helpers

contracts/synthFactory.sol

  • Remove newDao refs; no longer relevant

Interfaces

  • Updated all interfaces to reflect any contract name, arg or return changes

test/1_pool.js

  • Update tests

test/2_swap.js

  • Update tests

test/3_dao.js

  • Update tests

test/9_daoDeposit.js

  • Update tests

GitHub Activity — SpartanDAppV2

public/index.html

  • Update meta titles to include ‘synthetics’ keyword

src/Providers.js

  • Cleanup — change AdminLayout -> Common

src/assets/css/spartan-icons.css

  • Add GitBook icon

src/assets/css/styles.css

  • Handle min-height of content properly with footer + header heights handled correctly
  • Added zoom class

src/assets/scss/spartan/custom/_footer.scss

  • Cleaned up footer styling

src/components/Common/LanguageDropdown.js

  • Multiple English flags; dynamic based on browser’s locale (AU, US, GB)
  • Changed language names to be shown in the native language (ie. Greek -> Ελληνικά)
  • Changed DropdownItem to Button
  • Restyled and refactored

src/components/DataManager/DataManager.js

  • checkNetwork() — refactor localstorage refs to a const variable
  • checkArrays() — enable actions to run on mainnet. Add in getSpartaGlobalDetails() && getBondSpartaRemaining() && getReserveGlobalDetails() to the loop

src/components/Footer/Footer.js

  • Clean up footer style/structure
  • Change <I> classed icons to <img>
  • Add in tooltips to show what each icon represents (for users who don't recognise the icons)

src/components/RecentTxns/RecentTxns.js

  • Add in translations

src/components/Supply/Supply.js

  • Update supply/tokenomics dropdown
  • Added hardcoded ‘Burn’ & ‘Bond’ figures for distro from V1
  • getTotalSupply() — Handle properly; it now uses: SPARTAv1 totalSupply plus SPARTAv2 totalSupply
  • getCirculatingSupply() — Handle properly; it now uses: getTotalSupply() minus SPARTA in reserve & bond contracts (released but non-circulating SPARTA)
  • getMarketCap() — This now multiplies the circulating supply * SPARTA token price
  • Enabled this component to show up on mainnet too now that it’s handled correctly
  • Visually show the v1 vs v2 circulating tokens
  • Visually show the distribution of totalSupply based on whether they were allocated via Burn, Bond or Emissions
  • Make the mapped out contracts more compact with 2 Cols

src/components/WalletSelect/WalletSelect.js

  • Refactor wallet connect/reset/check logic
  • Enable wallet balances/assets on mainnet now that the actions are not bypassed

src/components/WalletSelect/walletTypes.js

  • Metamask inject changed to undefined to allow for part of the refactor in WalletSelect.js

src/components/layout/Common.js

  • Cleanup and refactor

src/store/pool/actions.js

  • getListedTokens() — Check for valid poolFactory; if not the contract will not be called and the array will only include spatav1 & spartav2
  • getCuratedPools() — Check for valid poolFactory; if not the contract will not be called and the array will be empty
  • getTokenDetails() — Refactor; cleanup. We no longer use UTILS to get all this info; we simply call a max of 2 contract calls per asset. We now use static token icons for SpartaV1, SpartaV2 & BNB

src/utils/web3.js

  • getWalletProvider() — refactor
  • getTokenContract() — removed
  • getWbnbContract() — removed

src/utils/web3Contracts.js

  • Added getSpartaV1Contract() specifically for SPARTAv1 interfacing
  • Changed getSpartaContract() to getSpartaV2Contract() for specific SPARTAv2 interfacing

src/views/pages/Pools/AddLiquidity.js

  • Added handleAddLiquidity() to handle input amount if the user is inputting a BNB amount and not leaving enough for gas

src/views/pages/Pools/BondLiquidity.js

  • Added handleBondDeposit() to handle input amount if the user is inputting a BNB amount and not leaving enough for gas

src/views/pages/Swap/Swap.js

  • Added handleSwapAssets() to handle input amount if the user is inputting a BNB amount and not leaving enough for gas

src/views/pages/Synths/Overview.js

  • Added handleSwapToSynth() to handle input amount if the user is inputting a BNB amount and not leaving enough for gas

src/views/pages/Upgrade/Overview.js

  • Moved getSpartaGlobalDetails() to DataManger

src/views/pages/Vault/Overview.js

  • Moved getReserveGlobalDetails() & getSpartaGlobalDetails() to DataManger
  • That left no requirement for the getData() loop; so it was removed

GitHub Activity — SpartanSite

css/style.css

  • Add zoom and tooltip classes

dao.html

  • Header meta tags updated
  • Nav, body and footer content updated

faq.html

  • Header meta tags updated
  • Nav, body and footer content updated

index.html

  • Header meta tags updated
  • Nav, body and footer content updated

lending.html

  • Header meta tags updated
  • Nav, body and footer content updated

pools.html

  • Header meta tags updated
  • Nav, body and footer content updated

synths.html

  • Header meta tags updated
  • Nav, body and footer content updated

Project Information

Official Links

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.

--

--

SpartanProtocol

Incentivized liquidity and synthetic asset generation for Binance Smart Chain. https://SpartanProtocol.org