Here we apply cost based restriction, in which sender can’t able to send ethers less than cost defined my contract Owner.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract costBaseRistriction{
modifier cost(uint _amount){
if(msg.value < _amount)
revert("Enough Ether");
_;
if(msg.value > _amount)
payable(msg.sender).transfer(msg.value - _amount);
}
//this method to able called after 2 minute
function call1() public payable cost(1 ether){
}
//this method to able called after 3 minute
function call2()public payable cost(2 ether){
}
function getBalance()public view returns(uint){
return address(this).balance;
}
}