-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22384cd
commit b827026
Showing
5 changed files
with
164 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,41 +9,31 @@ contract Remittance { | |
event LogExchange(address msgSender, address recieverAddress, uint contractAmount); | ||
|
||
struct ExchangeShopDetails { | ||
address creatorAddress; | ||
address recieverAddress; | ||
uint recieverAmount; | ||
uint deadline; | ||
} | ||
|
||
struct HashCodes { | ||
bytes32 theHash; | ||
} | ||
|
||
HashCodes[] private hashCodes; | ||
|
||
mapping(address=>ExchangeShopDetails) public exchangeShopDetails; | ||
|
||
mapping(bytes32=>ExchangeShopDetails) private exchangeShopDetails; | ||
|
||
function Remittance(){ | ||
owner = msg.sender; | ||
fee = 300000 * 4000000 ; //Fee (gas*gasPrice) | ||
contractAddress = this; | ||
|
||
} | ||
|
||
function enterHashCodes(bytes32 inputHash1,bytes32 inputHash2) public returns (bool success) { | ||
|
||
HashCodes memory newCodes; | ||
newCodes.theHash = keccak256(inputHash1,inputHash2); | ||
hashCodes.push(newCodes); | ||
return true; | ||
} | ||
|
||
function exchangeShop(uint duration, address recieverAdd) public payable returns (bool success) { | ||
function exchangeShop(bytes32 inputHash1,bytes32 inputHash2, uint duration, address recieverAdd) public payable returns (bool success) { | ||
|
||
if(msg.value== 0) revert(); | ||
|
||
exchangeShopDetails[msg.sender].recieverAddress = recieverAdd; | ||
exchangeShopDetails[msg.sender].recieverAmount = msg.value/2; //Local Currency | ||
exchangeShopDetails[msg.sender].deadline = block.number+duration; | ||
|
||
ExchangeShopDetails memory newTransfer; | ||
newTransfer.creatorAddress = msg.sender; | ||
newTransfer.recieverAddress = recieverAdd; | ||
newTransfer.recieverAmount = msg.value/2; //Local Currency | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
newTransfer.deadline = block.number+duration; | ||
exchangeShopDetails[keccak256(inputHash1,inputHash2)] = newTransfer; | ||
|
||
LogExchange(msg.sender, recieverAdd, msg.value ); | ||
|
||
|
@@ -52,8 +42,10 @@ contract Remittance { | |
|
||
function verifyFunds(bytes32 verifyhash1, bytes32 verifyhash2, address contractOwner) public returns (bool success) { | ||
|
||
require(hashCodes[0].theHash == keccak256(verifyhash1,verifyhash2)); | ||
exchangeShopDetails[contractOwner].recieverAddress.transfer(exchangeShopDetails[contractOwner].recieverAmount); | ||
ExchangeShopDetails memory toVerify = exchangeShopDetails[keccak256(verifyhash1,verifyhash2)]; | ||
require(toVerify.recieverAmount > 0); | ||
require(contractOwner == toVerify.creatorAddress); | ||
This comment has been minimized.
Sorry, something went wrong.
xavierlepretre
|
||
toVerify.recieverAddress.transfer(toVerify.recieverAmount); | ||
This comment has been minimized.
Sorry, something went wrong.
xavierlepretre
|
||
contractOwner.transfer(fee); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
return true; | ||
} | ||
|
Where are the remaining
msg.value - msg.value / 2
accounted?