def init(logger,modelCalculator,priceBandCalculator,ReconciliationAdjuster,ETHConverter,timeout):
    contractAddressLocator = ContractAddressLocator()
    reconciliationAdjuster      = ReconciliationAdjuster     ()
    ethConverter   = ETHConverter  (contractAddressLocator)
    modelDataSource             = ModelDataSource            ()
    mintingPointTimersManager            = MintingPointTimersManager           (contractAddressLocator,timeout)
    mintManager            = MintManager           (contractAddressLocator)
    intervalIterator       = IntervalIterator      (contractAddressLocator)
    monetaryModelState         = MonetaryModelState        (contractAddressLocator)
    monetaryModel              = MonetaryModel             (contractAddressLocator)
    transactionLimiter     = TransactionLimiter    (contractAddressLocator)
    transactionManager     = TransactionManager    (contractAddressLocator)
    sgaToken               = SGAToken              (contractAddressLocator)

    contractAddressLocator.set('ModelCalculator'     ,modelCalculator     )
    contractAddressLocator.set('PriceBandCalculator'    ,priceBandCalculator    )
    contractAddressLocator.set('ReconciliationAdjuster'   ,reconciliationAdjuster   )
    contractAddressLocator.set('ETHConverter',ethConverter)
    contractAddressLocator.set('ModelDataSource'          ,modelDataSource          )
    contractAddressLocator.set('MintingPointTimersManager'         ,mintingPointTimersManager         )
    contractAddressLocator.set('MintManager'         ,mintManager         )
    contractAddressLocator.set('IntervalIterator'    ,intervalIterator    )
    contractAddressLocator.set('MonetaryModelState'      ,monetaryModelState      )
    contractAddressLocator.set('MonetaryModel'           ,monetaryModel           )
    contractAddressLocator.set('TransactionLimiter'  ,transactionLimiter  )
    contractAddressLocator.set('TransactionManager'  ,transactionManager  )
    contractAddressLocator.set('SGAToken'            ,sgaToken            )

    initialize(modelDataSource,logger)

    return mintingPointTimersManager,sgaToken
示例#2
0
def init(logger,modelCalculator,priceBandCalculator,timeout):
    contractAddressLocator = ContractAddressLocator()
    modelDataSource             = ModelDataSource            ()
    mintingPointTimersManager            = MintingPointTimersManager           (contractAddressLocator,timeout)
    mintManager            = MintManager           (contractAddressLocator)
    intervalIterator       = IntervalIterator      (contractAddressLocator)
    monetaryModelState         = MonetaryModelState        (contractAddressLocator)
    monetaryModel              = MonetaryModel             (contractAddressLocator)

    contractAddressLocator.set('ModelCalculator' ,modelCalculator )
    contractAddressLocator.set('PriceBandCalculator',priceBandCalculator)
    contractAddressLocator.set('ModelDataSource'      ,modelDataSource      )
    contractAddressLocator.set('MintingPointTimersManager'     ,mintingPointTimersManager     )
    contractAddressLocator.set('MintManager'     ,mintManager     )
    contractAddressLocator.set('IntervalIterator',intervalIterator)
    contractAddressLocator.set('MonetaryModelState'  ,monetaryModelState  )
    contractAddressLocator.set('MonetaryModel'       ,monetaryModel       )

    initialize(modelDataSource,logger)

    return mintingPointTimersManager,monetaryModelState,monetaryModel
示例#3
0
def init(logger, timeout):
    contractAddressLocatorProxy = Contract('ContractAddressLocatorProxy', [])
    modelCalculator = Contract('ModelCalculator', [])
    priceBandCalculator = Contract('PriceBandCalculator', [])
    modelDataSource = Contract('ModelDataSource', [])
    mintingPointTimersManager = Contract(
        'MintingPointTimersManager',
        [contractAddressLocatorProxy.address, timeout])
    mintManager = Contract('MintManager',
                           [contractAddressLocatorProxy.address])
    intervalIterator = Contract('IntervalIterator',
                                [contractAddressLocatorProxy.address])
    monetaryModelState = Contract('MonetaryModelState',
                                  [contractAddressLocatorProxy.address])
    monetaryModel = Contract('MonetaryModel',
                             [contractAddressLocatorProxy.address])
    contractAddressLocator = Contract(
        'ContractAddressLocator',
        unzip([
            ['IModelCalculator', modelCalculator.address],
            ['IPriceBandCalculator', priceBandCalculator.address],
            ['IModelDataSource', modelDataSource.address],
            ['IMintingPointTimersManager', mintingPointTimersManager.address],
            ['IMintManager', mintManager.address],
            ['IIntervalIterator', intervalIterator.address],
            ['IMonetaryModelState', monetaryModelState.address],
            ['IMonetaryModel', monetaryModel.address],
            ['ITransactionManager', Contract.owner],
        ]))

    contractAddressLocatorProxy.setter().upgrade(
        contractAddressLocator.address)

    initialize(modelDataSource.setter(), logger)

    return monetaryModelState, monetaryModel
def run(logger):
    contractAddressLocatorProxy = Contract('ContractAddressLocatorProxy',[                                   ])
    modelCalculator             = Contract('ModelCalculator'            ,[                                   ])
    priceBandCalculator            = Contract('PriceBandCalculator'           ,[                                   ])
    reconciliationAdjuster           = Contract('ReconciliationAdjuster'          ,[                                   ])
    ethConverter        = Contract('ETHConverter'       ,[contractAddressLocatorProxy.address])
    rateApprover        = Contract('RateApprover'       ,[contractAddressLocatorProxy.address])
    modelDataSource                  = Contract('ModelDataSource'                 ,[                                   ])
    monetaryModel                   = Contract('MonetaryModel'                  ,[contractAddressLocatorProxy.address])
    transactionLimiter          = Contract('TransactionLimiter'         ,[contractAddressLocatorProxy.address])
    transactionManager          = Contract('TransactionManager'         ,[contractAddressLocatorProxy.address])
    authorizationDataSource     = Contract('AuthorizationDataSource'    ,[                                   ])
    sgaAuthorizationManager     = Contract('SGAAuthorizationManager'    ,[contractAddressLocatorProxy.address])
    walletsTradingDataSource           = Contract('WalletsTradingDataSource'          ,[contractAddressLocatorProxy.address])
    walletsTradingLimiterValueConverter            = Contract('WalletsTradingLimiterValueConverter'           ,[                                   ])
    tradingClasses              = Contract('TradingClasses'             ,[                                   ])
    sgaWalletsTradingLimiter              = Contract('SGAWalletsTradingLimiter'             ,[contractAddressLocatorProxy.address        ])
    reserveManager              = Contract('ReserveManager'             ,[contractAddressLocatorProxy.address])
    paymentManager                 = Contract('PaymentManager'                ,[contractAddressLocatorProxy.address])
    paymentQueue                   = Contract('PaymentQueue'                  ,[contractAddressLocatorProxy.address])
    redButton                   = Contract('RedButton'                  ,[                                   ])
    sgaTokenManager             = Contract('SGATokenManager'            ,[contractAddressLocatorProxy.address])

    initialize(modelDataSource.setter(),logger)

    walletsTradingLimiterValueConverter.setter().accept(Contract.owner)
    ethConverter.setter().accept(Contract.owner)
    authorizationDataSource.setter().accept(Contract.owner)
    authorizationDataSource.setter().upsertOne(Contract.owner,1,True,2**256-1,2**256-1,0)

    testCount  = 0
    numOfTests = len(CONSTANTS)**4
    logger.info('Starting {} tests...'.format(numOfTests))

    for factorN in CONSTANTS:
        for factorD in CONSTANTS:
            for priceN in CONSTANTS:
                for priceD in CONSTANTS:
                    testCount += 1
                    mintingPointTimersManager            = Contract('MintingPointTimersManager'           ,[contractAddressLocatorProxy.address,2**255])
                    mintManager            = Contract('MintManager'           ,[contractAddressLocatorProxy.address       ])
                    intervalIterator       = Contract('IntervalIterator'      ,[contractAddressLocatorProxy.address       ])
                    monetaryModelState         = Contract('MonetaryModelState'        ,[contractAddressLocatorProxy.address       ])
                    sgaToken               = Contract('SGAToken'              ,[contractAddressLocatorProxy.address       ])
                    contractAddressLocator = Contract('ContractAddressLocator',unzip([
                        ['IModelCalculator'        ,modelCalculator        .address],
                        ['IPriceBandCalculator'       ,priceBandCalculator       .address],
                        ['IReconciliationAdjuster'      ,reconciliationAdjuster      .address],
                        ['IETHConverter'   ,ethConverter   .address],
                        ['IModelDataSource'             ,modelDataSource             .address],
                        ['IMintingPointTimersManager'            ,mintingPointTimersManager            .address],
                        ['IMintManager'            ,mintManager            .address],
                        ['IIntervalIterator'       ,intervalIterator       .address],
                        ['IMonetaryModelState'         ,monetaryModelState         .address],
                        ['IMonetaryModel'              ,monetaryModel              .address],
                        ['ITransactionLimiter'     ,transactionLimiter     .address],
                        ['ITransactionManager'     ,transactionManager     .address],
                        ['ISGAToken'               ,sgaToken               .address],
                        ['IAuthorizationDataSource',authorizationDataSource.address],
                        ['ISGAAuthorizationManager',sgaAuthorizationManager.address],
                        ['IWalletsTradingDataSource'      ,walletsTradingDataSource      .address],
                        ['IWalletsTLValueConverter'       ,walletsTradingLimiterValueConverter       .address],
                        ['ITradingClasses'         ,tradingClasses         .address],
                        ['WalletsTLSGATokenManager'         ,sgaWalletsTradingLimiter         .address],
                        ['IReserveManager'         ,reserveManager         .address],
                        ['IPaymentManager'            ,paymentManager            .address],
                        ['IPaymentQueue'              ,paymentQueue              .address],
                        ['IRedButton'              ,redButton              .address],
                        ['ISGATokenManager'        ,sgaTokenManager        .address],
                        ["IRateApprover"           , rateApprover               .address],
                    ]))
                    contractAddressLocatorProxy.setter().upgrade(contractAddressLocator.address)
                    rateApprover.setter().setRateBounds(1, 0x10000000000000000,1,1,0x10000000000000000)
                    walletsTradingLimiterValueConverter.setter().setPrice(testCount,1,1)

                    reconciliationAdjuster.setter().setFactor(testCount,factorN,factorD)
                    ethConverter.setter().setPrice(testCount,priceN,priceD,priceN,priceD)
                    sdrInput     = reconciliationAdjuster.getter().adjustSell(MAX_SDR_AMOUNT)
                    ethInput     = ethConverter.getter().toEthAmount(sdrInput)
                    b_sgaOutput  = Contract.decode(sgaToken.setter({'value':ethInput}).exchange(),2,eventParams)['output']
                    b_sdrInModel = monetaryModelState.getter().getSdrTotal()
                    b_sgaInModel = monetaryModelState.getter().getSgaTotal()
                    b_sgaInToken = sgaToken.getter().totalSupply()
                    b_ethInToken = sgaToken.balance()
                    s_ethOutput  = Contract.decode(sgaToken.setter().transfer(sgaToken.address,b_sgaOutput),2,eventParams)['output']
                    s_sdrInModel = monetaryModelState.getter().getSdrTotal()
                    s_sgaInModel = monetaryModelState.getter().getSgaTotal()
                    s_sgaInToken = sgaToken.getter().totalSupply()
                    s_ethInToken = sgaToken.balance()
                    logger.periodic(testCount,numOfTests,'factorN      = {}'.format(int(factorN     )))
                    logger.periodic(testCount,numOfTests,'factorD      = {}'.format(int(factorD     )))
                    logger.periodic(testCount,numOfTests,'priceN       = {}'.format(int(priceN      )))
                    logger.periodic(testCount,numOfTests,'priceD       = {}'.format(int(priceD      )))
                    logger.periodic(testCount,numOfTests,'sdrInput     = {}'.format(int(sdrInput    )))
                    logger.periodic(testCount,numOfTests,'ethInput     = {}'.format(int(ethInput    )))
                    logger.periodic(testCount,numOfTests,'b_sgaOutput  = {}'.format(int(b_sgaOutput )))
                    logger.periodic(testCount,numOfTests,'b_sdrInModel = {}'.format(int(b_sdrInModel)))
                    logger.periodic(testCount,numOfTests,'b_sgaInModel = {}'.format(int(b_sgaInModel)))
                    logger.periodic(testCount,numOfTests,'b_sgaInToken = {}'.format(int(b_sgaInToken)))
                    logger.periodic(testCount,numOfTests,'b_ethInToken = {}'.format(int(b_ethInToken)))
                    logger.periodic(testCount,numOfTests,'s_ethOutput  = {}'.format(int(s_ethOutput )))
                    logger.periodic(testCount,numOfTests,'s_sdrInModel = {}'.format(int(s_sdrInModel)))
                    logger.periodic(testCount,numOfTests,'s_sgaInModel = {}'.format(int(s_sgaInModel)))
                    logger.periodic(testCount,numOfTests,'s_sgaInToken = {}'.format(int(s_sgaInToken)))
                    logger.periodic(testCount,numOfTests,'s_ethInToken = {}'.format(int(s_ethInToken)))
示例#5
0
def init(logger, timeout):
    contractAddressLocatorProxy = Contract('ContractAddressLocatorProxy', [])
    modelCalculator = Contract('ModelCalculator', [])
    priceBandCalculator = Contract('PriceBandCalculator', [])
    reconciliationAdjuster = Contract('ReconciliationAdjuster', [])
    ethConverter = Contract('ETHConverter',
                            [contractAddressLocatorProxy.address])
    modelDataSource = Contract('ModelDataSource', [])
    mintingPointTimersManager = Contract(
        'MintingPointTimersManager',
        [contractAddressLocatorProxy.address, timeout])
    mintManager = Contract('MintManager',
                           [contractAddressLocatorProxy.address])
    intervalIterator = Contract('IntervalIterator',
                                [contractAddressLocatorProxy.address])
    monetaryModelState = Contract('MonetaryModelState',
                                  [contractAddressLocatorProxy.address])
    monetaryModel = Contract('MonetaryModel',
                             [contractAddressLocatorProxy.address])
    transactionLimiter = Contract('TransactionLimiter',
                                  [contractAddressLocatorProxy.address])
    transactionManager = Contract('TransactionManager',
                                  [contractAddressLocatorProxy.address])
    sgaToken = Contract('SGAToken', [contractAddressLocatorProxy.address])
    authorizationDataSource = Contract('AuthorizationDataSource', [])
    sgaAuthorizationManager = Contract('SGAAuthorizationManager',
                                       [contractAddressLocatorProxy.address])
    walletsTradingDataSource = Contract('WalletsTradingDataSource',
                                        [contractAddressLocatorProxy.address])
    walletsTradingLimiterValueConverter = Contract(
        'WalletsTradingLimiterValueConverter', [])
    tradingClasses = Contract('TradingClasses', [])
    sgaWalletsTradingLimiter = Contract('SGAWalletsTradingLimiter',
                                        [contractAddressLocatorProxy.address])
    reserveManager = Contract('ReserveManager',
                              [contractAddressLocatorProxy.address])
    paymentManager = Contract('PaymentManager',
                              [contractAddressLocatorProxy.address])
    paymentQueue = Contract('PaymentQueue',
                            [contractAddressLocatorProxy.address])
    redButton = Contract('RedButton', [])
    sgaTokenManager = Contract('SGATokenManager',
                               [contractAddressLocatorProxy.address])
    contractAddressLocator = Contract(
        'ContractAddressLocator',
        unzip([
            ['IModelCalculator', modelCalculator.address],
            ['IPriceBandCalculator', priceBandCalculator.address],
            ['IReconciliationAdjuster', reconciliationAdjuster.address],
            ['IETHConverter', ethConverter.address],
            ['IModelDataSource', modelDataSource.address],
            ['IMintingPointTimersManager', mintingPointTimersManager.address],
            ['IMintManager', mintManager.address],
            ['IIntervalIterator', intervalIterator.address],
            ['IMonetaryModelState', monetaryModelState.address],
            ['IMonetaryModel', monetaryModel.address],
            ['ITransactionLimiter', transactionLimiter.address],
            ['ITransactionManager', transactionManager.address],
            ['ISGAToken', sgaToken.address],
            ['IAuthorizationDataSource', authorizationDataSource.address],
            ['ISGAAuthorizationManager', sgaAuthorizationManager.address],
            ['IWalletsTradingDataSource', walletsTradingDataSource.address],
            [
                'IWalletsTradingLimiterValueConverter',
                walletsTradingLimiterValueConverter.address
            ],
            ['ITradingClasses', tradingClasses.address],
            ['IWalletsTradingLimiter', sgaWalletsTradingLimiter.address],
            ['IReserveManager', reserveManager.address],
            ['IPaymentManager', paymentManager.address],
            ['IPaymentQueue', paymentQueue.address],
            ['IRedButton', redButton.address],
            ['ISGATokenManager', sgaTokenManager.address],
        ]))

    contractAddressLocatorProxy.setter().upgrade(
        contractAddressLocator.address)

    initialize(modelDataSource.setter(), logger)

    authorizationDataSource.setter().accept(Contract.owner)
    authorizationDataSource.setter().upsertOne(Contract.owner, 1, True,
                                               2**256 - 1, 2**256 - 1, 0)

    return sgaToken
示例#6
0
def run(logger, modelCalculator, priceBandCalculator, ReconciliationAdjuster,
        ETHConverter):
    contractAddressLocator = ContractAddressLocator()
    reconciliationAdjuster = ReconciliationAdjuster()
    ethConverter = ETHConverter(contractAddressLocator)
    modelDataSource = ModelDataSource()
    monetaryModel = MonetaryModel(contractAddressLocator)
    transactionLimiter = TransactionLimiter(contractAddressLocator)
    transactionManager = TransactionManager(contractAddressLocator)

    contractAddressLocator.set('ModelCalculator', modelCalculator)
    contractAddressLocator.set('PriceBandCalculator', priceBandCalculator)
    contractAddressLocator.set('ReconciliationAdjuster',
                               reconciliationAdjuster)
    contractAddressLocator.set('ETHConverter', ethConverter)
    contractAddressLocator.set('ModelDataSource', modelDataSource)
    contractAddressLocator.set('MonetaryModel', monetaryModel)
    contractAddressLocator.set('TransactionLimiter', transactionLimiter)
    contractAddressLocator.set('TransactionManager', transactionManager)

    initialize(modelDataSource, logger)

    testCount = 0
    numOfTests = len(CONSTANTS)**4
    logger.info('Starting {} tests...'.format(numOfTests))

    for factorN in CONSTANTS:
        for factorD in CONSTANTS:
            for priceN in CONSTANTS:
                for priceD in CONSTANTS:
                    testCount += 1
                    mintingPointTimersManager = MintingPointTimersManager(
                        contractAddressLocator, 2**255)
                    mintManager = MintManager(contractAddressLocator)
                    intervalIterator = IntervalIterator(contractAddressLocator)
                    monetaryModelState = MonetaryModelState(
                        contractAddressLocator)
                    sgrToken = SGRToken(contractAddressLocator)
                    contractAddressLocator.set('MintingPointTimersManager',
                                               mintingPointTimersManager)
                    contractAddressLocator.set('MintManager', mintManager)
                    contractAddressLocator.set('IntervalIterator',
                                               intervalIterator)
                    contractAddressLocator.set('MonetaryModelState',
                                               monetaryModelState)
                    contractAddressLocator.set('SGRToken', sgrToken)
                    reconciliationAdjuster.setFactor(testCount, factorN,
                                                     factorD)
                    ethConverter.setPrice(testCount, priceN, priceD, priceN,
                                          priceD)
                    sdrInput = reconciliationAdjuster.adjustSell(
                        MAX_SDR_AMOUNT)
                    ethInput = ethConverter.toEthAmount(sdrInput)
                    b_sgrOutput = sgrToken.buy(ethInput)
                    b_sdrInModel = monetaryModelState.getSdrTotal()
                    b_sgrInModel = monetaryModelState.getSgrTotal()
                    b_sgrInToken = sgrToken.sgrTotal
                    b_ethInToken = sgrToken.ethTotal
                    s_ethOutput = sgrToken.sell(b_sgrOutput)
                    s_sdrInModel = monetaryModelState.getSdrTotal()
                    s_sgrInModel = monetaryModelState.getSgrTotal()
                    s_sgrInToken = sgrToken.sgrTotal
                    s_ethInToken = sgrToken.ethTotal
                    logger.periodic(testCount, numOfTests,
                                    'factorN      = {}'.format(int(factorN)))
                    logger.periodic(testCount, numOfTests,
                                    'factorD      = {}'.format(int(factorD)))
                    logger.periodic(testCount, numOfTests,
                                    'priceN       = {}'.format(int(priceN)))
                    logger.periodic(testCount, numOfTests,
                                    'priceD       = {}'.format(int(priceD)))
                    logger.periodic(testCount, numOfTests,
                                    'sdrInput     = {}'.format(int(sdrInput)))
                    logger.periodic(testCount, numOfTests,
                                    'ethInput     = {}'.format(int(ethInput)))
                    logger.periodic(
                        testCount, numOfTests,
                        'b_sgrOutput  = {}'.format(int(b_sgrOutput)))
                    logger.periodic(
                        testCount, numOfTests,
                        'b_sdrInModel = {}'.format(int(b_sdrInModel)))
                    logger.periodic(
                        testCount, numOfTests,
                        'b_sgrInModel = {}'.format(int(b_sgrInModel)))
                    logger.periodic(
                        testCount, numOfTests,
                        'b_sgrInToken = {}'.format(int(b_sgrInToken)))
                    logger.periodic(
                        testCount, numOfTests,
                        'b_ethInToken = {}'.format(int(b_ethInToken)))
                    logger.periodic(
                        testCount, numOfTests,
                        's_ethOutput  = {}'.format(int(s_ethOutput)))
                    logger.periodic(
                        testCount, numOfTests,
                        's_sdrInModel = {}'.format(int(s_sdrInModel)))
                    logger.periodic(
                        testCount, numOfTests,
                        's_sgrInModel = {}'.format(int(s_sgrInModel)))
                    logger.periodic(
                        testCount, numOfTests,
                        's_sgrInToken = {}'.format(int(s_sgrInToken)))
                    logger.periodic(
                        testCount, numOfTests,
                        's_ethInToken = {}'.format(int(s_ethInToken)))
