Skip to content

Commit

Permalink
Renamed events (removed payment prefix, renamed asset to token)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfries committed Mar 7, 2024
1 parent 8657db3 commit 5b298eb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions solidity/contracts/dvp-impl/AssetContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ contract AssetContract is ILockingContract {
require(transactionStates[id] == TransactionState.TradeConfirmed, "TransactionState State is not 'TradeConfirmed'");
transactionStates[id] = TransactionState.TransferIncepted;
transactionKeys[id].encryptedKeySeller = keyEncryptedSeller;
emit AssetTransferIncepted(transactionSpecs[id].buyer,id);
emit TransferIncepted(transactionSpecs[id].buyer, id);
}


Expand All @@ -97,17 +97,17 @@ contract AssetContract is ILockingContract {
TransactionSpec memory txSpec = transactionSpecs[id];
bondHolderBalances[txSpec.seller] -= txSpec.notional; // Decrement Notional from Seller Holder Balance
bondHolderBalances[address(this)] += txSpec.notional; // Transfer Bond to INTERNAL Balance and trigger transfer of the paymentAmount
emit AssetTransferConfirmed(transactionSpecs[id].seller,id);
emit TransferConfirmed(transactionSpecs[id].seller, id);
}


function transferWithKey(bytes32 id, string memory key) external{
require(msg.sender == transactionSpecs[id].seller || msg.sender == transactionSpecs[id].buyer, "You are not Seller or Buyer of the referenced Transaction.");
uint256 hashedKey = uint256(keccak256(abi.encode(key)));
if (msg.sender == transactionSpecs[id].seller)
emit AssetReclaimed(id,key);
emit TokenReclaimed(id, key);
if (msg.sender == transactionSpecs[id].buyer)
emit AssetClaimed(id,key);
emit TokenClaimed(id, key);
}

function checkHashFunction( string memory key, uint256 hashOfKey ) external returns (bool) {
Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/dvp-impl/PaymentContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract PaymentContract is IDecryptionContract {

function inceptTransfer(bytes32 id, int amount, address from, string memory keyEncryptedSuccess, string memory keyEncryptedFailure) external override {
transactionMap[id] = TransactionSpec(from, msg.sender, amount, keyEncryptedSuccess, keyEncryptedFailure);
emit PaymentTransferIncepted(msg.sender, id, amount);
emit TransferIncepted(msg.sender, id, amount);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface IDecryptionContract {
* @param id the trade ID.
* @param amount to be transfered.
*/
event PaymentTransferIncepted(address initiator, bytes32 id, int amount);
event TransferIncepted(address initiator, bytes32 id, int amount);

/**
* @dev Emitted when a the transfer has been performed with a success or failure.
Expand Down
8 changes: 4 additions & 4 deletions solidity/contracts/dvp-impl/interface/ILockingContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,28 @@ interface ILockingContract {
* @param initiator is the address from which trade was incepted
* @param id the trade ID
*/
event AssetTransferIncepted(address initiator, bytes32 id);
event TransferIncepted(address initiator, bytes32 id);

/**
* @dev Emitted when the transfer for the asset is incepted
* @param confirmer is the address from which trade was incepted
* @param id the trade ID
*/
event AssetTransferConfirmed(address confirmer, bytes32 id);
event TransferConfirmed(address confirmer, bytes32 id);

/**
* @dev Emitted when a confirmed trade is set to active - e.g. when termination fee amounts are provided
* @param id the trade ID
* @param key the key that was used to claim the asset
*/
event AssetClaimed(bytes32 id, string key);
event TokenClaimed(bytes32 id, string key);

/**
* @dev Emitted when an active trade is terminated
* @param id the trade ID
* @param key the key that was used to claim the asset
*/
event AssetReclaimed(bytes32 id, string key);
event TokenReclaimed(bytes32 id, string key);

/*------------------------------------------- FUNCTIONALITY ---------------------------------------------------------------------------------------*/

Expand Down
4 changes: 2 additions & 2 deletions solidity/test/DvP.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const abiCoder = new AbiCoder();
await new Promise((resolve) => setTimeout(resolve, secWait));
console.log("- Buyer calls 'inceptTransfer' against AssetContract providing the encrypted key for Seller");
const call = await deliveryContract.connect(buyer).inceptTransfer(id, assetAmount, seller.address, keyEncrypedAsString) ;
await expect(call).to.emit(deliveryContract, "AssetTransferIncepted");
await expect(call).to.emit(deliveryContract, "TransferIncepted");
await new Promise((resolve) => setTimeout(resolve, secWait));
});

Expand All @@ -116,7 +116,7 @@ const abiCoder = new AbiCoder();
console.log("- Buyer calls 'inceptTransfer' against AssetContract providing the encrypted key for Seller");
// inceptTransfer(uint id, int amount, address from, string memory keyEncryptedSuccess, string memory keyEncryptedFailure)
const call = await paymentContract.connect(buyer).inceptTransfer(id, paymentAmount, buyer.address, keyEncrypedBuyerAsString, keyEncrypedSellerAsString) ;
await expect(call).to.emit(paymentContract, "PaymentTransferIncepted");
await expect(call).to.emit(paymentContract, "TransferIncepted");
await new Promise((resolve) => setTimeout(resolve, secWait));
});

Expand Down

0 comments on commit 5b298eb

Please sign in to comment.