In the example you linked, the wallet receiving the Ether is in the
Crowdsale contract. Each transaction forwards Ether to this address, called
You are asking about how
SampleCrowdsale.sol works. If you look at lines 48-51, you will see that this contract is simply created a capped and timed crowdsale that is refundable. It does this by creating each of those contacts that it imported at the top of the file.
To get to your answer, look at line 48,
Crowdsale(rate, wallet, token). These three parameters are pass in when creating this top level contract. When line 48 gets executed,
Crowdsale gets deployed with the given parameters.
Looking at Crowdsale.sol, you can see that its second parameter is
wallet, which gets set equal to the global variable,
_wallet upon contract creation. The comment above the declaration of
Address where funds are collected, which tells you that this is where the Ether is going.
From here, you can look into the
buyTokens() function that users call to contribute to the crowdsale. Line 140 calls the
_forwardFunds() function that simply sends all of the Ether in that transaction to