reg names

This commit is contained in:
yellow 2024-11-09 22:07:38 +01:00
parent cc9cb65e4e
commit 296113a68d
4 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,8 @@
import { Address } from "viem" import { Address } from "viem"
const contracts: Record<string, Address> = { const contracts: Record<string, Address> = {
contractAddress: "0xbd06B0878888bf4c6895704fa603a5ADf7e65c66", // contractAddress: "0xbd06B0878888bf4c6895704fa603a5ADf7e65c66",
contractAddress: "0x4593ed9CbE6003e687e5e77368534bb04b162503",
daoTokenAddress: "0x11dC980faf34A1D082Ae8A6a883db3A950a3c6E8" daoTokenAddress: "0x11dC980faf34A1D082Ae8A6a883db3A950a3c6E8"
} }

View File

@ -176,7 +176,7 @@ const PlayerProvider = ({ children }: { children: ReactNode }) => {
{ {
abi, abi,
address: contractAddress, address: contractAddress,
functionName: "register_eth", functionName: "registerEth",
value: parseEther("0.00045"), value: parseEther("0.00045"),
}, },
{ {
@ -203,7 +203,7 @@ const PlayerProvider = ({ children }: { children: ReactNode }) => {
{ {
abi, abi,
address: contractAddress, address: contractAddress,
functionName: "register_dao", functionName: "registerDaoToken",
}, },
{ {
onSuccess: (hash) => { onSuccess: (hash) => {

View File

@ -160,7 +160,7 @@ contract RaidGeld is ERC20, Ownable, Constants {
} }
// New player want to register with ETH // New player want to register with ETH
function register_eth() external payable newPlay { function registerEth() external payable newPlay {
require(msg.value == BUY_IN_AMOUNT, "Incorrect buy in amount"); require(msg.value == BUY_IN_AMOUNT, "Incorrect buy in amount");
weth.deposit{value: BUY_IN_AMOUNT}(); weth.deposit{value: BUY_IN_AMOUNT}();
weth.approve(address(router), BUY_IN_AMOUNT); weth.approve(address(router), BUY_IN_AMOUNT);
@ -179,7 +179,7 @@ contract RaidGeld is ERC20, Ownable, Constants {
} }
// New player wants to register with dao // New player wants to register with dao
function register_dao() external payable newPlay { function registerDaoToken() external payable newPlay {
//@notice this is not safe for arbitrary tokens, which may not follow the interface eg. USDT //@notice this is not safe for arbitrary tokens, which may not follow the interface eg. USDT
//@notice but should be fine for the DAO token //@notice but should be fine for the DAO token
require( require(

View File

@ -44,16 +44,17 @@ contract raid_geldTest is Test, Constants {
function fundAccount(address _acc) private { function fundAccount(address _acc) private {
vm.deal(_acc, 10 ether); vm.deal(_acc, 10 ether);
console.log("dao token", DAO_TOKEN);
stdstore.target(DAO_TOKEN).sig("balanceOf(address)").with_key(_acc).checked_write(1000 ether); stdstore.target(DAO_TOKEN).sig("balanceOf(address)").with_key(_acc).checked_write(1000 ether);
} }
function registerPlayer() private { function registerPlayer() private {
raid_geld.register_eth{value: raid_geld.BUY_IN_AMOUNT()}(); raid_geld.registerEth{value: raid_geld.BUY_IN_AMOUNT()}();
} }
function registerPlayerWithDaoToken() private { function registerPlayerWithDaoToken() private {
raid_geld.daoToken().approve(address(raid_geld), raid_geld.BUY_IN_DAO_TOKEN_AMOUNT()); raid_geld.daoToken().approve(address(raid_geld), raid_geld.BUY_IN_DAO_TOKEN_AMOUNT());
raid_geld.register_dao(); raid_geld.registerDaoToken();
} }
function test_00_no_fallback() public { function test_00_no_fallback() public {