Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MihRazvan committed Mar 29, 2024
1 parent fd7a0be commit 255cc20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
15 changes: 2 additions & 13 deletions packages/foundry/contracts/FundingRound.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,12 @@ contract FundingRound {
for (uint256 i = 0; i < projects.length; i++) {
if (projects[i].votingPoints > 0) {
uint256 projectShare = (totalBalance *
// --- no sablier
projects[i].votingPoints) / totalPoints;
_mUSDC.transfer(projects[i].recipient, projectShare);

// --- with sablier
/*_projects[i].votingPoints) / totalPoints;
createStream(
uint128(projectShare * 1) / 4,
uint128(projectShare * 3) / 4,
_projects[i].recipient
);*/
projects[i].recipient
);
}
}

Expand All @@ -119,28 +114,22 @@ contract FundingRound {
) public returns (uint256 streamId) {
uint256 totalAmount = amount0 + amount1;

emit Debug(1);
_mUSDC.approve(address(LOCKUP_DYNAMIC), totalAmount);
emit Debug(2);
LockupDynamic.CreateWithMilestones memory params;
emit Debug(3);
params.sender = address(this);
params.recipient = projectAddress;
params.totalAmount = uint128(totalAmount);
params.asset = _mUSDC;
params.cancelable = true;
params.startTime = uint40(block.timestamp + 30 seconds);
emit Debug(4);

params.segments = new LockupDynamic.Segment[](2);
emit Debug(5);

params.segments[0] = LockupDynamic.Segment({
amount: uint128(amount0),
exponent: ud2x18(1e18),
milestone: uint40(block.timestamp + 100)
});
emit Debug(6);

params.segments[1] = LockupDynamic.Segment({
amount: amount1,
Expand Down
12 changes: 1 addition & 11 deletions packages/foundry/test/fundRoundTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ contract FundingRoundTest is Test {
}

function testCreateStream() public {
// Setup: Create two projects
mockUSDC.mint(address(fundingRound), 100000 ether);
string memory projectName1 = "Project One";
address projectRecipient1 = makeAddr("projectRecipient1");
Expand All @@ -147,27 +146,18 @@ contract FundingRoundTest is Test {
address projectRecipient2 = makeAddr("projectRecipient2");
fundingRound.createProject(projectName2, projectRecipient2);

// Approve mUSDC spending and contribute to both projects
uint256[] memory projectIds = new uint256[](2);
projectIds[0] = 0; // ID of the first project
projectIds[1] = 1; // ID of the second project
uint256 totalAmount = 1000 ether; // Total amount to distribute among the projects

// mockUSDC.approve(address(fundingRound), totalAmount);

uint128 project1Amount = 500 ether;
// uint128 project2Amount = 200 ether;

mockUSDC.balanceOf(address(fundingRound));
fundingRound.createStream(
project1Amount / 2,
project1Amount / 2,
projectRecipient1
);
// fundingRound.createStream(
// project2Amount / 2,
// project2Amount / 2,
// projectRecipient2
// );
}

function _sqrt(uint256 x) internal pure returns (uint256 y) {
Expand Down

0 comments on commit 255cc20

Please sign in to comment.