Skip to content

Commit

Permalink
change getSignatures func to return value directly, not an object con…
Browse files Browse the repository at this point in the history
…taining the value
  • Loading branch information
sosaucily committed Jul 15, 2024
1 parent 911aba5 commit 6637337
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions test/DLCBTC.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,25 @@ describe('DLCBTC', function () {
).to.be.revertedWith('Ownable: caller is not the owner');
});

xit('dlcManager can mint tokens', async () => {
it('dlcManager can mint tokens', async () => {
const existingBalance = await dlcBtc.balanceOf(user.address);
await dlcManager.connect(deployer).whitelistAddress(user.address);
const tx = await dlcManager.connect(user).setupVault();
const receipt = await tx.wait();
const _uuid = await receipt.events[0].args.uuid;

await setSigners(dlcManager, attestors);
const { signatureBytesForPending } = await getSignatures(
const signatureBytesForPending = await getSignatures(
{
uuid: _uuid,
btcTxId: mockBTCTxId,
functionString: 'set-status-pending',
functionString: 'set-status-redeem-pending',
newLockedAmount: 0,
},
attestors,
3
);
const { signatureBytesForFunding } = await getSignatures(
const signatureBytesForFunding = await getSignatures(
{
uuid: _uuid,
btcTxId: mockBTCTxId,
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('DLCBTC', function () {
const _uuid = await receipt.events[0].args.uuid;

await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid: _uuid,
btcTxId: mockBTCTxId,
Expand Down
40 changes: 20 additions & 20 deletions test/DLCManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ describe('DLCManager', () => {

xit('returns the correct data', async () => {
await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand Down Expand Up @@ -293,7 +293,7 @@ describe('DLCManager', () => {
uuid = decodedEvent.args.uuid;

await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand Down Expand Up @@ -343,7 +343,7 @@ describe('DLCManager', () => {

it('reverts if called without enough signatures', async () => {
await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand All @@ -368,7 +368,7 @@ describe('DLCManager', () => {

it('reverts if contains non-approved signer', async () => {
await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand All @@ -394,7 +394,7 @@ describe('DLCManager', () => {

it('reverts if signature is for other function', async () => {
await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand All @@ -420,7 +420,7 @@ describe('DLCManager', () => {

xit('reverts if DLC is not in the right state', async () => {
await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand Down Expand Up @@ -472,7 +472,7 @@ describe('DLCManager', () => {
await setSigners(dlcManager, attestors);
const wrongUUID =
'0x96eecb386fb10e82f510aaf3e2b99f52f8dcba03f9e0521f7551b367d8ad4968';
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid: wrongUUID,
btcTxId,
Expand All @@ -499,7 +499,7 @@ describe('DLCManager', () => {
await setSigners(dlcManager, attestors);
const wrongBtcTxId =
'0x96eecb386fb10e82f510aaf3e2b99f52f8dcba03f9e0521f7551b367d8ad4968';
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId: wrongBtcTxId,
Expand All @@ -524,7 +524,7 @@ describe('DLCManager', () => {

it('reverts if signatures are not unique', async () => {
await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand All @@ -549,7 +549,7 @@ describe('DLCManager', () => {

it('reverts if deposit is too large', async () => {
await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand All @@ -574,7 +574,7 @@ describe('DLCManager', () => {

it('reverts if deposit is too small', async () => {
await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand Down Expand Up @@ -603,7 +603,7 @@ describe('DLCManager', () => {
await tx.wait();

await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand All @@ -628,7 +628,7 @@ describe('DLCManager', () => {

xit('emits a StatusFunded event with the correct data', async () => {
await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId,
Expand Down Expand Up @@ -672,7 +672,7 @@ describe('DLCManager', () => {
uuid = decodedEvent.args.uuid;

await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{ uuid, btcTxId, functionString: 'set-status-funded' },
attestors,
3
Expand Down Expand Up @@ -746,7 +746,7 @@ describe('DLCManager', () => {
uuid = decodedEvent.args.uuid;

await setSigners(dlcManager, attestors);
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{ uuid, btcTxId, functionString: 'set-status-funded' },
attestors,
3
Expand All @@ -771,7 +771,7 @@ describe('DLCManager', () => {
const decodedEvent = dlcManager.interface.parseLog(event);
const newUuid = decodedEvent.args.uuid;

const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid: newUuid,
btcTxId: closingBtcTxId,
Expand All @@ -788,7 +788,7 @@ describe('DLCManager', () => {
});

it('reverts if called without enough signatures', async () => {
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId: closingBtcTxId,
Expand All @@ -805,7 +805,7 @@ describe('DLCManager', () => {
});

xit('reverts if contains non-approved signer', async () => {
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId: closingBtcTxId,
Expand All @@ -825,7 +825,7 @@ describe('DLCManager', () => {
it('reverts if attestors sign a different UUID', async () => {
const wrongUUID =
'0x96eecb386fb10e82f510aaf3e2b99f52f8dcba03f9e0521f7551b367d8ad4968';
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid: wrongUUID,
btcTxId: closingBtcTxId,
Expand All @@ -842,7 +842,7 @@ describe('DLCManager', () => {
});

it('emits a PostCloseDLC event with the correct data', async () => {
const { signatureBytes } = await getSignatures(
const signatureBytes = await getSignatures(
{
uuid,
btcTxId: closingBtcTxId,
Expand Down
2 changes: 1 addition & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function getSignatures(message, attestors, numberOfSignatures) {
signatureBytes.push(ethers.utils.arrayify(sig));
}
// Convert signatures from strings to bytes
return { signatureBytes };
return signatureBytes;
}

async function setSigners(dlcManager, attestors) {
Expand Down

0 comments on commit 6637337

Please sign in to comment.