-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds 'should reject and not refund a pegout when a contract is trying… #156
base: rits-refactors-9-2024-integration
Are you sure you want to change the base?
Adds 'should reject and not refund a pegout when a contract is trying… #156
Conversation
f39a419
to
f5065f6
Compare
… to execute it' test Cherry-picking pegout from contract commit Rebasing
to version 1.1.4
11c5790
to
913b560
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool test
lib/contractDeployer.js
Outdated
const deployCallReleaseBtcContract = async (rskTxHelper) => { | ||
|
||
const address = await rskTxHelper.getClient().eth.personal.newAccount(''); | ||
await sendFromCow(rskTxHelper, address, Number(btcToWeis(0.5))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a constant for 0.5 now? maybe I am wrong :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Updated.
Quality Gate passedIssues Measures |
const TEST_RELEASE_BTC_CONTRACT = '../contracts/CallReleaseBtcContract.sol'; | ||
const TEST_RELEASE_BTC_CONTRACT_NAME = 'CallReleaseBtcContract'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this a generic contract deployer perhaps these values should be received by param then?
); | ||
|
||
return { | ||
creatorAddress: address, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this valuable? Shouldn't we simply return the contract address?
const pegoutValueInSatoshis = MINIMUM_PEGOUT_AMOUNT_IN_SATOSHIS; | ||
|
||
const { callReleaseBtcContract, creatorAddress } = await deployCallReleaseBtcContract(rskTxHelper); | ||
const initialRskSenderBalanceInWeisBN = await rskTxHelper.getBalance(creatorAddress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't have to be the contract creator the one that makes the call right? It can be any address
|
||
await assert2wpBalancesAfterPegoutFromContract(initial2wpBalances, pegoutValueInSatoshis); | ||
|
||
// The rsk sender should lose the funds since there's no refund when a smart contract is trying to do a pegout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also be checking the contract address balance?
Adds 'should reject and not refund a pegout when a contract is trying to execute it' test