-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds 'should reject and not refund a pegout when a contract is trying…
… to execute it' test Cherry-picking pegout from contract commit
- Loading branch information
1 parent
58d00aa
commit 9ed7282
Showing
6 changed files
with
122 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pragma solidity ^0.8.0; | ||
|
||
interface BridgeInterface { | ||
function releaseBtc() external payable; | ||
} | ||
|
||
contract CallReleaseBtcContract { | ||
|
||
BridgeInterface public bridgeContract = BridgeInterface(0x0000000000000000000000000000000001000006); | ||
|
||
function callBridgeReleaseBtc() external payable { | ||
bridgeContract.releaseBtc{value:msg.value}(); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { btcToWeis } = require('@rsksmart/btc-eth-unit-converter'); | ||
const solUtils = require('./sol-utils'); | ||
const TEST_RELEASE_BTC_CONTRACT = '../contracts/CallReleaseBtcContract.sol'; | ||
const TEST_RELEASE_BTC_CONTRACT_NAME = 'CallReleaseBtcContract'; | ||
const SOLIDITY_COMPILER_VERSION = 'v0.8.26+commit.8a97fa7a'; | ||
const { sendFromCow } = require('./rsk-utils'); | ||
|
||
const deployCallReleaseBtcContract = async (rskTxHelper) => { | ||
|
||
const address = await rskTxHelper.getClient().eth.personal.newAccount(''); | ||
await sendFromCow(rskTxHelper, address, Number(btcToWeis(0.5))); | ||
await rskTxHelper.getClient().eth.personal.unlockAccount(address, ''); | ||
|
||
const fullPath = path.resolve(__dirname, TEST_RELEASE_BTC_CONTRACT); | ||
const source = fs.readFileSync(fullPath).toString(); | ||
|
||
const callReleaseBtcContract = await solUtils.compileAndDeploy( | ||
SOLIDITY_COMPILER_VERSION, | ||
source, | ||
TEST_RELEASE_BTC_CONTRACT_NAME, | ||
[], | ||
rskTxHelper, | ||
{ | ||
from: address | ||
} | ||
); | ||
|
||
return { | ||
creatorAddress: address, | ||
callReleaseBtcContract, | ||
}; | ||
|
||
}; | ||
|
||
module.exports = { | ||
deployCallReleaseBtcContract, | ||
}; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
"license": "GPL3", | ||
"dependencies": { | ||
"@rsksmart/bridge-state-data-parser": "^1.2.0", | ||
"@rsksmart/bridge-transaction-parser": "^1.1.3", | ||
"@rsksmart/bridge-transaction-parser": "git+https://[email protected]/rsksmart/bridge-transaction-parser#c7cc7f5077eabf2e818bad3bb13fac9b9aabf477", | ||
"@rsksmart/btc-eth-unit-converter": "^1.0.0", | ||
"@rsksmart/btc-rsk-derivation": "^0.0.2", | ||
"@rsksmart/pmt-builder": "^3.0.0", | ||
|