Skip to content

Updating Guard contract to whitelist Gains/Ostium trading #437

@miohtama

Description

@miohtama

Update the GuardV0 smart contract to allow trading on Gains-compatible DEXes: Gains, Ostium.

  1. Do a manual trading cycle of deposit/open/increse position/decrease position/close/redeem to find out what methods are called for trading
    • Alternatively check other Github repos that would have this information for Gains/Ostium like their unit test
    • Brainstorm and learn what could be potential security issues if the trading account private key is compromised: e.g. can we whitelist trading pairs, withdrawal addresses or such.
  2. Add GuardV0 function "whitelistGainsTrading"
    • Whitelists all required smart contract call sites to be able to trade on Gains-compatible protocol
    • Create custom validators for Gains-smart contract calls that could be dangerous in the compromised asset manager private key situation
  3. Create an end-to-end test case that whitelisting work
    • First figure out if we can do automated tests with mainnet fork or do we need to use testnet or even mainnet for testing this code
    • Tests deploy a new new guard smart contract "SimpleVault"
    • Tests must check the end-to-end path from 1) works and the vault can trade on Gains through all steps
    • Tests must check that for any custom validation paths we need do in Guard smart contract, we check for the negative results: for example if we can check for whitelisted trading pairs or tokens, there must be a test to check that non-whitelisted token gives a revert from the guard smart contract

Sub-issues

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions