How to use the augur-abi.format_address function in augur-abi

To help you get started, we’ve selected a few augur-abi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AugurProject / augur / upload_contracts / upload_to_chain.js View on Github external
rpc.getTransactionReceipt(r.hash, (receipt) => {
        if (!receipt || receipt.error) return console.error("getTransactionReceipt error:", receipt);
        console.log("contract address:", receipt.contractAddress);
        contractAddresses.controller = abi.format_address(receipt.contractAddress);

        // 3. bash ./deterministic_build.sh "0xactualControllerAddress"
        cp.exec("bash deterministic_build.sh " + contractAddresses.controller, (err, stdout, stderr) => {
          if (err) return console.error("deterministic build error:", err);

          // 4. upload deps ['mutex.se', 'cash.se', 'repContract.se'] are the ones so far, then the remaining contracts
          async.eachSeries(contractNames, (contractName, nextContract) => {
            if (contractAddresses[contractName]) return nextContract();
            console.log("uploading contractName:", contractName);
            fs.readFile("../compiled/" + contractName + ".se.evm", (err, contractFile) => {
              rpc.transact({
                from: rpc.getCoinbase(),
                data: "0x" + contractFile.toString().trim(),
                send: true,
                returns: "null"
              }, null, noop, (r) => {
github AugurProject / augur / upload_contracts / upload_to_chain.js View on Github external
rpc.getTransactionReceipt(r.hash, (receipt) => {
                  if (!receipt || receipt.error) return nextContract(receipt || new Error("upload error"));
                  contractAddresses[contractName.charAt(0).toUpperCase() + contractName.slice(1)] = abi.format_address(receipt.contractAddress);

                  // 4a) do controller.setValue('contract', address) and self.controller.addToWhitelist(address) [can be in same block]
                  async.each([{
                    method: "setValue",
                    signature: ["int256", "int256"],
                    send: true,
                    returns: "int256",
                    from: rpc.getCoinbase(),
                    to: contractAddresses.controller,
                    params: [abi.short_string_to_int256(contractName), abi.format_int256(receipt.contractAddress)]
                  }, {
                    method: "addToWhitelist",
                    signature: ["int256"],
                    send: true,
                    returns: "int256",
                    from: rpc.getCoinbase(),
github AugurProject / augur.js / src / modules / trade.js View on Github external
onCommitFailed = max_value.onCommitFailed;
      onNextBlock = max_value.onNextBlock;
      onTradeSent = max_value.onTradeSent;
      onTradeSuccess = max_value.onTradeSuccess;
      onTradeFailed = max_value.onTradeFailed;
      max_value = max_value.max_value;
    }
    onTradeHash = onTradeHash || noop;
    onCommitSent = onCommitSent || noop;
    onCommitSuccess = onCommitSuccess || noop;
    onCommitFailed = onCommitFailed || noop;
    onNextBlock = onNextBlock || noop;
    onTradeSent = onTradeSent || noop;
    onTradeSuccess = onTradeSuccess || noop;
    onTradeFailed = onTradeFailed || noop;
    this.checkGasLimit(trade_ids, abi.format_address(sender || this.from), function (err, trade_ids) {
      var bn_max_value, tradeHash;
      if (self.options.debug.trading) console.log("checkGasLimit:", err, trade_ids);
      if (err) return onTradeFailed(err);
      bn_max_value = abi.bignum(max_value);
      if (bn_max_value.gt(constants.ZERO) && bn_max_value.lt(constants.MINIMUM_TRADE_SIZE)) {
        return onTradeFailed({error: "-4", message: self.errors.trade["-4"]});
      }
      tradeHash = self.makeTradeHash(max_value, max_amount, trade_ids);
      if (self.options.debug.trading) console.log("tradeHash:", tradeHash);
      onTradeHash(tradeHash);
      self.commitTrade({
        hash: tradeHash,
        onSent: onCommitSent,
        onSuccess: function (res) {
          if (self.options.debug.trading) console.log("commitTrade:", res);
          onCommitSuccess(res);
github AugurProject / augur.js / src / filters.js View on Github external
format_common_fields: function (msg) {
      var fmt = clone(msg);
      if (msg.sender) fmt.sender = abi.format_address(msg.sender);
      if (msg.timestamp) fmt.timestamp = parseInt(msg.timestamp, 16);
      if (msg.type) fmt.type = this.format_trade_type(msg.type);
      if (msg.price) fmt.price = abi.unfix_signed(msg.price, "string");
      if (msg.amount) fmt.amount = abi.unfix(msg.amount, "string");
      return fmt;
    },
    format_event_message: function (label, msg) {
github AugurProject / augur.js / src / modules / tradingActions.js View on Github external
getTradingActions: function (type, orderShares, orderLimitPrice, takerFee, makerFee, userAddress, userPositionShares, outcomeId, range, marketOrderBook, scalarMinMax) {
    var remainingOrderShares, i, length, orderSharesFilled, bid, ask, bidAmount, isMarketOrder, fees, adjustedFees, totalTakerFeeEth, adjustedLimitPrice, bnTakerFee, bnMakerFee, bnRange, gasPrice, tradingCost, fullPrecisionPrice, matchingSortedAsks, areSuitableOrders, buyActions, etherToTrade, matchingSortedBids, areSuitableBids, userHasPosition, sellActions, etherToSell, remainingPositionShares, newBid, askShares, newTradeActions, etherToShortSell, tradingActions, augur = this;
    if (type && type.constructor === Object) {
      orderShares = type.orderShares;
      orderLimitPrice = type.orderLimitPrice;
      takerFee = type.takerFee;
      makerFee = type.makerFee;
      userAddress = type.userAddress;
      userPositionShares = type.userPositionShares;
      outcomeId = type.outcomeId;
      marketOrderBook = type.marketOrderBook;
      range = type.range;
      scalarMinMax = type.scalarMinMax;
      type = type.type;
    }
    userAddress = abi.format_address(userAddress);
    orderShares = new BigNumber(orderShares, 10);
    orderLimitPrice = (orderLimitPrice === null || orderLimitPrice === undefined) ?
      null :
      new BigNumber(orderLimitPrice, 10);
    bnTakerFee = new BigNumber(takerFee, 10);
    bnMakerFee = new BigNumber(makerFee, 10);
    bnRange = new BigNumber(range, 10);
    userPositionShares = new BigNumber(userPositionShares, 10);
    isMarketOrder = orderLimitPrice === null || orderLimitPrice === undefined;
    fees = abacus.calculateFxpTradingFees(bnMakerFee, bnTakerFee);
    if (!isMarketOrder) {
      adjustedLimitPrice = (scalarMinMax && scalarMinMax.minValue) ?
        new BigNumber(abacus.shrinkScalarPrice(scalarMinMax.minValue, orderLimitPrice), 10) :
        orderLimitPrice;
      adjustedFees = abacus.calculateFxpMakerTakerFees(
        abacus.calculateFxpAdjustedTradingFee(

augur-abi

Contract ABI serialization

MIT
Latest version published 7 years ago

Package Health Score

46 / 100
Full package analysis

Similar packages