Skip to content

Commit f2f73da

Browse files
authored
Merge branch 'master' into chore/remove-crypto-swap-add-hover-effects
2 parents e0adac6 + 4f5f635 commit f2f73da

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

contracts/src/EscrowUniversal.sol

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
3737
uint256 public settlementTimeout; // Time in seconds a party can take to accept or propose a settlement before being considered unresponsive.
3838
Transaction[] public transactions; // List of all created transactions.
3939
mapping(uint256 => uint256) public disputeIDtoTransactionID; // Naps dispute ID to tx ID.
40+
mapping(IERC20 => uint256) public amountCaps; // Caps the amount of the respective token for the Escrow transaction.
4041

4142
// ************************************* //
4243
// * Function Modifiers * //
@@ -47,6 +48,11 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
4748
_;
4849
}
4950

51+
modifier shouldNotExceedCap(IERC20 _token, uint256 _amount) {
52+
if (amountCaps[_token] != 0 && _amount > amountCaps[_token]) revert AmountExceedsCap();
53+
_;
54+
}
55+
5056
// ************************************* //
5157
// * Constructor * //
5258
// ************************************* //
@@ -117,6 +123,10 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
117123
emit ParameterUpdated(feeTimeout, _settlementTimeout, arbitratorExtraData);
118124
}
119125

126+
function changeAmountCap(IERC20 _token, uint256 _amountCap) external onlyByGovernor {
127+
amountCaps[_token] = _amountCap;
128+
}
129+
120130
// ************************************* //
121131
// * State Modifiers * //
122132
// ************************************* //
@@ -126,7 +136,7 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
126136
uint256 _deadline,
127137
string memory _transactionUri,
128138
address payable _seller
129-
) external payable override returns (uint256 transactionID) {
139+
) external payable override shouldNotExceedCap(NATIVE, msg.value) returns (uint256 transactionID) {
130140
Transaction storage transaction = transactions.push();
131141
transaction.buyer = payable(msg.sender);
132142
transaction.seller = _seller;
@@ -153,7 +163,7 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
153163
uint256 _deadline,
154164
string memory _transactionUri,
155165
address payable _seller
156-
) external override returns (uint256 transactionID) {
166+
) external override shouldNotExceedCap(_token, _amount) returns (uint256 transactionID) {
157167
// Transfers token from sender wallet to contract.
158168
if (!_token.safeTransferFrom(msg.sender, address(this), _amount)) revert TokenTransferFailed();
159169
Transaction storage transaction = transactions.push();

contracts/src/interfaces/IEscrow.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,5 @@ interface IEscrow {
180180
error SettlementPeriodNotOver();
181181
error NotSupported();
182182
error TokenTransferFailed();
183+
error AmountExceedsCap();
183184
}

web/.env.devnet.public

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
export REACT_APP_DEPLOYMENT=devnet
33
export REACT_APP_ARBSEPOLIA_SUBGRAPH=https://api.studio.thegraph.com/query/61738/escrow-v2-devnet/version/latest
44
export REACT_APP_STATUS_URL=https://escrow-v2-devnet.betteruptime.com/badge
5-
export REACT_APP_GENESIS_BLOCK_ARBSEPOLIA=42653663

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"build-local": "scripts/runEnv.sh local 'yarn generate && vite build'",
3535
"build-devnet": "scripts/runEnv.sh devnet 'yarn generate && vite build'",
3636
"build-testnet": "scripts/runEnv.sh testnet 'yarn generate && vite build'",
37-
"build-netlify": "scripts/runEnv.sh devnet 'scripts/generateBuildInfo.sh && yarn generate && vite build'",
37+
"build-netlify": "scripts/generateBuildInfo.sh && yarn generate && vite build",
3838
"check-style": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
3939
"check-types": "tsc --noEmit",
4040
"generate": "yarn generate:gql && yarn generate:hooks",

0 commit comments

Comments
 (0)