-
Notifications
You must be signed in to change notification settings - Fork 54
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
Converted into a pure Truffle project #9
Conversation
migrations/2_deploy_contracts.js
Outdated
var UltimateOracleFactory = artifacts.require("./Oracles/UltimateOracleFactory.sol"); | ||
var LMSRMarketMaker = artifacts.require("./MarketMakers/LMSRMarketMaker.sol"); | ||
var StandardMarketFactory = artifacts.require("./Markets/StandardMarketFactory.sol"); | ||
let Math = artifacts.require('Math') |
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.
Get it by symbol and the artifact require call won't worry about filename.
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.
oh cool. so this fixes all abstract migration issues?
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 hope! ^_^'
test/test_markets.js
Outdated
it('should buy and sell all outcomes', async () => { | ||
// create event | ||
const ipfsHash = 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG' | ||
const oracle = utils.getParamFromTxEvent( |
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.
On tricky thing is getting results for things that cause a state change. Basically you have to look at events that are fired during the transaction to try and get the return value.
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.
interesting. Is that a web3 api call?
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.
Yes. You've already written this actually. I just factored it out into its own function.
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.
test looks good. I will use that as a reference going forward
test/test_markets.js
Outdated
const buyer = 1 | ||
const outcome = 0 | ||
const token_count = 1e15 | ||
const outcome_token_cost = await lmsrMarketMaker.calcCost(market.address, outcome, token_count) |
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.
All numbers that come back from contract calls are BigNumbers. I've discovered that you can use them in assert.equal
calls directly as long as both args are not BigNumber
. You can convert them to plain JS numbers by using the .valueOf()
method, or by implicitly casting them via some arithmetic ops. For some reason, if you try to use +
with BigNumber
and native numbers, you will end up concatenating their decimal representations. WTF.
Anyway, those are my caveats with that type.
Are the rest of the tests also going to be converted to JS? |
Yes, that was what was ultimately decided upon.
…On Jun 29, 2017 7:44 AM, "maurelian" ***@***.***> wrote:
Are the rest of the tests also going to be converted to JS?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#9 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASNz9_3s1K1IqBTOJFHjnwAEM5025Esks5sI5xJgaJpZM4OHKHq>
.
|
…racts into js-tests-collin
…ed to more sensible order
Js tests for Events done, Oracle tests need help.
All the tests are rewritten, save for the futarchy oracle test because it doesn't seem like setting the gas limit on TestRPC does anything, the end of the difficulty oracle test because the difficulty of blocks on TestRPC is 0, the lmsr cost function test because it is tested in gnosis.js, and the signed message oracle test. @collinc97 Turns out |
Cool. @cag Should I integrate the overloaded math function truffle test into this project? Currently, it is still in gnosis-contracts-truffle. I can also make the test more rigorous. |
Awesome, thanks @collinc97 |
@collinc97 Check it