white-whale-defi-platform / v1-contracts Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
The Vault dapp already has some integration tests for it written but these should be expanded to tests everthing the unit-testing doesn't cover
The current implementation of interactions with AMMs only accounts for terraswap pools. This will have to be addressed once details on Astroport AMM interactions are known.
The white_whale_testing package used in the stabecoin vault and profit-check contract causes compile errors if included in build. If not included, the tests that rely on the package don't compile. We should fix this before sending to audit.
We got some great coverage thanks to the addition of cw-multi-test. Explore and attempt to add some python-based end-to-end tests.
When a user has deposited money into the vault
Then attempts to withdraw all their funds we see this issue :
error: "rpc error: code = InvalidArgument desc = failed to execute message; message index: 0: dispatch: dispatch: Error calling the VM: Error executing Wasm: Wasmer runtime error: RuntimeError: unreachable: execute wasm contract failed: invalid reques
The understanding so far is this can happen when attempting to withdraw all funds from a vault as currently the fees for withdrawing funds from anchor are not taken into account.
The state storage of this contract uses an older method of handeling storage. Lets check if this will ever get outdated,
When the trader account sends an Anchor deposit msg to the vault, it throws an Unauthorized error:
failed to execute message; message index: 0: Caller is not admin: execute wasm contract failed: invalid request
When calling execute_poll(), on a poll that was passed, with a payload to change the slippage of the stablecoin vault. An error gets thrown:
height=5930557, txhash='FCAD9A2BCDA3BBBC02638BC6B7113D7573B90761372AE3E559499DDF0B6A359D', raw_log='failed to execute message; message index: 0: dispatch: Caller is not admin: execute wasm contract failed'
The set_slippage function of the stable-coin vault contract expects the caller to be the owner of the contract (which is not the case).
The send test of the treasury contract is broken and needs to be fixed. Should we consider removing this function from the contract?
When calling the provide_liquidity function with an account different from the admin account, a runtime error is thrown.
This can be seen in the terra explorer (https://finder.terra.money/bombay-12/address/terra129tj5d05a33syucpd32v6anncy9lu680cwcg44)
Interestingly, when trying to provide liquidity with the admin account, no error is thrown.
Also note that the admin account was the first account to add liquidity to the vault.
Error log:
'failed to execute message; message index: 0: dispatch: Error calling the VM: Error executing Wasm: Wasmer runtime error: RuntimeError: unreachable: execute wasm contract failed', gas_wanted=6900000, gas_used=59098, logs=None, code=4, codespace='wasm')
There are still places in the code where we use the name warchest
instead of treasury
.
Rename those.
The integration tests for stablecoin-vault have broken, this indicates something changed that needs to be accounted for. When I run the tests I see this error :
Denominator must not be zero
for both
tests::integration_test::stablecoin_vault_fees_are_allocated
and
tests::integration_test::for_big_sums_anchor_deposit_or_withdraw_is_called_and_fees_are_allocated
Possibly something minor changed in ProvideLiquidity and the tests need to account for that.
When withdrawing liquidity from the bluna vault, only the luna is returned. This could open us up to a bank run if everyone withdraws.
Either we repay in luna and bluna according to their share of the pool or the war-chest steps in and provides luna to the withdrawer in exchange for the bluna.
Edit: lp share does include bluna
Chatting with @CyberHoward, we should make a dap for anchor interactions
Upon close look this seems to have been done in the community fund repo but was not put into the warchest at the same time.
Some of the deps need to be looked at and reorganised. Some deps make sense in dependancies but some need to be in dev-dependancies for compilation reasons.
We need a way to pay out stakers some form of emissions.
While writing up a doc I noticed the profit check seems to have things like InitMsg
and HandleMsg
instead of InstantiateMsg
and ExecuteMsg
this indicates maybe some migration still needed to bring it up to v.0.16.0 spec and beyond.
Review code comments and high-level docs
The unit tests written for the memory contract only check the return value of the update functions. Idealy we should double check the stored value in the deps.storage MockStorage object.
It also misses an unauthorized set_admin tests
The stablecoin vault has an implementation of fee estimation queries for deposit and withdraw fees.
Similar queries are defined in bluna vault but not currently implemented.
The terraswap contract is missing some important unit-tests. These tests should only probe the application specific logic.
Logic that depends on the base dapp package should be testing in its respective directory.
The integration testing infrastructure for the dapps will test all the inter-contract interactions. It would be beneficial to create a text document in each dapp that specifies what tests are handled where (unit testing vs integration), along with an estimate of the over-all test coverage.
Having researched the process some firms use for their audits it looks like it would be valueable to add the tarpulin coverage tool to all our contract runs. This is one thing that is done by some audit firms it seems as a standard procedure.
Will give good insight on coverage also.
Given a number of arb vaults
AND the other prerequisite white whale contracts such as buy/burn vaults, governance and so on
When the contracts are deployed
Then capital deposited and used in each contract generates fees and profits
And Then these fees and profits are allocated as expected through the White Whale ecosystem.
Given a series of arbitrage vaults
When the vaults are interacted with
Then a protocol fee is taken by White Whale
And Then this fee is in part sent to the war chest
Given a war-chest contract which contains funds
When a governance proposal to spend the war chest is passed
Then the war-chest contract can deploy accumulate funds
to a destination of choice
As a white whale team member
I want to see and know that the WW contracts have been deployed tested and verified on the Columbus 5 mainnet
So that we feel ready to go to audit.
This is a rather big issue and so far alot of work has been done on the bombay 10 network
We need to get a better understanding of contract migrations, what we need to add to our code and if we can test it in some means. We can keep proceeding without it but it would mean when live we can better handle changes.
When staking my Guppy tokens on the governance contract and querying for my staked balance. The amount I staked and the reported staked amount are off by 1 µGGY. For example:
Might not be an issue.
Two imported functions (query_pool, query_lp_token) are missing in the white_whale::query::terraswap file. These need to be added.
We have some tests with are prevented from running with
// #[test]
some of these are also marked with
// TODO: Test candidate to fix
These tests either need to be updated to work and uncommented or removed if they are now redundant.
A fix should be made to the profit check contract to include aUST holdings in it's value calculation.
We are moving to a new staking model to better suit our arch which includes a treasury, staking needs to be migrated from the gov contract to a common staking contract and then gov may need to query this contract to understand the weight of a given user.
Simple issue but takes some time.
We need to get a small understanding on what should and shouldn't be included in contracts. This could be done all the way to make an actual template for the PR
Instead. This issue could just maintain a list of things.
Examples:
Governance votes pass even though no snapshot_poll() was called on it.
Poll query response:
{'id': 1, 'creator': 'terra1gxsfv4ruvda37q3ta0kwx42w7qy5l9hf9l30sz', 'status': 'passed', 'end_height': 5916289, 'title': 'Set Slippage to 0.008', 'description': 'set slippage to 0.008', 'link': 'https://whitewhale.finance', 'deposit_amount': '100000', 'execute_data': [{'order': 1, 'contract': 'terra14uqjlrg5efah459xkstxavf3wr7ku8s0j5h328', 'msg': 'eyJzZXRfc2xpcHBhZ2UiOiB7InNsaXBwYWdlIjogIjAuMDA4In19'}], 'yes_votes': '50000000', 'no_votes': '0', 'staked_amount': None, 'total_balance_at_end_poll': '50000000'}
Proposed solution: Take staking snapshot when the poll is created.
It could be usefull for data analysis to know exactly when an arb is performed. Combining this with bot generated data could give us an idea on how much delay there is between spotting and executing arbitrages.
Add integration tests to the Astroport dapp
Currently the stablecoin vault creates an LP token on instantiation. Right now magic values are used.
If we are to use constants this needs to be added or if needed exposing the ability to specify the new LP token name and symbol in the init msg could be the other option.
As a last step we should remove all clippy warning from all our code and format the whole project.
As a liquidity provider
I want a tempting APR/APY on WHALE LP
so that I more reason to consider providing LP there versus another pool.
Given the Whale token is available on terraswap
When network users start to perform liquidity provision with WHALE and UST
Then they can choose their LP tokens in the Staking Incentive Contract
And Then they will receive a 'boosted' APR.
The dApp base code does not have any tests written for it.
We need some sort of common template so that dapps we add to the treasury all have a common format/schema.
Generic error: Native token balance mismatch between the argument and the transferred
This is likey due to a fee miscalculation.
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.