dao sacrifice
Some checks are pending
CI / Foundry project (push) Waiting to run

This commit is contained in:
yellow 2024-10-31 04:55:29 +01:00
parent 06434f5281
commit f6f3e5cadf
2 changed files with 9 additions and 5 deletions

View File

@ -125,7 +125,8 @@ contract RaidGeld is ERC20, Ownable, Constants {
amountOutMinimum: 0, amountOutMinimum: 0,
sqrtPriceLimitX96: 0 sqrtPriceLimitX96: 0
}); });
router.exactInputSingle(params); uint256 daoTokenAmount = router.exactInputSingle(params);
performSacrifice(daoTokenAmount);
start_game(msg.sender); start_game(msg.sender);
} }
@ -136,12 +137,13 @@ contract RaidGeld is ERC20, Ownable, Constants {
require( require(
daoToken.transferFrom(msg.sender, address(this), BUY_IN_DAO_TOKEN_AMOUNT), "Failed to transfer DAO tokens" daoToken.transferFrom(msg.sender, address(this), BUY_IN_DAO_TOKEN_AMOUNT), "Failed to transfer DAO tokens"
); );
performSacrifice(BUY_IN_DAO_TOKEN_AMOUNT);
start_game(msg.sender); start_game(msg.sender);
} }
function sacrificeToDao(uint256 _baseAmount) private { function performSacrifice(uint256 _baseAmount) private {
uint256 amount = _baseAmount * SACRIFICE_SHARE / MANTIASSA; uint256 amount = _baseAmount * SACRIFICE_SHARE / MANTISSA;
address[] memory tokens = new address[](0); address[] memory tokens = new address[](0);
baal.ragequite(address(this), amount, 0, tokens); baal.ragequit(address(this), amount, 0, tokens);
} }
// Override for default number of decimals // Override for default number of decimals

View File

@ -116,8 +116,10 @@ contract raid_geldTest is Test, Constants {
assertEq(raid_geld.balanceOf(player1), raid_geld.INITIAL_GELD()); assertEq(raid_geld.balanceOf(player1), raid_geld.INITIAL_GELD());
// Verify the contract dao token balance is updated // Verify the contract dao token balance is updated
uint256 expectedDaoBalance = initialBalance + raid_geld.BUY_IN_DAO_TOKEN_AMOUNT() -
raid_geld.BUY_IN_DAO_TOKEN_AMOUNT() * raid_geld.SACRIFICE_SHARE() / raid_geld.MANTISSA();
assertEq( assertEq(
raid_geld.daoToken().balanceOf(address(raid_geld)), initialBalance + raid_geld.BUY_IN_DAO_TOKEN_AMOUNT() raid_geld.daoToken().balanceOf(address(raid_geld)), expectedDaoBalance
); );
// Verify player is set initially // Verify player is set initially