How to use augur-abi - 10 common examples

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 / test / reporting / makeReports.js View on Github external
it(JSON.stringify(t), function () {
            var localHash = makeReports.makeHash(t.salt, t.report, t.event, t.from, t.isScalar, t.isIndeterminate);
            if (t.expected) {
                assert.strictEqual(localHash, t.expected);
            } else {
                assert.strictEqual(localHash, augur.MakeReports.makeHash(abi.hex(t.salt), abi.hex(t.report), t.event, t.from));
            }
        });
    };
github AugurProject / augur.js / test / integration / reporting / makeReports.js View on Github external
it(JSON.stringify(t), function () {
      var localHash = makeReports.makeHash(t.salt, t.report, t.event, t.from, t.isScalar, t.isIndeterminate);
      assert.strictEqual(localHash, augur.MakeReports.makeHash(abi.hex(t.salt), abi.hex(t.report), t.event, t.from));
    });
  };
github AugurProject / augur.js / test / client / orders.js View on Github external
it(JSON.stringify(t), function () {
            var shares = augur.orders.limit.sharesToTrade(t.q, t.outcome, t.alpha, t.cap, t.isBuy);
            assert.notProperty(shares, "error");
            var zero = augur.orders.limit.f(shares, augur.utils.toDecimal(t.q), t.outcome, augur.utils.toDecimal(t.alpha), augur.utils.toDecimal(t.cap));
            assert.closeTo(zero.toNumber(), 0, 1e-12);
            assert.strictEqual(abi.number(shares).toFixed(5), t.expected);
        });
    };
github AugurProject / augur.js / test / unit / trading / buyAndSellShares.js View on Github external
sell: function (p) {
			assert.deepEqual(JSON.stringify(p), JSON.stringify({
				amount: abi.fix(120, 'hex'),
				price: abi.fix(.35, 'hex'),
				market: '0xa1',
				outcome: '1',
				scalarMinMax: null,
				onSent: noop,
				onSuccess: noop,
				onFailed: noop,
				minimumTradeSize: abi.fix(MINIMUM_TRADE_SIZE, 'hex'),
				isShortAsk: 0,
				tradeGroupID: 0
			}));
			finished();
    }
  });
github AugurProject / augur.js / test / unit / create / createMarket.js View on Github external
assertions: function (tx) {
      assert.deepEqual(JSON.stringify(tx), JSON.stringify({
        branch: '1010101',
        description: 'This is a test event description',
        expDate: parseInt(1500000000, 10),
        minValue: abi.fix('1', "hex"),
        maxValue: abi.fix('50', "hex"),
        numOutcomes: '2',
        resolution: 'https://iknoweverything.com'
      }));
    }
  });
github AugurProject / augur.js / test / unit / trading / buyAndSellShares.js View on Github external
buy: function (p) {
			assert.deepEqual(JSON.stringify(p), JSON.stringify({
				amount: abi.fix(320, 'hex'),
				price: abi.fix(0.85, 'hex'),
				market: '0xa1',
				outcome: '1',
				scalarMinMax: null,
				onSent: noop,
				onSuccess: noop,
				onFailed: noop,
				tradeGroupID: '0x01',
				minimumTradeSize: abi.fix(MINIMUM_TRADE_SIZE, 'hex'),
			}));
			finished();
    },
  });
github AugurProject / augur.js / test / unit / trading / buyAndSellShares.js View on Github external
shortAsk: function (p) {
			assert.deepEqual(JSON.stringify(p), JSON.stringify({
				amount: abi.fix(5, 'hex'),
				price: abi.fix(0.95, 'hex'),
				market: '0xa1',
				outcome: '1',
				scalarMinMax: null,
				tradeGroupID: '0x01',
				onSent: noop,
				onSuccess: noop,
				onFailed: noop,
				minimumTradeSize: abi.fix(MINIMUM_TRADE_SIZE, 'hex'),
			}));
			finished();
    }
  });
github AugurProject / augur.js / test / unit / create / createMarket.js View on Github external
assertions: function (tx) {
      assert.deepEqual(JSON.stringify(tx), JSON.stringify({
        branch: '1010101',
        description: 'This is a test event description',
        expDate: parseInt(1500000000, 10),
        minValue: abi.fix('10', "hex"),
        maxValue: abi.fix('250', "hex"),
        numOutcomes: '2',
        resolution: ''
      }));
    }
  });

augur-abi

Contract ABI serialization

MIT
Latest version published 7 years ago

Package Health Score

46 / 100
Full package analysis

Similar packages