def run(logger):
    contractAddressLocatorProxy = Contract('ContractAddressLocatorProxy', [])
    aggregatorInterfaceMockup = Contract('AggregatorInterfaceMockup', [])
    modelCalculator = Contract('ModelCalculator', [])
    priceBandCalculator = Contract('PriceBandCalculator', [])
    reconciliationAdjuster = Contract('ReconciliationAdjuster', [])
    ethConverter = Contract('ETHConverter',
                            [contractAddressLocatorProxy.address])
    rateApprover = Contract('OracleRateApprover', [
        contractAddressLocatorProxy.address, aggregatorInterfaceMockup.address,
        10000
    ])
    modelDataSource = Contract('ModelDataSource', [])
    monetaryModel = Contract('MonetaryModel',
                             [contractAddressLocatorProxy.address])
    transactionLimiter = Contract('TransactionLimiter',
                                  [contractAddressLocatorProxy.address])
    transactionManager = Contract('TransactionManager',
                                  [contractAddressLocatorProxy.address])
    authorizationDataSource = Contract('AuthorizationDataSource', [])
    sgrAuthorizationManager = Contract('SGRAuthorizationManager',
                                       [contractAddressLocatorProxy.address])
    buyWalletsTradingDataSource = Contract(
        'WalletsTradingDataSource', [contractAddressLocatorProxy.address])
    sellWalletsTradingDataSource = Contract(
        'WalletsTradingDataSource', [contractAddressLocatorProxy.address])
    sgrBuyWalletsTradingLimiter = Contract(
        'SGRBuyWalletsTradingLimiter', [contractAddressLocatorProxy.address])
    sgrSellWalletsTradingLimiter = Contract(
        'SGRSellWalletsTradingLimiter', [contractAddressLocatorProxy.address])
    walletsTradingLimiterValueConverter = Contract(
        'WalletsTradingLimiterValueConverter', [])
    tradingClasses = Contract('TradingClasses', [])

    reserveManager = Contract('ReserveManager',
                              [contractAddressLocatorProxy.address])
    paymentManager = Contract('PaymentManager',
                              [contractAddressLocatorProxy.address])
    paymentQueue = Contract('PaymentQueue',
                            [contractAddressLocatorProxy.address])
    redButton = Contract('RedButton', [])
    sgrTokenManager = Contract('SGRTokenManager',
                               [contractAddressLocatorProxy.address])

    initialize(modelDataSource.setter(), logger)

    walletsTradingLimiterValueConverter.setter().accept(Contract.owner)
    ethConverter.setter().accept(Contract.owner)
    authorizationDataSource.setter().accept(Contract.owner)
    buyWalletsTradingDataSource.setter().setAuthorizedExecutorsIdentifier([
        Web3.toHex(text='BuyWalletsTLSGRTokenManager'),
        Web3.toHex(text='WalletsTLSGNTokenManager')
    ])
    sellWalletsTradingDataSource.setter().setAuthorizedExecutorsIdentifier(
        [Web3.toHex(text='SellWalletsTLSGRTokenManager')])

    authorizationDataSource.setter().upsertOne(Contract.owner, 1, True,
                                               2**256 - 1, 2**256 - 1,
                                               2**256 - 1, 0)

    testCount = 0
    numOfTests = len(CONSTANTS)**4
    logger.info('Starting {} tests...'.format(numOfTests))

    for factorN in CONSTANTS:
        for factorD in CONSTANTS:
            for priceN in CONSTANTS:
                for priceD in CONSTANTS:
                    testCount += 1
                    mintingPointTimersManager = Contract(
                        'MintingPointTimersManager',
                        [contractAddressLocatorProxy.address, 2**255])
                    mintManager = Contract(
                        'MintManager', [contractAddressLocatorProxy.address])
                    intervalIterator = Contract(
                        'IntervalIterator',
                        [contractAddressLocatorProxy.address])
                    monetaryModelState = Contract(
                        'MonetaryModelState',
                        [contractAddressLocatorProxy.address])
                    sgrToken = Contract('SGRToken',
                                        [contractAddressLocatorProxy.address])
                    contractAddressLocator = Contract(
                        'ContractAddressLocator',
                        unzip([
                            ['IModelCalculator', modelCalculator.address],
                            [
                                'IPriceBandCalculator',
                                priceBandCalculator.address
                            ],
                            [
                                'IReconciliationAdjuster',
                                reconciliationAdjuster.address
                            ],
                            ['IETHConverter', ethConverter.address],
                            ['IModelDataSource', modelDataSource.address],
                            [
                                'IMintingPointTimersManager',
                                mintingPointTimersManager.address
                            ],
                            ['IMintManager', mintManager.address],
                            ['IIntervalIterator', intervalIterator.address],
                            [
                                'IMonetaryModelState',
                                monetaryModelState.address
                            ],
                            ['IMonetaryModel', monetaryModel.address],
                            [
                                'ITransactionLimiter',
                                transactionLimiter.address
                            ],
                            [
                                'ITransactionManager',
                                transactionManager.address
                            ],
                            ['ISGRToken', sgrToken.address],
                            [
                                'IAuthorizationDataSource',
                                authorizationDataSource.address
                            ],
                            [
                                'ISGRAuthorizationManager',
                                sgrAuthorizationManager.address
                            ],
                            [
                                'IWalletsTLValueConverter',
                                walletsTradingLimiterValueConverter.address
                            ],
                            ['ITradingClasses', tradingClasses.address],
                            [
                                "BuyWalletsTLSGRTokenManager",
                                sgrBuyWalletsTradingLimiter.address
                            ],
                            [
                                "SellWalletsTLSGRTokenManager",
                                sgrSellWalletsTradingLimiter.address
                            ],
                            [
                                'BuyWalletsTradingDataSource',
                                buyWalletsTradingDataSource.address
                            ],
                            [
                                'SellWalletsTradingDataSource',
                                sellWalletsTradingDataSource.address
                            ],
                            ['IReserveManager', reserveManager.address],
                            ['IPaymentManager', paymentManager.address],
                            ['IPaymentQueue', paymentQueue.address],
                            ['IRedButton', redButton.address],
                            ['ISGRTokenManager', sgrTokenManager.address],
                            ["IRateApprover", rateApprover.address],
                        ]))

                    price = int((priceN / priceD) * 100000000)
                    tooLowPrice = price == 0

                    try:
                        contractAddressLocatorProxy.setter().upgrade(
                            contractAddressLocator.address)

                        aggregatorInterfaceMockup.setter().setLatestAnswer(
                            price)

                        walletsTradingLimiterValueConverter.setter().setPrice(
                            testCount, 1, 1)

                        reconciliationAdjuster.setter().setFactor(
                            testCount, factorN, factorD)
                        ethConverter.setter().setPrice(testCount, priceN,
                                                       priceD, priceN, priceD)
                        sdrInput = reconciliationAdjuster.getter().adjustSell(
                            MAX_SDR_AMOUNT)
                        ethInput = ethConverter.getter().toEthAmount(sdrInput)
                        b_sgrOutput = Contract.decode(
                            sgrToken.setter({
                                'value': ethInput
                            }).exchange(), 2, eventParams)['output']
                        b_sdrInModel = monetaryModelState.getter().getSdrTotal(
                        )
                        b_sgrInModel = monetaryModelState.getter().getSgrTotal(
                        )
                        b_sgrInToken = sgrToken.getter().totalSupply()
                        b_ethInToken = sgrToken.balance()
                        s_ethOutput = Contract.decode(
                            sgrToken.setter().transfer(sgrToken.address,
                                                       b_sgrOutput), 2,
                            eventParams)['output']
                        s_sdrInModel = monetaryModelState.getter().getSdrTotal(
                        )
                        s_sgrInModel = monetaryModelState.getter().getSgrTotal(
                        )
                        s_sgrInToken = sgrToken.getter().totalSupply()
                        s_ethInToken = sgrToken.balance()
                        logger.periodic(
                            testCount, numOfTests,
                            'factorN      = {}'.format(int(factorN)))
                        logger.periodic(
                            testCount, numOfTests,
                            'factorD      = {}'.format(int(factorD)))
                        logger.periodic(
                            testCount, numOfTests,
                            'priceN       = {}'.format(int(priceN)))
                        logger.periodic(
                            testCount, numOfTests,
                            'priceD       = {}'.format(int(priceD)))
                        logger.periodic(
                            testCount, numOfTests,
                            'sdrInput     = {}'.format(int(sdrInput)))
                        logger.periodic(
                            testCount, numOfTests,
                            'ethInput     = {}'.format(int(ethInput)))
                        logger.periodic(
                            testCount, numOfTests,
                            'b_sgrOutput  = {}'.format(int(b_sgrOutput)))
                        logger.periodic(
                            testCount, numOfTests,
                            'b_sdrInModel = {}'.format(int(b_sdrInModel)))
                        logger.periodic(
                            testCount, numOfTests,
                            'b_sgrInModel = {}'.format(int(b_sgrInModel)))
                        logger.periodic(
                            testCount, numOfTests,
                            'b_sgrInToken = {}'.format(int(b_sgrInToken)))
                        logger.periodic(
                            testCount, numOfTests,
                            'b_ethInToken = {}'.format(int(b_ethInToken)))
                        logger.periodic(
                            testCount, numOfTests,
                            's_ethOutput  = {}'.format(int(s_ethOutput)))
                        logger.periodic(
                            testCount, numOfTests,
                            's_sdrInModel = {}'.format(int(s_sdrInModel)))
                        logger.periodic(
                            testCount, numOfTests,
                            's_sgrInModel = {}'.format(int(s_sgrInModel)))
                        logger.periodic(
                            testCount, numOfTests,
                            's_sgrInToken = {}'.format(int(s_sgrInToken)))
                        logger.periodic(
                            testCount, numOfTests,
                            's_ethInToken = {}'.format(int(s_ethInToken)))

                    except Exception as e:
                        if (tooLowPrice):
                            logger.periodic(
                                testCount, numOfTests,
                                'tooLowPrice priceN {} priceD {} price {}'.
                                format(priceN, priceD, price))
                        else:
                            raise e