SpartanDev: 30AUG21 - 05SEP21

Dev Update

SpartanDev: 30AUG21 - 05SEP21

It's the start of September and things are heating up. Automated testing is in the final stages and Testnet is being prepared for deployment!

SpartanDev: 30AUG21 - 05SEP21

Summary

Welcome, Spartans! It's getting really close & exciting now! With automated testing in the final stages and a lot of the broader discussion points reaching closure, we are finally seeing something that looks like a ready-for-testnet on GitHub.

This week saw automated testing extended to the more complex areas of the protocol (DAO proposals, Vault claims, dividends/incentives & Bond etc) and the Spartan website's text content receiving a bit of a much-needed refresh. The Spartan community also put the final stages of the official blog into place (from which this post is being published officially for the first time)

In terms of what's next before TestNet; it's really just closure of remaining discussion points and the SynthVault automated tests. Be on the lookout for explainers soon on how to get involved in TestNet once it's publicly announced!

Wednesday feeBurn Update

Spartan Socials - Twitter

Top Impressions:

Top Engagements:

Top Community Mention:

SpartanSocials - Medium

SpartanSocials - Telegram


Contributor's Focus

CodeArena Contest

  • COMPLETED βœ… β€” triage and prioritise the feedback submitted from the CodeArena wardens during the contest to prepare for the judges
  • IN PROGRESS β€” work through the post-contest tasks with the C4 judges & team for the eventual allocation of awards to security wardens
  • IN PROGRESS β€” communicate with security wardens to clarify/expand on feedback

Once these tasks above are completed, the CodeArena report will be published, and Spartans will be able to review the final list of findings to understand how the changes that have already been implemented into Spartan Protocol (in the PostC5 repository) fit into this greater picture.

As discussed previously, we continue to build and refine code in parallel with the CodeArena post-contest actions.

SPARTA V2 (Token)

  • COMPLETED (& ONGOING) β€” Work with DEXs & aggregators to ensure up-to-date information on the new SPARTA token (retiring the previous contract address) (1inch, PancakeSwap etc.)
  • COMPLETED βœ… β€” Work with token-tracking informational websites to ensure new token info is up-to-date (BSCscan, CoinGecko, CoinMarketCap)

SpartanContracts

  • COMPLETED βœ… β€” Sort and prioritise all CodeArena submissions into contract scopes along with tags based on β€˜actionable’ or β€˜discussion points’
  • COMPLETED βœ… (only minor changes as required from now on) β€” Implementing refinements to contracts to address C4 & contributor feedback since the C4 contest code-freeze
  • IN PROGRESS β€” Rebuild automated testing
  • Deploy updated V2 contracts to BSC testnet for at least 1 week of community stress testing
  • Deploy completed V2 contracts to BSC mainnet

DAppV2

  • COMPLETED (& ONGOING) β€” Set up a reliable index of history scoped to contracts (use this for positions page etc)
  • IN PROGRESS β€” Update the DApp to suit the contract changes
  • IN PROGRESS β€” Use the new testnet subgraph to build a more lightweight positions page for V2

After Mainnet

  • Enable Bond allocations to replenish TVL into the V2 pools
  • March onwards with our original goals of building the decentralised, yield-generating synthetics protocol on Binance Smart Chain

GitHub Activity β€” Spartan Contracts v2

Branch: "PostC5"

contracts/BondVault.sol

  • Updated naming of function to get all listed bond assets from DAO
  • Moved calcBondedLP() above similar functions

contracts/Dao.sol

  1. Added cancelPeriod variable for DAO proposals (so it can be set/not hardcoded):
  • Added cancelPeriod variable & set it in constructor
  • Added setDaoFactors() function for DAO-specific variable setters (daoClaim, daoFee, running, cancelPeriod)

2. Reduced the setters inside setGenesisFactors (see setDaoFactors above)

3. bond() - function changes:

  • Changed the isListed check to use pool address
  • Adjusted ROUTER.addLiquidityForMember() args to suit the changes to that function

4. _claim() function changes:

  • Removed calcClaimBondedLP() - refactor logic to BondVault
  • Get pool address and hand it into BondVault.calcBondedLP() instead of the now-removed calcClaimBondedLP()

5. cancelProposal() - use cancelPeriod instead of hardcoded value

6. _moveReserve() - transfer oldReserve funds to newReserve on upgrade

7. _listBondingAsset() && _delistBondingAsset() - use pool address instead of asset

contracts/Pool.sol

  1. Variable changes:
  • Removed collateral variable
  • Added oneWeek variable
  • Added stirRate variable
  • Added lastStirred variable
  • Added initialPeriod variable
  • Added stirStamp variable

2. mintSynth() - removed virtualisation logic in favour of a more-pegged rate (minted synths will now be locked straight into the synthVault and only unlocked after 24hrs combatting manipulation with time rather than fees)

3. burnSynth() - removed virtualisation logic in favour of a more-pegged rate with instead a flat % rate-fee on burn (burn rate will be slightly less pegged than an equal swap using the underlying assets)

4. stirCauldron() - new function added to regulate synthCap:

  • Called every mintSynth to handle the synthCap in a more time-based way.
  • 30% synthCap before would mean from the moment the synth is enabled; 30% of the tokenDepth would be available to mint as synths straight away.
  • This function instead releases that over time and will be dynamically calculated each week and adjusted for each mint

contracts/Router.sol

  1. addLiquidity() && addLiquidityForMember() -
  • Added back in a baseAmount arg
  • UTILS doesn't allow single-sided direct liquidity-adds anyway (router interfaces a swap then liqAdd instead now)
  • This allows us to not have to estimate the SPARTA going in on the front end; user will see exact TOKEN + SPARTA being added; better for UX especially in a sliding market where actual is very different to actual

