Skip to content

Commit

Permalink
Deprecating Lock and Escrow reward conditions. Compleating documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aaitor committed Apr 20, 2021
1 parent 02ba516 commit babff36
Show file tree
Hide file tree
Showing 35 changed files with 869 additions and 1,366 deletions.
4 changes: 4 additions & 0 deletions contracts/Common.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ contract Common {
return ECDSAUpgradeable.recover(_hash, _signature) == _agentId;
}

/**
* @dev Sum the total amount given an uint array
* @return the total amount
*/
function calculateTotalAmount(
uint256[] memory _amounts
)
Expand Down
2 changes: 1 addition & 1 deletion contracts/conditions/AccessCondition.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import '../agreements/AgreementStoreManager.sol';
* @dev Implementation of the Access Condition
*
* Access Secret Store Condition is special condition
* where parity secret store can encrypt/decrypt documents
* where a client or Parity secret store can encrypt/decrypt documents
* based on the on-chain granted permissions. For a given DID
* document, and agreement ID, the owner/provider of the DID
* will fulfill the condition. Consequently secret store
Expand Down
15 changes: 14 additions & 1 deletion contracts/conditions/LockPaymentCondition.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ contract LockPaymentCondition is Condition, Common {
* @param _owner contract's owner account address
* @param _conditionStoreManagerAddress condition store manager address
* @param _tokenAddress Default Token contract address
* @param _didRegistryAddress DID Registry address
*/
function initialize(
address _owner,
Expand Down Expand Up @@ -155,6 +156,13 @@ contract LockPaymentCondition is Condition, Common {
return state;
}

/**
* @notice _transferERC20 transfer ERC20 tokens
* @param _rewardAddress the address to receive the tokens
* @param _tokenAddress the ERC20 contract address to use during the payment
* @param _amount token amount to be locked/released
* @return true if everything worked
*/
function _transferERC20(
address _rewardAddress,
address _tokenAddress,
Expand All @@ -169,7 +177,12 @@ contract LockPaymentCondition is Condition, Common {
);
return true;
}


/**
* @notice _transferETH transfer ETH
* @param _rewardAddress the address to receive the ETH
* @param _amount ETH amount to be locked/released
*/
function _transferETH(
address payable _rewardAddress,
uint256 _amount
Expand Down
117 changes: 0 additions & 117 deletions contracts/conditions/LockRewardCondition.sol

This file was deleted.

16 changes: 0 additions & 16 deletions contracts/conditions/NFTs/NFTLockCondition.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,6 @@ contract NFTLockCondition is Condition, IERC1155ReceiverUpgradeable {
registry = IERC1155Upgradeable(_didRegistryAddress);
}

function grantTransferApproval(
address _nftRewardCondition
)
public
{
registry.setApprovalForAll(_nftRewardCondition, true);
}

function revokeTransferApproval(
address _nftRewardCondition
)
public
{
registry.setApprovalForAll(_nftRewardCondition, false);
}

/**
* @notice hashValues generates the hash of condition inputs
* with the following parameters
Expand Down
4 changes: 2 additions & 2 deletions contracts/conditions/rewards/EscrowPaymentCondition.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ contract EscrowPaymentCondition is Reward, Common {
* @param _lockPaymentAddress lock payment contract address
* @param _tokenAddress the ERC20 contract address to use during the payment
* @param _lockCondition lock condition identifier
* @param _lockPaymentAddress release condition identifier
* @param _releaseCondition release condition identifier
* @return condition state (Fulfilled/Aborted)
*/
function fulfill(
Expand Down Expand Up @@ -203,7 +203,7 @@ contract EscrowPaymentCondition is Reward, Common {
}

/**
* @notice _transferAndFulfill transfer tokens and
* @notice _transferAndFulfill transfer ERC20 tokens and
* fulfill the condition
* @param _id condition identifier
* @param _tokenAddress the ERC20 contract address to use during the payment
Expand Down

0 comments on commit babff36

Please sign in to comment.