Merge pull request #375 from status-im/fix/solc-warnings

Fix solc warnings and update embark-solium
This commit is contained in:
Jonathan Rainville 2019-07-16 12:24:15 -04:00 committed by GitHub
commit 69368dd040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 102 additions and 67 deletions

1
.soliumignore Normal file
View File

@ -0,0 +1 @@
node_modules

20
.soliumrc.json Normal file
View File

@ -0,0 +1,20 @@
{
"extends": "solium:all",
"plugins": [
"security"
],
"rules": {
"quotes": [
"error",
"double"
],
"indentation": [
"error",
4
],
"arg-overflow": [
"warning",
3
]
}
}

View File

@ -15,9 +15,12 @@ contract KyberNetworkProxy {
* @param srcQty Quantity of the source token
*/
function getExpectedRate(address src, address dest, uint srcQty)
public view
public pure
returns(uint expectedRate, uint slippageRate)
{
if (src == address(0) || dest == address(0) || srcQty == 0) {
// Useless condition to get rid of the unused warning
}
return (32749000000000000000, 31766530000000000000);
}
@ -44,6 +47,9 @@ contract KyberNetworkProxy {
payable
returns(uint)
{
if (src == address(0) || dest == address(0) || destAddress == address(0) || walletId == address(0) || srcAmount == 0 || maxDestAmount == 0 || minConversionRate == 0) {
// Useless condition to get rid of the unused warning
}
return maxDestAmount;
}
@ -59,9 +65,12 @@ contract KyberNetworkProxy {
address dest,
uint minConversionRate
)
public
public pure
returns(uint)
{
if (src == address(0) || dest == address(0) || srcAmount == 0 || minConversionRate == 0) {
// Useless condition to get rid of the unused warning
}
return 100;
}
@ -70,6 +79,9 @@ contract KyberNetworkProxy {
/// @param minConversionRate The minimal conversion rate. If actual rate is lower, trade is canceled.
/// @return amount of actual dest tokens
function swapEtherToToken(address token, uint minConversionRate) public payable returns(uint) {
if (token == address(0) || minConversionRate == 0) {
// Useless condition to get rid of the unused warning
}
return 200;
}
}

View File

@ -113,7 +113,7 @@ contract ArbitrationLicense is License {
* @param _account Seller account
* @return Request Id
*/
function getId(address _arbitrator, address _account) external view returns(bytes32){
function getId(address _arbitrator, address _account) external pure returns(bytes32){
return keccak256(abi.encodePacked(_arbitrator,_account));
}

View File

@ -170,7 +170,7 @@ contract Escrow is IEscrow, Pausable, MessageSigned, Fees, Arbitrable {
* @dev Requires contract to be unpaused.
* The seller needs to be licensed.
*/
function create (
function createEscrow(
uint _offerId,
uint _tokenAmount,
uint _assetPrice,

View File

@ -20,7 +20,7 @@ contract EscrowRelay is RelayRecipient, Ownable {
mapping(address => uint) public lastActivity;
bytes4 constant CREATE_SIGNATURE = bytes4(keccak256("create(uint256,uint256,uint8,uint256,bytes,string,string,uint,bytes)"));
bytes4 constant CREATE_SIGNATURE = bytes4(keccak256("createEscrow(uint256,uint256,uint8,uint256,bytes,string,string,uint,bytes)"));
bytes4 constant PAY_SIGNATURE = bytes4(keccak256("pay(uint256)"));
bytes4 constant CANCEL_SIGNATURE = bytes4(keccak256("cancel(uint256)"));
bytes4 constant OPEN_CASE_SIGNATURE = bytes4(keccak256("openCase(uint256,string)"));
@ -89,7 +89,7 @@ contract EscrowRelay is RelayRecipient, Ownable {
* @param _nonce buyer's nonce
* @param _signature buyer's signature
*/
function create (
function createEscrow(
uint _offerId,
uint _tokenAmount,
uint _assetPrice,
@ -100,7 +100,7 @@ contract EscrowRelay is RelayRecipient, Ownable {
bytes memory _signature
) public returns (uint escrowId) {
lastActivity[get_sender()] = block.timestamp;
escrowId = escrow.create(
escrowId = escrow.createEscrow(
_offerId,
_tokenAmount,
_assetPrice,
@ -151,6 +151,8 @@ contract EscrowRelay is RelayRecipient, Ownable {
* @param encoded_function Function that will be called on the Escrow contract
* @param gas_price Gas price
* @param transaction_fee Fee for the relay (unused by us)
* @dev relay and transaction_fee give warning because they are unused, but they are useless in our relay workflow
* @dev We cannot remove those parameters because they are called by an external contract
*/
function accept_relayed_call(
address relay,

View File

@ -17,7 +17,7 @@ contract IEscrow {
address payable arbitrator;
}
function create(
function createEscrow(
uint _offerId,
uint _tokenAmount,
uint _assetPrice,
@ -42,4 +42,4 @@ contract IEscrow {
function getBasicTradeData(uint _escrowId) external view returns(address payable buyer, address payable seller, address token, uint tokenAmount);
}
}

View File

@ -90,7 +90,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
// Constructor
////////////////
/**
/**
* @notice Constructor to create a MiniMeToken
* @param _tokenFactory The address of the MiniMeTokenFactory contract that
* will create the Clone token contracts, the token factory needs to be
@ -113,7 +113,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
uint8 _decimalUnits,
string memory _tokenSymbol,
bool _transfersEnabled
)
)
public
{
tokenFactory = TokenFactory(_tokenFactory);
@ -154,8 +154,8 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
address _from,
address _to,
uint256 _amount
)
public
)
public
returns (bool success)
{
@ -167,7 +167,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
require(transfersEnabled);
// The standard ERC 20 transferFrom functionality
if (allowed[_from][msg.sender] < _amount) {
if (allowed[_from][msg.sender] < _amount) {
return false;
}
allowed[_from][msg.sender] -= _amount;
@ -187,7 +187,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
address _from,
address _to,
uint _amount
)
)
internal
returns(bool)
{
@ -234,7 +234,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
address _spender,
uint256 _amount
)
internal
internal
returns (bool)
{
require(transfersEnabled);
@ -272,7 +272,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
* @return True if the approval was successful
*/
function approve(address _spender, uint256 _amount) external returns (bool success) {
doApprove(msg.sender, _spender, _amount);
return doApprove(msg.sender, _spender, _amount);
}
/**
@ -285,7 +285,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
function allowance(
address _owner,
address _spender
)
)
external
view
returns (uint256 remaining)
@ -305,7 +305,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
address _spender,
uint256 _amount,
bytes memory _extraData
)
)
public
returns (bool success)
{
@ -343,10 +343,10 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
function balanceOfAt(
address _owner,
uint _blockNumber
)
)
public
view
returns (uint)
returns (uint)
{
// These next few lines are used when the balance of the token is
@ -417,7 +417,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
string memory _cloneTokenSymbol,
uint _snapshotBlock,
bool _transfersEnabled
)
)
public
returns(address)
{
@ -444,7 +444,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
////////////////
// Generate and destroy tokens
////////////////
/**
* @notice Generates `_amount` tokens that are assigned to `_owner`
* @param _owner The address that will be assigned the new tokens
@ -478,7 +478,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
function destroyTokens(
address _owner,
uint _amount
)
)
public
onlyController
returns (bool)
@ -518,7 +518,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
function getValueAt(
Checkpoint[] storage checkpoints,
uint _block
)
)
internal
view
returns (uint)
@ -576,7 +576,7 @@ contract MiniMeToken is MiniMeTokenInterface, Controlled {
uint size;
if (_addr == address(0)){
return false;
}
}
assembly {
size := extcodesize(_addr)
}

View File

@ -54,7 +54,7 @@
"dompurify": "^1.0.10",
"embark": "^4.0.2",
"embark-solc": "^4.0.3",
"embark-solium": "0.0.1",
"embark-solium": "0.1.0",
"embarkjs-connector-web3": "^4.0.0",
"eth-ens-namehash": "^2.0.8",
"ethereumjs-util": "^6.0.0",

View File

@ -35,7 +35,7 @@ Escrow.options.address = EscrowProxy.options.address;
const { toBN } = web3.utils;
export function *createEscrow({user, escrow}) {
const toSend = Escrow.methods.create(
const toSend = Escrow.methods.createEscrow(
escrow.offerId,
escrow.tokenAmount,
escrow.assetPrice,

View File

@ -108,7 +108,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -142,7 +142,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund

View File

@ -56,7 +56,7 @@ config({
EscrowRelay: {
args: ["$MetadataStore", "$OwnedUpgradeabilityProxy", "$SNT"],
},
},
OwnedUpgradeabilityProxy: {
},
Escrow: {
@ -110,7 +110,7 @@ contract("Escrow Relay", function() {
const signature = await web3.eth.sign(hash, accounts[1]);
const nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await EscrowRelay.methods.create(ethOfferId, 123, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await EscrowRelay.methods.createEscrow(ethOfferId, 123, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
escrowId = receipt.events.Created.returnValues.escrowId;
});

View File

@ -136,7 +136,7 @@ contract("Escrow", function() {
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, 123, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, 123, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
const created = receipt.events.Created;
assert(!!created, "Created() not triggered");
assert.equal(created.returnValues.offerId, ethOfferId, "Invalid offerId");
@ -148,7 +148,7 @@ contract("Escrow", function() {
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, 123, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[0]});
receipt = await Escrow.methods.createEscrow(ethOfferId, 123, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[0]});
const created = receipt.events.Created;
assert(!!created, "Created() not triggered");
@ -172,7 +172,7 @@ contract("Escrow", function() {
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[0]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[0]});
escrowId = receipt.events.Created.returnValues.escrowId;
receipt = await Escrow.methods.fund(escrowId).send({from: accounts[0], value: tradeAmount + feeAmount});
@ -203,7 +203,7 @@ contract("Escrow", function() {
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(tokenOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[0]});
receipt = await Escrow.methods.createEscrow(tokenOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[0]});
const created = receipt.events.Created;
assert(!!created, "Created() not triggered");
escrowTokenId = receipt.events.Created.returnValues.escrowId;
@ -234,7 +234,7 @@ contract("Escrow", function() {
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
let receipt = await Escrow.methods.create(sntOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[0]});
let receipt = await Escrow.methods.createEscrow(sntOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[0]});
const created = receipt.events.Created;
escrowTokenId = receipt.events.Created.returnValues.escrowId;
@ -273,7 +273,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -301,7 +301,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(tokenOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(tokenOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowTokenId = created.returnValues.escrowId;
// Fund
@ -326,7 +326,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -342,7 +342,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -358,7 +358,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -380,7 +380,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -399,7 +399,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -425,7 +425,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -470,7 +470,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(tokenOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(tokenOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowTokenId = created.returnValues.escrowId;
// Fund
@ -498,7 +498,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", TestUtils.zeroAddress).call({from: accounts[2]});
signature = await web3.eth.sign(hash, accounts[2]);
nonce = await MetadataStore.methods.user_nonce(accounts[2]).call();
receipt = await Escrow.methods.create(noArbiterOfferId, tradeAmount, 140, TestUtils.zeroAddress, "L", "U", nonce, signature).send({from: accounts[2]});
receipt = await Escrow.methods.createEscrow(noArbiterOfferId, tradeAmount, 140, TestUtils.zeroAddress, "L", "U", nonce, signature).send({from: accounts[2]});
created = receipt.events.Created;
escrowTokenId = created.returnValues.escrowId;
// Fund
@ -561,7 +561,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -589,7 +589,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
escrowId = receipt.events.Created.returnValues.escrowId;
// Fund
@ -625,7 +625,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -695,7 +695,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -730,7 +730,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: buyer});
signature = await web3.eth.sign(hash, buyer);
nonce = await MetadataStore.methods.user_nonce(buyer).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: buyer});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: buyer});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -759,7 +759,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -779,7 +779,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
const releasedEscrowId = created.returnValues.escrowId;
@ -792,7 +792,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowId = created.returnValues.escrowId;
// Fund
@ -810,7 +810,7 @@ contract("Escrow", function() {
hash = await MetadataStore.methods.getDataHash("U", "0x00").call({from: accounts[1]});
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(tokenOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(tokenOfferId, tradeAmount, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
created = receipt.events.Created;
escrowTokenId = created.returnValues.escrowId;
// Fund

View File

@ -57,7 +57,7 @@ config({
EscrowRelay: {
args: ["$MetadataStore", "$OwnedUpgradeabilityProxy", "$SNT"],
},
},
OwnedUpgradeabilityProxy: {
},
Escrow: {
@ -89,7 +89,7 @@ contract("Escrow Funding", function() {
receipt = await MetadataStore.methods.addOffer(TestUtils.zeroAddress, "0x00", "London", "USD", "Iuri", [0], 1, arbitrator).send({from: accounts[0]});
ethOfferId = receipt.events.OfferAdded.returnValues.offerId;
});
it("Can create initial escrow version", async () => {
const abiEncode = Escrow.methods.init(
@ -111,7 +111,7 @@ contract("Escrow Funding", function() {
const signature = await web3.eth.sign(hash, accounts[1]);
const nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(ethOfferId, 123, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
receipt = await Escrow.methods.createEscrow(ethOfferId, 123, 140, "0x00", "L", "U", nonce, signature).send({from: accounts[1]});
const created = receipt.events.Created;
assert(!!created, "Created() not triggered");
assert.equal(created.returnValues.offerId, ethOfferId, "Invalid offerId");
@ -119,7 +119,7 @@ contract("Escrow Funding", function() {
});
it("Can upgrade contract", async () => {
// This is an upgrade without calling an initialization function.
// This is an upgrade without calling an initialization function.
// Some upgrades might require doing that, so you need to call upgradeToAndCall
// and set some initialization var
receipt = await OwnedUpgradeabilityProxy.methods.upgradeTo(TestEscrowUpgrade.options.address).send();

View File

@ -114,7 +114,7 @@ contract("Escrow Funding", function() {
const nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
const signature = await web3.eth.sign(hash, accounts[1]);
receipt = await Escrow.methods.create(ethOfferId, fundAmount, 140, "0x00", "U", "Iuri", nonce, signature)
receipt = await Escrow.methods.createEscrow(ethOfferId, fundAmount, 140, "0x00", "U", "Iuri", nonce, signature)
.send({from: accounts[0]});
escrowId = receipt.events.Created.returnValues.escrowId;
@ -142,7 +142,7 @@ contract("Escrow Funding", function() {
let signature = await web3.eth.sign(hash, accounts[1]);
let nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(SNTOfferId, fundAmount, 140, "0x00", "U", "Iuri", nonce, signature)
receipt = await Escrow.methods.createEscrow(SNTOfferId, fundAmount, 140, "0x00", "U", "Iuri", nonce, signature)
.send({from: accounts[0]});
escrowIdSNT = receipt.events.Created.returnValues.escrowId;
@ -150,7 +150,7 @@ contract("Escrow Funding", function() {
signature = await web3.eth.sign(hash, accounts[1]);
nonce = await MetadataStore.methods.user_nonce(accounts[1]).call();
receipt = await Escrow.methods.create(tokenOfferId, fundAmount, 140, "0x00", "U", "Iuri", nonce, signature)
receipt = await Escrow.methods.createEscrow(tokenOfferId, fundAmount, 140, "0x00", "U", "Iuri", nonce, signature)
.send({from: accounts[0]});
escrowIdToken = receipt.events.Created.returnValues.escrowId;
});

View File

@ -6754,10 +6754,10 @@ embark-solc@^4.0.3:
semver "^5.6.0"
shelljs "^0.8.1"
embark-solium@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/embark-solium/-/embark-solium-0.0.1.tgz#0a6ee5bccd74d8fb0c153c5b22adb06bdf113411"
integrity sha512-wAJJiSjfND/ICNBPTnAF12t9lYiFD1TT6ZXxRNFT+NzCwLDdYRYH3Ymq5G0P42gknne8X47hcwTT0T6Gggyxog==
embark-solium@0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/embark-solium/-/embark-solium-0.1.0.tgz#abdf3cfcbaa62ab39bd816fa4ac8ef7231378f75"
integrity sha512-4vX4kg/iO5Tn5v0vD5lZi2u4o/o+Uyi6o8j/FMc9TMbQf0HhgO43q1UU2sLr59GUZbSn00KaLX1r7B2+kHYthw==
dependencies:
solium "1.1.0"
text-table "^0.2.0"