Simple smart contract that sends my token when receives BNB/Ether


Is it possible to create a contract that sends back the tokens to the wallet that it receives BNB/ETHER from automatically?
I will have to put some gas fee in its owner wallet for transaction as well, right?

can anybody link a sample contract like that for me to view?

Let me know,
would appreciate your help

The old Crowdsale contract in OpenZeppelin Contracts did this.

Thank you for the response..

So I have imported this and trying to make use of payable by entering constraints.

I want to know, if it would be possible to send custom token to two different wallets. For example: 10% of the amount to marketing wallet in this contract..

Here is my code..

pragma solidity ^0.5.0;

import "";

contract myCrowdsale is Crowdsale {
    constructor (
        uint256 rate,
        address payable wallet,
        IERC20 token
        Crowdsale(rate, wallet, token)

If you try to write the code I will provide feedback. If you need someone to write it for you, please use the #smart-contracts:developer-wanted category.