-
Notifications
You must be signed in to change notification settings - Fork 48
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
Save ipfs rules string instead of bytes32 #159
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3e1382a
Test decoding of claim
ckoopmann 823cfb5
Save ipfs hash as string
ckoopmann 79d0b90
Change naming from rulesHash to rules to allow for more flexibility i…
ckoopmann debb3d1
Fix outdated comment
ckoopmann 5b01da2
Undo accidental replacement
ckoopmann d72d84c
Fix test
ckoopmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import "module-alias/register"; | ||
|
||
import { Address, Account } from "@utils/types"; | ||
import { base58ToHexString } from "@utils/common"; | ||
import { ADDRESS_ZERO, ZERO } from "@utils/constants"; | ||
import { | ||
BaseManager, | ||
|
@@ -52,6 +51,8 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => { | |
let useAssetAllowlist: boolean; | ||
let allowedAssets: Address[]; | ||
|
||
const ipfsHash = "Qmc5gCcjYypU7y28oCALwfSvxCBskLuPKWpK4qpterKC7z"; | ||
|
||
before(async () => { | ||
[owner, methodologist, operator] = await getAccounts(); | ||
|
||
|
@@ -305,12 +306,10 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => { | |
}); | ||
|
||
context("when the product settings have been set", () => { | ||
let rulesHash: Uint8Array; | ||
let rules: string; | ||
let bondAmount: BigNumber; | ||
beforeEach(async () => { | ||
rulesHash = utils.arrayify( | ||
base58ToHexString("Qmc5gCcjYypU7y28oCALwfSvxCBskLuPKWpK4qpterKC7z"), | ||
); | ||
rules = ipfsHash; | ||
bondAmount = ether(140); // 140 INDEX minimum bond | ||
await auctionRebalanceExtension.connect(operator.wallet).setProductSettings( | ||
{ | ||
|
@@ -320,7 +319,7 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => { | |
identifier: utils.formatBytes32String(""), | ||
optimisticOracleV3: optimisticOracleV3Mock.address, | ||
}, | ||
rulesHash, | ||
rules, | ||
); | ||
}); | ||
|
||
|
@@ -442,12 +441,7 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => { | |
], | ||
), | ||
); | ||
const firstPart = utils.toUtf8Bytes( | ||
"proposalHash:" + proposalHash.slice(2) + ',rulesIPFSHash:"', | ||
); | ||
const lastPart = utils.toUtf8Bytes('"'); | ||
|
||
return utils.hexlify(utils.concat([firstPart, rulesHash, lastPart])); | ||
return `proposalHash:${proposalHash.slice(2)},rules:"${rules}"`; | ||
} | ||
|
||
context("when the extension is open for rebalance", () => { | ||
|
@@ -528,10 +522,10 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => { | |
expect(emittedSetToken).to.eq(setToken.address); | ||
const assertedBy = assertEvent.args._assertedBy; | ||
expect(assertedBy).to.eq(operator.wallet.address); | ||
const emittedRulesHash = assertEvent.args.rulesHash; | ||
expect(emittedRulesHash).to.eq(utils.hexlify(rulesHash)); | ||
const emittedRules = assertEvent.args.rules; | ||
expect(emittedRules).to.eq(rules); | ||
const claim = assertEvent.args._claimData; | ||
expect(claim).to.eq(constructClaim()); | ||
expect(utils.toUtf8String(claim)).to.eq(constructClaim()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirming this returns as natural language now |
||
}); | ||
|
||
context("when the same rebalance has been proposed already", () => { | ||
|
@@ -570,7 +564,7 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => { | |
const currentSettings = await auctionRebalanceExtension.productSettings(); | ||
await auctionRebalanceExtension.setProductSettings( | ||
currentSettings.optimisticParams, | ||
constants.HashZero, | ||
"", | ||
); | ||
}); | ||
|
||
|
@@ -891,9 +885,7 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => { | |
identifier: utils.formatBytes32String(""), | ||
optimisticOracleV3: optimisticOracleV3MockUpgraded.address, | ||
}, | ||
utils.arrayify( | ||
base58ToHexString("Qmc5gCcjYypU7y28oCALwfSvxCBskLuPKWpK4qpterKC7z"), | ||
), | ||
ipfsHash, | ||
); | ||
|
||
const proposalHash = await auctionRebalanceExtension | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👍 reference https://etherscan.io/address/0x8692B776d1Ff0664177c90465038056Dc64f8991#readContract#F19