3

Using testrpc v3.0.3 and solidity Getting the above error while deploying this contract in testrpc private net

pragma solidity ^0.4.4;
import "./ConvertLib.sol";
import "./Agreement.sol";

contract SmartAgreement {

    address owner;
    mapping (address => uint) balances;

    event Transfer(address indexed _from, address indexed _to, uint256 _value);  
    mapping(address => address) agreementsWith;
    mapping(address => uint) priceUpto1Ks;
    mapping(address => uint) priceUpto10Ks;
    mapping(address => uint) priceUpto100Ks;

    function SmartAgreement(){
        balances[tx.origin] = 10000000;
        owner = msg.sender;
    }

   function addAgrement(address from,address to,uint priceUpto1K ,uint priceUpto10K ,uint priceUpto100K) {
        agreementsWith[from] = to;
        priceUpto1Ks[from] = priceUpto1K;
        priceUpto10Ks[from] = priceUpto10K;
        priceUpto100Ks[from] = priceUpto100K;
    }

     function getAgreement(address from) constant returns(address,uint,uint,uint){

       return (agreementsWith[from],
               priceUpto1Ks[from],
               priceUpto10Ks[from],
               priceUpto100Ks[from]);       

    }

   function sendCoin(address receiver, uint amount) returns(bool sufficient) {
        if (balances[msg.sender] < amount) return false;
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        Transfer(msg.sender, receiver, amount);
        return true;
    }

    function getBalanceInEth(address addr) returns(uint){
        return ConvertLib.convert(getBalance(addr),2);
    }

    function getBalance(address addr) returns(uint) {
        return balances[addr];
    }

    /* Function to recover the funds on the contract */
    function kill() { if (msg.sender == owner) selfdestruct(owner); }
}
  • Which OS your using? also did you using Meteor? – DappDev Feb 28 '17 at 12:04
2

I'm still getting used to truffle 0.3.x but this looks familiar from 0.2.x.

Convertlib.sol is part of the MetaCoin example (from truffle init).

Have a look in ./migrations. Probably 2_deploy_contract.js. This is a list of chores to perform when deploying your contracts. Contents don't match up to what's needed. Probably ConvertLib.sol is listed (delete that line), along with an errant reference to Agreement.sol.

May be necessary to name your source file the same as the contract it contains, e.g. SmartAgreement.sol.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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