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!
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
- 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
- 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
- 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
- vaultAssets variable changed to private
- getVaultAssets() helper added to get vaultAssets variable array value
- createPoolADD() changed event emitter back to _token so that WBNB is emitted instead of BNB for subGraph etc
- vaultAssetsLength() helper added to get the length of vaultAssets for looping
contracts/synthVault.sol
- onlyPROTOCOL() modifier added
- harvestSingle() changed to utilize the Pool.stirCauldron() dynamic synthCap
test/1_pool.js
- Updated router.addLiquidity() to use baseAmount (see above)
test/2_swap.js
- Updated router.addLiquidity() to use baseAmount (see above)
- Added dividend testing scenarios
- Added tests for curating/un-curating pools
- Added SynthVault testing
- Removed virtualising logic from mint/burn synths
test/3_dao.js
- Create pools
- Curate / un-curate pools
- Add liq
- Lock LPs in the DaoVault
- Withdraw from DaoVault
- Create/test proposal types
- Vote for proposal
- Cancel proposal
test/5_farm.js
- Create pools
- Curate pools
- Add liq
- Lock LPs in the DaoVault
- Harvest
- Withdraw from DaoVault
- List for Bond
- Perform Bonds
- Delist bond
- Claim vested Bonds
GitHub Activity β Spartan DApp v2
Branch: "V2TN"
src/components/DataManager/DataManager.js
- Added in commented-out curated array grabbers for after next testnet deploy
src/store/bond/*.js
- Updated functions to match new contracts
- Added comments to signal code that can be removed after next testnet deploy
- Added commented out lines to enable after next testnet deploy
src/store/dao/*.js
- Updated functions to match new contracts
- Added comments to signal code that can be removed after next testnet deploy
- Added commented out lines to enable after next testnet deploy
- Added daoVaultWeight() to get total weight of the DAO dynamically
- Added proposalWeight() to get total weight in support of the current open proposal
- Added pollVotes() function to link to button on front end to update a proposal's status
src/store/pool/*.js
- Updated functions to match new contracts
- Added comments to signal code that can be removed after next testnet deploy
- Added commented out lines to enable after next testnet deploy
src/store/router/*.js
- addLiquidity() - flipped around args to match changed contract function
src/utils/math/bondVault.js
- 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
- bondLiq() - calculate LP tokens minted from a new Bond
- calcReward() - calculate user's current harvestable amount
- 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
- calcFeeBurn() - calculate the basisPoints amount of feeBurn
- minusFeeBurn() - calculate the remaining SPARTA after feeBurn applied to a transfer
- getVaultWeights() - calculate a member's current weight in the BondVault + DaoVault
- convertTimeUnits() - convert seconds to a suitable unit for the front end and hand out the label/text as the 2nd index
- getTimeUntil() - calculate amount of time until a timestamp (countdown)
- getTimeSince() - calculate amount of time since a timestamp
- getSecsSince() - calculate seconds passed since a timestamp
- formatDate() - return locale-formatted date
- calcAPY() - calculate APY based (currently APR; needs compounding added)
src/utils/math/router.js
- addLiq() - modified to suit changes
src/utils/math/utils.js
- Moved a bunch of logic into siloed math files
src/views/pages/Bond/BondItem.js
- Refactored out some functions to the math files
- claimBond() hand in array (of the one address instead to match function's new expectations)
src/views/pages/Dao/Overview.js
- Added in commented-out data grabber functions for next testnet
src/views/pages/Home/PoolItem.js
- Refactored out APY calc to the maths files
src/views/pages/Pools/LiqAdd.js
- Updated dispatch action to hand in the SPARTA amount to the contract function too
src/views/pages/Swap/SwapPair.js
- Refactored out APY calc to the maths files
src/views/pages/Vault/DaoVault.js
- Added in commented-out data grabber functions for next testnet
- Refactored out logic in getLockedSecs() to maths files
- 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
Official Links
- Website: https://spartanprotocol.org/
- DApp: https://dapp.spartanprotocol.org/
- GitBook (Docs): https://docs.spartanprotocol.org/
- GitHub: https://github.com/spartan-protocol
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.
- Medium: https://medium.com/spartanprotocol
- Twitter: https://twitter.com/spartanprotocol
- Telegram Community: https://t.me/spartanprotocolorg
- Telegram Announcements: https://t.me/spartanprotocolann
- Community-Built Discord: https://discord.gg/wQggvntnGk