Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
53ef2a0
repo setup
mp-web3 Apr 24, 2024
b64b4fd
Initialized tests
mp-web3 May 6, 2024
c51a089
feat: getTokens function
mp-web3 May 7, 2024
25bb3ef
feat: implemented getPoolIds function
mp-web3 May 7, 2024
f31ccc0
feat: implemented getLimits function
mp-web3 May 7, 2024
ee40c1a
feat: implemented checkInputTokens modifier, swap function, sell func…
mp-web3 May 9, 2024
de19314
test and fix: implemented testSwapFuzzDaiForSDai and fixed sell and b…
mp-web3 May 9, 2024
55a2668
test and fix: implemented testSwapFuzzSDaiForDai, fixed sell and buy …
mp-web3 May 9, 2024
d95f31a
feat: implementing getPriceSwapAt function
mp-web3 May 13, 2024
b496753
tests: implemented new tests
mp-web3 May 13, 2024
3057903
tests: ready for review
mp-web3 May 14, 2024
f7e94a6
fix: fixed functions order, entered comments, updated manifest.yaml file
mp-web3 May 14, 2024
956f969
review and fix
mp-web3 May 14, 2024
2ddf310
chore: Removed unused comments
mp-web3 May 15, 2024
6aa6a5b
fix: fixed getPriceAt(buyToken)
mp-web3 May 16, 2024
cd6e75e
fix of fix: deleted getPriceAt(buyToken), only need sellToken for the…
mp-web3 May 16, 2024
79486a9
fix: propeller review fixes
mp-web3 May 17, 2024
8bf2274
feat: Initial Setup
May 22, 2024
1f4fac5
chore: Initial tokens addition
May 27, 2024
28eaf8e
feat: Integrated sDAI substream
May 28, 2024
acee96c
fix: Fixed naming in deposit event
May 30, 2024
7f25064
feat: Updated modules with configurable params
Jun 3, 2024
b68a8a4
feat: Added sdai into cargo files
Jun 3, 2024
16b4311
fix: Fixed CI/CD errors
Jun 5, 2024
9eded50
fix: Fixed balancer error
Jun 5, 2024
9134f73
chore: Updated toml dependencies
Jun 5, 2024
1201499
fix: Fixed CI checks
Jun 25, 2024
6aa9c40
alignment with propeller main
mp-web3 Oct 16, 2024
e700fff
Update forge-std submodule reference to include ds-test
mp-web3 Oct 16, 2024
089a4c8
repo setup
mp-web3 Apr 24, 2024
0bce026
Initialized tests
mp-web3 May 6, 2024
5b0204c
feat: getTokens function
mp-web3 May 7, 2024
3e62843
feat: implemented getPoolIds function
mp-web3 May 7, 2024
c222887
feat: implemented getLimits function
mp-web3 May 7, 2024
7b04a72
feat: implemented checkInputTokens modifier, swap function, sell func…
mp-web3 May 9, 2024
144f7d3
test and fix: implemented testSwapFuzzDaiForSDai and fixed sell and b…
mp-web3 May 9, 2024
c7aaa59
test and fix: implemented testSwapFuzzSDaiForDai, fixed sell and buy …
mp-web3 May 9, 2024
6dc5eae
feat: implementing getPriceSwapAt function
mp-web3 May 13, 2024
d70ce84
tests: implemented new tests
mp-web3 May 13, 2024
5499156
tests: ready for review
mp-web3 May 14, 2024
a84cf6e
fix: fixed functions order, entered comments, updated manifest.yaml file
mp-web3 May 14, 2024
1edf12e
review and fix
mp-web3 May 14, 2024
3bd4584
chore: Removed unused comments
mp-web3 May 15, 2024
37eca48
fix: fixed getPriceAt(buyToken)
mp-web3 May 16, 2024
bdb8368
fix of fix: deleted getPriceAt(buyToken), only need sellToken for the…
mp-web3 May 16, 2024
cb21eb0
fix: propeller review fixes
mp-web3 May 17, 2024
2e49ad9
rebased propeller/main
mp-web3 Oct 16, 2024
d519a4e
Merge propeller/main into origin/main to include the latest updates
mp-web3 Oct 17, 2024
33abc5f
align with propeller main
mp-web3 Oct 23, 2024
c1e8c5f
Merge remote-tracking branch 'origin/main' into feature/MakerDAO-sDAI…
mp-web3 Oct 23, 2024
1db1509
mod
mp-web3 Oct 23, 2024
6bdee6a
aligned
mp-web3 Oct 23, 2024
92fb797
integration: integrated with adapter sdk
mp-web3 Oct 23, 2024
fec555c
Merge branch 'main' into sdai-adapter-sdk-integration
mp-web3 Oct 25, 2024
8edc192
Merge branch 'main' into feature/sdai-substream
mp-web3 Oct 25, 2024
ebf51fa
deleted cargo.lock because of conflicts
mp-web3 Oct 25, 2024
7d8ab1c
Merge pull request #3 from ShadowyCreators/sdai-adapter-sdk-integration
mp-web3 Oct 25, 2024
76755eb
commented testPoolBehaviourSDAI() because the test is currently broke…
mp-web3 Oct 25, 2024
be3ab7f
starting sdk integration
mp-web3 Oct 25, 2024
67a3d84
fix: fixed map_components
mp-web3 Oct 25, 2024
048a846
fix: sdai substream
mp-web3 Oct 28, 2024
d0caec1
update substream.yaml and creation integration_test
mp-web3 Oct 28, 2024
c7048ac
cargo.toml and rust-toolchain.toml update
mp-web3 Oct 28, 2024
b9d25f3
chore: working on integration test
mp-web3 Oct 28, 2024
0ec28ec
change stop_block
mp-web3 Oct 28, 2024
628cd92
clean up
mp-web3 Oct 29, 2024
629ca7d
fix component vault creation !call.call.state_reverted && is_deployme…
mp-web3 Oct 29, 2024
3880c6e
fixed map_components module as for comments in pull request
mp-web3 Oct 30, 2024
29fb2e1
fix: fix getLimits sDai
mp-web3 Oct 30, 2024
a1784b0
fix: fixed stop block integration test
mp-web3 Oct 30, 2024
b758f64
Merge pull request #4 from ShadowyCreators/sdk-implementation/sdai-ad…
mp-web3 Oct 30, 2024
8a04998
Merge remote-tracking branch 'shadowy/main' into sdai-adapter-and-sub…
mp-web3 Oct 30, 2024
17145cd
forge format
mp-web3 Oct 30, 2024
be7803b
cargo fmt
mp-web3 Oct 30, 2024
a8128bb
nightly build
mp-web3 Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions evm/src/sDai/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ instances:
id: 1
arguments:
- "0x83F20F44975D03b1b09e64809B757c47f942BEeA"
- "0x6B175474E89094C44Da98b954EedeAC495271d0F"

