Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: stake-dao adapters and tests for DeFi-SDK integration #150

Open
wants to merge 4 commits into
base: interactive
Choose a base branch
from

Conversation

smitrajput
Copy link

@smitrajput smitrajput commented Mar 2, 2021

4 StakeDAO assets to be integrated (along with the underlying token after the comma)

  1. sdcrvRenWSBTC (sbtcVaultAddress in test): 0x24129B935AfF071c4f0554882C0D9573F4975fEd, crvRenWSBTC (sbtcCrv in test): 0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3
  2. sd3Crv: 0xB17640796e4c27a39AF51887aff3F8DC0daF9567, 3Crv: 0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490
  3. sdeursCRV: 0xCD6997334867728ba14d7922f72c893fcee70e84, eursCRV: 0x194eBd173F6cDacE046C53eACcE9B953F28411d1
  4. sdveCrv: 0x478bBC744811eE8310B461514BDc29D03739084D, veCrv (non-tradable): 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2, CRV: 0xD533a949740bb3306d119CC777fa900bA034cd52

Tests have been written for (1) and (4), as for those of (2), (3) will follow exact pattern of (1)

For (4), the actual underlying asset i.e. veCrv is non-tradable, so you may derive the price for sdveCrv from CRV, as 1 sdveCrv is minted for 1 CRV deposited into the vault, and hence I've set its rate as 1e18 in the Component, based off this understanding.

@smitrajput smitrajput changed the title feature: integrate stake-dao assets to zerion feature: stake-dao adapters and tests for DeFi-SDK integration Mar 3, 2021
Comment on lines 24 to 26
function setSdveCrv(address newSdveCrv) external {
sdveCrv = newSdveCrv;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason it may be useful?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, so that you can update the sdveCrv address when it's changed in the future, without redeploying StakeDaoTokenAdapter.sol

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, but I will break the integration anyway
so I think there are 2 things you should do

  • inherit from Ownable contract from this repo and use onlyOwner here
  • notify us about change of sdveCrv address, so we change it here and in our backend

* @author Elephant memory/strength
*/
contract StakeDaoTokenAdapter is TokenAdapter {
address public sdveCrv = 0x478bBC744811eE8310B461514BDc29D03739084D;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we usually save such addresses as address internal constant

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might have a new address in the future, hence not a constant


if (token == sdveCrv) {
components[0] = Component({
token: sdveCrv,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
token: sdveCrv,
token: CRV,

it should be CRV address as it's component's address

Comment on lines 24 to 26
function setSdveCrv(address newSdveCrv) external {
sdveCrv = newSdveCrv;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, but I will break the integration anyway
so I think there are 2 things you should do

  • inherit from Ownable contract from this repo and use onlyOwner here
  • notify us about change of sdveCrv address, so we change it here and in our backend

@sobolevigor986 sobolevigor986 changed the base branch from interactive to master March 5, 2021 11:27
@sobolevigor986 sobolevigor986 changed the base branch from master to interactive March 5, 2021 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants