// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.0;
contract Contributions {
address payable public contributionAddress = payable(0x30f47deeB98a3C3bF84dF9e720b8463C0867C47f);
uint256 public weiRaised;
mapping(address => uint256) public balances;
event Contribution(address from, uint value);
receive() external payable {
_buyTokens(msg.sender);
}
function _buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
weiRaised += weiAmount;
balances[_beneficiary] += weiAmount;
emit Contribution(msg.sender, weiAmount);
contributionAddress.transfer(msg.value);
}
function contribution(address _wallet) public view returns (uint256) {
return balances[_wallet];
}
}
{
"compilationTarget": {
"contracts/Contributions.sol": "Contributions"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Contribution","type":"event"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"}],"name":"_buyTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"}],"name":"contribution","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contributionAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weiRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]