Skip to content

Commit

Permalink
Merge pull request #2 from anthonykimani/main
Browse files Browse the repository at this point in the history
add the donate cUSD
  • Loading branch information
Ronexlemon authored Oct 3, 2022
2 parents fc9705d + 0eff10b commit 878c44d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 18 deletions.
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);
}
}

0 comments on commit 878c44d

Please sign in to comment.