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

Hi,

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
Regards

The old Crowdsale contract in OpenZeppelin Contracts did this.

Hi,
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 "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/crowdsale/Crowdsale.sol";


contract myCrowdsale is Crowdsale {
    constructor (
        uint256 rate,
        address payable wallet,
        IERC20 token
    )
        public
        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.