Skip to content

Commit

Permalink
refactor: integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscotobar committed Feb 1, 2024
1 parent a813688 commit bf8e85b
Show file tree
Hide file tree
Showing 7 changed files with 689 additions and 385 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run test
npm run test -- --network regtest
53 changes: 28 additions & 25 deletions contracts/BoltzDeployVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,36 +57,39 @@ contract BoltzDeployVerifier is IDeployVerifier, TokenHandler {

require(!_isContract(contractAddr), "Address already created!");

if (relayRequest.request.tokenContract != address(0)) {
require(
tokens[relayRequest.request.tokenContract],
"Token contract not allowed"
);

require(
relayRequest.request.tokenAmount <=
IERC20(relayRequest.request.tokenContract).balanceOf(
contractAddr
),
"Token balance too low"
);
} else {
if(relayRequest.request.to != address(0)){
ClaimInfo memory claim = abi.decode(
relayRequest.request.data[4:],
(ClaimInfo)
);

if(relayRequest.request.tokenAmount > 0){
if (relayRequest.request.tokenContract != address(0)) {
require(
relayRequest.request.tokenAmount <= claim.amount,
"Native balance too low"
tokens[relayRequest.request.tokenContract],
"Token contract not allowed"
);
}else{
require(
relayRequest.request.tokenAmount <= address(contractAddr).balance,
"Native balance too low"
relayRequest.request.tokenAmount <=
IERC20(relayRequest.request.tokenContract).balanceOf(
contractAddr
),
"Token balance too low"
);
} else {
if(relayRequest.request.to != address(0)){
ClaimInfo memory claim = abi.decode(
relayRequest.request.data[4:],
(ClaimInfo)
);

require(
relayRequest.request.tokenAmount <= claim.amount,
"Native balance too low"
);
}else{
require(
relayRequest.request.tokenAmount <= address(contractAddr).balance,
"Native balance too low"
);
}
}

}

return (
Expand Down
Loading

0 comments on commit bf8e85b

Please sign in to comment.