Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the donate cUSD #2

Merged
merged 5 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions BACKENDHARDHAT/contracts/SendcUSD.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// SPDX-License-Identifier: MIT
pragma solidity ^ 0.8.2;
interface IERC20Token {
function transfer(address, uint256) external returns (bool);
function approve(address, uint256) external returns (bool);
function transferFrom(address, address, uint256) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address) external view returns (uint256);
function allowance(address, address) external view returns (uint256);

event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract sendCeloOrEth{
uint testbalance ;
address payable receiver;
address payable owner;
event Transfer(address indexed from, address indexed to, uint256 value);
address internal cUsdTokenAddress = 0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1;

// constructor(){
// owner = payable (msg.sender);
// }

function donatecUSD( address payable _receiver)public payable {
receiver = _receiver;

_receiver.transfer(msg.value);





}
function checkBalance() public view returns(uint){
return IERC20Token(cUsdTokenAddress).balanceOf(msg.sender);
}
function getbalanceofreceiver()public view returns(uint){
return IERC20Token(cUsdTokenAddress).balanceOf(receiver);
}

receive() external payable {
// React to receiving ether
}
fallback() external payable {
// React to receiving ether
}

}
17 changes: 0 additions & 17 deletions BACKENDHARDHAT/contracts/joinCommunity.sol

This file was deleted.

12 changes: 11 additions & 1 deletion BACKENDHARDHAT/contracts/rehemaTokens.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract RehemaTokens is ERC20 ,Ownable{


constructor() ERC20("Rehema","RH"){
constructor() ERC20("Rehema","RH"){


}
Expand All @@ -23,4 +23,14 @@ _mint(msg.sender,10**18*_rehemaTokens);

return totalSupply();
}
function joinCommunity(address payable _receiver) public payable{
require(transfer(_receiver, 1*10**18),"Failed to transact");
}
function getBalanceofMember(address _receiver)public view returns(uint){
return balanceOf(_receiver);
}
function shareRehemaTokens(address payable _receiver,uint amount) public payable{
require(transferFrom(msg.sender, _receiver, amount*10**18),"Failed to transfer Rehema Tokens");
emit Transfer(msg.sender,_receiver, amount*10**18);
}
}