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

Sdai adapter and substream #102

Open
wants to merge 75 commits into
base: main
Choose a base branch
from
Open

Sdai adapter and substream #102

wants to merge 75 commits into from

Conversation

mp-web3
Copy link
Collaborator

@mp-web3 mp-web3 commented Oct 30, 2024

No description provided.

90) /
100;
limits[1] = savingsDai.previewDeposit(limits[0]);
limits[0] = 3 * (10 ** 24);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain this value it seems very arbitrary.

Copy link
Contributor

@domenicodev domenicodev Nov 4, 2024

Choose a reason for hiding this comment

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

@kayibal It is the DAI total supply value approx., and we need to use static values due to the incompatibility issue between substreams and external calls

Copy link
Contributor

@tvinagre tvinagre Feb 10, 2025

Choose a reason for hiding this comment

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

We can overwrite the token's totalSupply so ideally we should track this via attributes
Currently, DAI supply is 1000 times bigger than this number.

limits[0] = 3 * (10 ** 24);
limits[1] = limits[0];
} else {
uint256 totalAssets = savingsDai.totalAssets();
Copy link
Contributor

Choose a reason for hiding this comment

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

@kayibal I think this is not possible with the current Simulation module, as we override the tokens, right?
Maybe we can change it to ignore the token overrides when executing functions that are not price and swap - but that would still require us to track this token's storage.


[dependencies]
ethabi = "17"
hex-literal.workspace = true
Copy link
Contributor

@tvinagre tvinagre Feb 10, 2025

Choose a reason for hiding this comment

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

Workspace dependencies are deprecated, please update

# A comma separated list of args to be passed to the constructor of the Adapter contract
adapter_build_args: "0x83F20F44975D03b1b09e64809B757c47f942BEeA,0x6B175474E89094C44Da98b954EedeAC495271d0F"
# Whether or not the testing script should skip checking balances of the protocol components.
# If set to `true` please always add a reason why it's skipped.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please provide a reason why it's skipped

- "0x6B175474E89094C44Da98b954EedeAC495271d0F" # dai
- "0x83F20F44975D03b1b09e64809B757c47f942BEeA" # sDai
creation_tx: "0xa2f51048265f2fe9ffaf69b94cb5a2a4113be49bdecd2040d530dd6f68facc42"
skip_simulation: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing swap simulation tests

// Ethereum
match vault_address {
// sDai
hex!("83F20F44975D03b1b09e64809B757c47f942BEeA") => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hardcoded address - it won't work on other chains. I think you can get this value from the constructor?


let tx_protocol_components = deployment_tx
.map(|tx| {
let protocol_component = ProtocolComponent::at_contract(&vault_address, &tx.into())
Copy link
Contributor

Choose a reason for hiding this comment

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

We're missing the tracking of contracts where state is relevant for simulation. From sDAI's code, looks like pot contract (https://etherscan.io/address/0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7#code) is necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could even add DAI and pot addresses from params - as we
expect to be only one sDAI per-chain.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We're missing the tracking of contracts where state is relevant for simulation. From sDAI's code, looks like pot contract (https://etherscan.io/address/0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7#code) is necessary.

Hey @tvinagre could you please be more specific regarding why potis relevant for the simulation since it does not hold balance?

component_id: address_hex.as_bytes().to_vec(),
},
]);
substreams::log::debug!(
Copy link
Contributor

Choose a reason for hiding this comment

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

pls remove logs before final version

@tvinagre
Copy link
Contributor

Please also rebase from main

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.

4 participants