contracts/poolFactory.sol

  1. vaultAssets variable changed to private
  2. getVaultAssets() helper added to get vaultAssets variable array value
  3. createPoolADD() changed event emitter back to _token so that WBNB is emitted instead of BNB for subGraph etc
  4. vaultAssetsLength() helper added to get the length of vaultAssets for looping

contracts/synthVault.sol

  1. onlyPROTOCOL() modifier added
  2. harvestSingle() changed to utilize the Pool.stirCauldron() dynamic synthCap

test/1_pool.js

  1. Updated router.addLiquidity() to use baseAmount (see above)

test/2_swap.js

  1. Updated router.addLiquidity() to use baseAmount (see above)
  2. Added dividend testing scenarios
  3. Added tests for curating/un-curating pools
  4. Added SynthVault testing
  5. Removed virtualising logic from mint/burn synths

test/3_dao.js

  1. Create pools
  2. Curate / un-curate pools
  3. Add liq
  4. Lock LPs in the DaoVault
  5. Withdraw from DaoVault
  6. Create/test proposal types
  7. Vote for proposal
  8. Cancel proposal

test/5_farm.js

  1. Create pools
  2. Curate pools
  3. Add liq
  4. Lock LPs in the DaoVault
  5. Harvest
  6. Withdraw from DaoVault
  7. List for Bond
  8. Perform Bonds
  9. Delist bond
  10. Claim vested Bonds

GitHub Activity β€” Spartan DApp v2

Branch: "V2TN"

src/components/DataManager/DataManager.js

  1. Added in commented-out curated array grabbers for after next testnet deploy

src/store/bond/*.js

  1. Updated functions to match new contracts
  2. Added comments to signal code that can be removed after next testnet deploy
  3. Added commented out lines to enable after next testnet deploy

src/store/dao/*.js

  1. Updated functions to match new contracts
  2. Added comments to signal code that can be removed after next testnet deploy
  3. Added commented out lines to enable after next testnet deploy
  4. Added daoVaultWeight() to get total weight of the DAO dynamically
  5. Added proposalWeight() to get total weight in support of the current open proposal
  6. Added pollVotes() function to link to button on front end to update a proposal's status

src/store/pool/*.js

  1. Updated functions to match new contracts
  2. Added comments to signal code that can be removed after next testnet deploy
  3. Added commented out lines to enable after next testnet deploy

src/store/router/*.js

  1. addLiquidity() - flipped around args to match changed contract function

src/utils/math/bondVault.js

  1. calcBondedLP() - added off-chain calculation to get the current claimable bond amount

src/utils/math/dao.js

Off-chain math/calculations relating to the DAO

  1. bondLiq() - calculate LP tokens minted from a new Bond
  2. calcReward() - calculate user's current harvestable amount
  3. calcCurrentReward() - calculate user's harvestable amount per era

src/utils/math/nonContract.js

Off-chain math/calculations that aren't specific to a contract function

  1. calcFeeBurn() - calculate the basisPoints amount of feeBurn
  2. minusFeeBurn() - calculate the remaining SPARTA after feeBurn applied to a transfer
  3. getVaultWeights() - calculate a member's current weight in the BondVault + DaoVault
  4. convertTimeUnits() - convert seconds to a suitable unit for the front end and hand out the label/text as the 2nd index
  5. getTimeUntil() - calculate amount of time until a timestamp (countdown)
  6. getTimeSince() - calculate amount of time since a timestamp
  7. getSecsSince() - calculate seconds passed since a timestamp
  8. formatDate() - return locale-formatted date
  9. calcAPY() - calculate APY based (currently APR; needs compounding added)

src/utils/math/router.js

  1. addLiq() - modified to suit changes

src/utils/math/utils.js

  1. Moved a bunch of logic into siloed math files

src/views/pages/Bond/BondItem.js

  1. Refactored out some functions to the math files
  2. claimBond() hand in array (of the one address instead to match function's new expectations)

src/views/pages/Dao/Overview.js

  1. Added in commented-out data grabber functions for next testnet

src/views/pages/Home/PoolItem.js

  1. Refactored out APY calc to the maths files

src/views/pages/Pools/LiqAdd.js

  1. Updated dispatch action to hand in the SPARTA amount to the contract function too

src/views/pages/Swap/SwapPair.js

  1. Refactored out APY calc to the maths files

src/views/pages/Vault/DaoVault.js

  1. Added in commented-out data grabber functions for next testnet
  2. Refactored out logic in getLockedSecs() to maths files
  3. Refactored out logic in getClaimable() to maths files

GitHub Activity β€” Spartan Site

  • Quick wording update throughout to align the front-facing information a bit more to the V2 contracts
  • We ask that the community jump on and review/suggest some updates here for the text content
  • Some community contributors have also put their hand up to help with layout updates here for the content pages (see GitHub issue)

GitHub Activity β€” Spartan Blog

  • Pointed the front end to a new community-provided and managed content API for articles to be pulled in from

GitHub Activity β€” Spartan DApp v1

  • General cleanup console.logs etc
  • Changed Medium link to the profile/account page rather than the publication page
  • Added docs link to both menus; disabled FAQs section (outdated; docs do a better job of covering this)
  • Disabled irrelevant pages/sections (proposals, new bond, APY)

Project Information

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.

Binance Smart Chain TestNet Faucet

Contributors TestNet Wallet

Got some spare BSC TestNet assets? Please throw some to the contributors getting ready for testing! Or build up your testnet balances via the faucet to help contribute to balancing the pools in the upcoming testnet.

  • 0x3d2aCFafd10600896C90a325c31700B3E1E2D791

Engage with the community and contributors

Where to find out about all the latest updates or suggest improvements β€” get involved.