Code Monkey home page Code Monkey logo

od-contracts's People

Contributors

0xardy avatar 0xdavinchee avatar 0xgorilla avatar 0xjabberwock avatar 0xraccoon avatar cupojoseph avatar daopunk avatar dristpunk avatar fabiohild avatar guifel avatar jahabeebs avatar mrdeadce11 avatar ngmachado avatar onbjerg avatar outwrit avatar pi0neerpat avatar sabnock01 avatar st4rgarden avatar stefanionescu avatar wei3erhase avatar xba5ed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

od-contracts's Issues

isolate URI so governor can update it

uri should call a new outside contract
the address for it is stored in Vault721
the address for the outside contract can be updated by the governor
the outside contract returns URI

Deploy test token contracts that are mintable to anyone and update params

https://github.com/UseKeyp/opendollar/blob/dev/src/script/Params.s.sol

existing:

// Collateral Names
bytes32 constant RETH = bytes32('ETH-A'); // 0x4554482d41000000000000000000000000000000000000000000000000000000
bytes32 constant CETH = bytes32('WETH'); // 0x5745544800000000000000000000000000000000000000000000000000000000
bytes32 constant WSTETH = bytes32('WSTETH'); // 0x5753544554480000000000000000000000000000000000000000000000000000
bytes32 constant ARB = bytes32('OP'); // 0x4f50000000000000000000000000000000000000000000000000000000000000
bytes32 constant MAGIC = bytes32('WBTC'); // 0x5742544300000000000000000000000000000000000000000000000000000000
  • a test token that always goes down in price

So for each of these that doesnt already exist a version should be deployed where we are testing that can be minted in unlimited amounts for testing: WSTETH, RETH, ARB instead of OP, WBTC.

Then add the tokens to the params with proper names and addresses in a few places as part of the deploy script

Improve deployment outputs

  • all the input args needed for FE logged after deployment
  • all addresses easy to copy paste into discord and share with FE team

create mintable 721 contract called NiftyVault

  • Mintable function can be called by SafeManager to create a new safe and mints a new NFT with SAFEid = nft id
  • set SafeManager address during deployment once
  • update deployment scripts to set SafeManager address
  • permissioned setter for updating SafeManager address that can only be updated by the DAO address
  • import openzeppelin 721
  • added to Proxy Registry and renaming the contract Vault721

testing

  • minting can only be called by authorized address

Treasury fees slider setup

Change the % of fees that goes to the burning mechanism vs a treasury
test and verify the amounts work as expected

Prevent or handle DSProxy transfer

if a user transfers their DSProxy, research how that would effect the ownership of their vault and handle it appropriately.

Example:
User A owns safe 1, 2, and 3.
User A transfers their proxy to user B
User A's wallet still has NFT 1, 2, 3 - but the proxy that owns the corresponding safes is controlled by user B.
uh oh

Question:
if we disable DSProxy transfers - does this break other things??

Todo:

  • check for test of dsproxy transfer
  • search codebase for dsproxy transfer function being called

deploy a new proxy when user doesnt have one on transfer

When user does not have a proxy deployed and they are being transfered an NFT, deploy a new proxy from the proxy registry for them. Override the erc721 transfer function to do so in the proxy registry contract

include tests:

  • transferring NFT also transfers ownership of the SAFE
  • users who do not own the NFT can not transfer the NFT
  • users who are transfered the NFT and already have a proxy do not have a new one deployed
  • users who are transfered the NFT and do not have a proxy deployed get one deployed for them

contract nft metadata

  • description for the NFT collection, Caution! Trading this NFT means trading the ownership of your Vault in the Open Dollar protocol and all of the assets/collateral inside each Vault
  • other metadata
  • default URI
    Closed by #100

add Struct of NFT data that will be displayed in image

Collateral Type
contract: HaiSafeManager
function: safeData(uint256 _safe)

Collateral Ratio
contract: OracleRelayer
function: cParams(bytes32 _cType)

Stability Fee
contract: TaxCollector
function: cParams(bytes32 _cType)

Liquidation Penalty
contract: LiquidationEngine
function: cParams(bytes32 _cType)

add total supply check to Vault721

  • read only function totalSupply() should return the total supply of vaults in the system
  • should return a public uint variable also called totalSupply

NFT testing cleanup

  1. Check for NFT burning and safe access in
    src/test/nft/NFTSecurity.t.sol
  • User should not be able to burn NFT
  • if things are burned make sure the correct owner only can access stuff
  1. use arb goerli token addresses in setup in src/test/nft/GoerliForkSetup.t.sol. blocked by #3

  2. more tests for outside unknown proxies trying to interact in different ways

primarily show fuzzing and code coverage for all NFT changes

SafeManager `addSAFE` & `removeSAFE` vunerability

Proxy transferability depends on getSafes function to access array of SafeIds/tokenIds belonging to a user and their proxy. This array can be manipulated with addSAFE and removeSAFE, which does not affect safe ownership, only adds or removes a safe to the _usrSafes array

Update test token naming

Suggest completing with #132

Collateral

"WSTETH",
"CBETH",
"RETH",
"ARB",
"MAGIC",
  • Create a list of collateral we will launch with
  • Update the test tokens to match the same symbols / names as the launch collateral tokens
  • These should still be deployed fresh each time (local and goerli)
  • Oracles should be OracleForTestnet

OD / ODG

  • Update the symbol/name for OD and ODG

Docs: explain transferSAFEOwnership

Modified Safe Manager transferSAFEOwnership function can only be called via the vault721 contract. This is a

Users can no longer use the transferSAFEOwnership function directly from their proxy, they must transfer their 721 in order to transfer ownership. This prevents the Safe Manager from having special permissions on the vault721 contract (it doesnt need to call back the transfer function on the 721 if someone were to use the existing transferSAFEOwnership), which limits the attacks surface the most.

Epic - uniswap v4 integration

Target mid fall 2023. Dependent on uniswap v4 release

  • replace chainlink with hooks oracle
  • governance around swapping pool incentives
  • design pool incentives based on capital efficiency

add governor bravo code to the repo

  1. add a governance folder in the contracts repo
  2. add governor bravo contracts
  3. add governor to deployment scripts: after system coin is created
  4. add governor params to deployment params file
  5. set timelock contract as the governor param as part of deployment

lockCollateral params update

check that lockCollateral geb basic action parameters have been updates and we should make sure its consistent with SDK

Safe Manager updates

Part 1

  • modify the openSafe function to also mint an NFT
  • set the NFT contract address during deployment, and modify testing and prod deployment scripts
  • create a permissioned setter function to allow only the DAO to update the NFT contract address which is used during minting/createSafe

Part 2
Update to minting function to check proxy registry to make sure proxy is.. registered. Goal: during transfers we know you can only transfer to existing known proxies owned by the Vault721 contract.

Tests for everything: transfers, creation, re-entry, proxy is known in all cases, and deployment is as expected.

note: do not update modifier because it touches too many things, just add a simple req to make sure proxies are known.

Camelot Pool research and deployment

  1. what is the difference beyween comelot and uni v3 interface - determine if we can use comelot as a price oracle
  2. add deployment of pool to testing scripts
  3. test factory for cam v3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.