1

I'm building a contract function that purchases and distributes complete sets of AugurShares for a specific market. (Testing on Rinkeby).

Version of Augur-core (node_modules/augur) used: https://github.com/AugurProject/augur-core

pragma solidity >=0.4.20;

import "./../node_modules/augur/source/contracts/trading/CompleteSets.sol";
import "./../node_modules/augur/source/contracts/reporting/IMarket.sol";

contract BuyCompleteAugurSets {
  CompleteSets completeSetsInstance

  function BuyCompleteAugurSets(address _completeSetsAddress) 
  public
  {
    completeSetsInstance = CompleteSets(_completeSetsAddress);
  }

  function buyAugurShares (
    IMarket _market
  )
  public 
  payable
  {
    uint256 amount = 10 ** 14;
    completeSetsInstance.publicBuyCompleteSets.value(1 ether)(_market, amount);
  }
}

I call this function through Truffle:

    var res = await contract.buyAugurShares(MARKET_ADDRESS, {value: toWei("1", "ether")});

I double checked and the market is valid. I am able to purchase the complete sets for the given market through Augur.js but I should be able to also purchase these complete sets through a contract function aimed at the CompeleteSets.sol contract. Any clue what might be going wrong?

Failing transactions: https://rinkeby.etherscan.io/address/0x824a064503ba92d54c6e498c0bab6413854fbd6f

4
  • 1. Your question should include the implementation of fillAugurOrders. 2. What do you mean do the same through the contracts? (since your solidity code doesn't seem to share anything in common with your JS code). Commented Mar 14, 2019 at 12:56
  • That was a typo, I simplified the code a bit for the question.
    – jasper
    Commented Mar 14, 2019 at 12:58
  • And 3. Your link shows invalid address. Commented Mar 14, 2019 at 13:09
  • And 4. Your edit does not make the expression do the same through the contracts any clearer. What are you trying to do that works for you in one place but not in the other place? Please show a piece of code for each case. Commented Mar 14, 2019 at 13:11

1 Answer 1

1

Got it to work thanks to @aaaaaaaaaaaaa from the Augur discord

code:

contract BuyCompleteSets {
  CompleteSets constant private completeSets = CompleteSets(0x48FCc9d538B9C86bA9D35b3eB0e7f64EE2B4664f);
  address constant private cash = 0x2Da4d465978981BD75BbaC4C9f3bdA10bE0B465c;
  address constant private augur = 0x990B2D2aF7e87cd015A607c3A95d7622c9bBeDe1;


  function BuyCompleteSets(
  ) 
  public 
  {
      ICash(cash).approve(augur, uint256(-1));
  }

  function BuyShares (
      IMarket _market
  )
  public 
  payable
  {
      uint256 amount = msg.value / _market.getNumTicks();
      completeSets.publicBuyCompleteSets.value(msg.value)(_market, amount);
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.