Example #1
0
def localSnapshot(fixture, baseSnapshot):
    fixture.resetToSnapshot(baseSnapshot)
    fixture.uploadAugur()
    fixture.uploadAndAddToAugur("solidity_test_helpers/DelegatorHelper.sol")
    delegatorHelperFactory = fixture.uploadAndAddToAugur("solidity_test_helpers/DelegatorHelperFactory.sol")
    delegatorHelperAddress = delegatorHelperFactory.createDelegatorHelper(fixture.contracts['Augur'].address)
    fixture.contracts["Clone"] = fixture.applySignature("DelegatorHelper", delegatorHelperAddress)
    return fixture.createSnapshot()
Example #2
0
def localSnapshot(fixture, augurInitializedWithMocksSnapshot):
    fixture.resetToSnapshot(augurInitializedWithMocksSnapshot)
    augur = fixture.contracts['Augur']
    mockCash = fixture.contracts['MockCash']
    mockAugur = fixture.contracts['MockAugur']
    mockInitialReporter = fixture.contracts['MockInitialReporter']
    mockDisputeCrowdsourcer = fixture.contracts['MockDisputeCrowdsourcer']
    mockShareTokenFactory = fixture.contracts['MockShareTokenFactory']
    mockInitialReporterFactory = fixture.contracts['MockInitialReporterFactory']
    mockDisputeCrowdsourcerFactory = fixture.contracts['MockDisputeCrowdsourcerFactory']
    mockShareToken = fixture.contracts['MockShareToken']

    # pre populate share tokens for max of 8 possible outcomes
    for index in range(8):
        item = fixture.uploadAndAddToAugur('solidity_test_helpers/MockShareToken.sol', 'newMockShareToken' + str(index))
        mockShareTokenFactory.pushCreateShareToken(item.address)

    augur.registerContract(stringToBytes('Cash'), mockCash.address)
    augur.registerContract(stringToBytes('ShareTokenFactory'), mockShareTokenFactory.address)
    augur.registerContract(stringToBytes('InitialReporterFactory'), mockInitialReporterFactory.address)
    augur.registerContract(stringToBytes('DisputeCrowdsourcerFactory'), mockDisputeCrowdsourcerFactory.address)
    mockShareTokenFactory.resetCreateShareToken()

    mockReputationToken = fixture.contracts['MockReputationToken']
    mockUniverse = fixture.contracts['MockUniverse']
    mockUniverse.setReputationToken(mockReputationToken.address)

    mockDisputeWindow = fixture.contracts['MockDisputeWindow']
    mockDisputeWindow.setReputationToken(mockReputationToken.address)
    mockDisputeWindow.setUniverse(mockUniverse.address)

    mockNextDisputeWindow = fixture.upload('solidity_test_helpers/MockDisputeWindow.sol', 'mockNextDisputeWindow')
    mockNextDisputeWindow.setReputationToken(mockReputationToken.address)
    mockNextDisputeWindow.setUniverse(mockUniverse.address)

    mockInitialReporterFactory.setInitialReporter(mockInitialReporter.address)
    mockDisputeCrowdsourcerFactory.setDisputeCrowdsourcer(mockDisputeCrowdsourcer.address)

    constants = fixture.contracts['Constants']

    market = fixture.upload('../source/contracts/reporting/Market.sol', 'market')
    fixture.contracts["initializedMarket"] = market
    contractMap = fixture.upload('../source/contracts/libraries/collections/Map.sol', 'Map')
    endTime = fixture.contracts["Time"].getTimestamp() + constants.DESIGNATED_REPORTING_DURATION_SECONDS()

    mockUniverse.setForkingMarket(longToHexString(0))
    mockUniverse.setOrCacheDesignatedReportNoShowBond(100)
    mockReputationToken.setBalanceOf(100)
    mockUniverse.setOrCacheTargetReporterGasCosts(15)
    mockUniverse.setOrCacheValidityBond(12)
    mockUniverse.setNextDisputeWindow(mockNextDisputeWindow.address)
    mockDisputeWindow.setEndTime(fixture.contracts["Time"].getTimestamp() + constants.DESIGNATED_REPORTING_DURATION_SECONDS())
    mockNextDisputeWindow.setEndTime(mockDisputeWindow.getEndTime() + constants.DESIGNATED_REPORTING_DURATION_SECONDS())
    assert market.initialize(mockUniverse.address, endTime, 16, fixture.accounts[1], fixture.accounts[2], 5, numTicks, value=100)

    return fixture.createSnapshot()