# Specify some automatic test cases in case getPoolIds and
# getTokens are not implemented.
Expand Down
21 changes: 9 additions & 12 deletions evm/src/sDai/sDaiSwapAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ contract sDaiSwapAdapter is ISwapAdapter {
ISavingsDai immutable savingsDai;
IERC20 immutable dai;

constructor(address savingsDai_) {
constructor(address savingsDai_, address dai_) {
savingsDai = ISavingsDai(savingsDai_);
dai = IERC20(address(0x6B175474E89094C44Da98b954EedeAC495271d0F));
dai = IERC20(dai_);
}

/// @dev Check if swap between provided sellToken and buyToken are supported
Expand Down Expand Up @@ -86,9 +86,6 @@ contract sDaiSwapAdapter is ISwapAdapter {
}

/// @inheritdoc ISwapAdapter
/// @dev Limits are underestimated to 90% of totalSupply as both Dai and
/// sDai
// have no limits but revert in some cases
function getLimits(
bytes32,
address sellToken,
Expand All @@ -97,14 +94,12 @@ contract sDaiSwapAdapter is ISwapAdapter {
limits = new uint256[](2);

if (sellToken == address(dai)) {
limits[0] =
((dai.totalSupply() - dai.balanceOf(address(savingsDai))) *
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[1] = limits[0];
} else {
limits[0] = (savingsDai.totalSupply() * 90) / 100;
limits[1] = savingsDai.previewRedeem(limits[0]);
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.

limits[0] = savingsDai.previewWithdraw(totalAssets);
limits[1] = totalAssets;
}
}

Expand Down Expand Up @@ -213,6 +208,8 @@ interface ISavingsDai is IERC20 {

function previewRedeem(uint256 shares) external view returns (uint256);

function totalAssets() external view returns (uint256);

function totalSupply() external pure returns (uint256);

function deposit(
Expand Down
2 changes: 1 addition & 1 deletion evm/test/sDaiSwapAdapter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract sDaiSwapAdapterTest is Test, ISwapAdapterTypes, AdapterTest {
function setUp() public {
uint256 forkBlock = 19866715;
vm.createSelectFork(vm.rpcUrl("mainnet"), forkBlock);
adapter = new sDaiSwapAdapter(SDAI_ADDRESS);
adapter = new sDaiSwapAdapter(SDAI_ADDRESS, DAI_ADDRESS);
}

function testPriceFuzzDaiForSDai(uint256 amount0, uint256 amount1) public {
Expand Down
2 changes: 1 addition & 1 deletion substreams/ethereum-sdai/src/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ fn find_deployed_underlying_address(vault_address: &[u8]) -> Option<[u8; 20]> {
// 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?

// Dai
Some(hex!("6b175474e89094c44da98b954eedeac495271d0f"))
Some(hex!("6B175474E89094C44Da98b954EedeAC495271d0F"))
}
_ => None,
}
Expand Down