aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-05 22:40:51 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-02 04:21:09 +0800
commit7be84c6ad324627374adf447e6287deed29a42ed (patch)
treef89cd555918eec00e18db2792cbff6a2ba1aa95c /packages/contracts
parent425039e4d3e45b27e1bac7338fa70e59eb438df2 (diff)
downloaddexon-sol-tools-7be84c6ad324627374adf447e6287deed29a42ed.tar
dexon-sol-tools-7be84c6ad324627374adf447e6287deed29a42ed.tar.gz
dexon-sol-tools-7be84c6ad324627374adf447e6287deed29a42ed.tar.bz2
dexon-sol-tools-7be84c6ad324627374adf447e6287deed29a42ed.tar.lz
dexon-sol-tools-7be84c6ad324627374adf447e6287deed29a42ed.tar.xz
dexon-sol-tools-7be84c6ad324627374adf447e6287deed29a42ed.tar.zst
dexon-sol-tools-7be84c6ad324627374adf447e6287deed29a42ed.zip
Add comments to Arbitrage contract
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/src/current/tutorials/Arbitrage/Arbitrage.sol49
1 files changed, 28 insertions, 21 deletions
diff --git a/packages/contracts/src/current/tutorials/Arbitrage/Arbitrage.sol b/packages/contracts/src/current/tutorials/Arbitrage/Arbitrage.sol
index 8a744fd8e..4c55ddc8e 100644
--- a/packages/contracts/src/current/tutorials/Arbitrage/Arbitrage.sol
+++ b/packages/contracts/src/current/tutorials/Arbitrage/Arbitrage.sol
@@ -58,21 +58,27 @@ contract Arbitrage is Ownable {
uint8[2] v, bytes32[2] r, bytes32[2] s
) internal {
uint amount = values[11];
- etherDelta.depositToken(addresses[2], values[7]);
+ etherDelta.depositToken(
+ addresses[2], // tokenGet === makerToken
+ values[7] // amountGet
+ );
etherDelta.trade(
- addresses[2],
- values[7],
- addresses[3],
- values[8],
- values[9],
- values[10],
- addresses[5],
+ addresses[2], // tokenGet === makerToken
+ values[7], // amountGet
+ addresses[3], // tokenGive === takerToken
+ values[8], // amountGive
+ values[9], // expires
+ values[10], // nonce
+ addresses[5], // user
v[1],
r[1],
s[1],
amount
);
- etherDelta.withdrawToken(addresses[3], values[8]);
+ etherDelta.withdrawToken(
+ addresses[3], // tokenGive === tokenToken
+ values[8] // amountGive
+ );
}
function makeExchangeTrade(
@@ -80,21 +86,22 @@ contract Arbitrage is Ownable {
uint8[2] v, bytes32[2] r, bytes32[2] s
) internal {
address[5] memory orderAddresses = [
- addresses[0],
- addresses[1],
- addresses[2],
- addresses[3],
- addresses[4]
+ addresses[0], // maker
+ addresses[1], // taker
+ addresses[2], // makerToken
+ addresses[3], // takerToken
+ addresses[4] // feeRecepient
];
uint[6] memory orderValues = [
- values[0],
- values[1],
- values[2],
- values[3],
- values[4],
- values[5]
+ values[0], // makerTokenAmount
+ values[1], // takerTokenAmount
+ values[2], // makerFee
+ values[3], // takerFee
+ values[4], // expirationTimestampInSec
+ values[5] // salt
];
- uint fillTakerTokenAmount = values[6];
+ uint fillTakerTokenAmount = values[6]; // fillTakerTokenAmount
+ // Execute Exchange trade. It either succeeds in full or fails and reverts all the changes.
exchange.fillOrKillOrder(orderAddresses, orderValues, fillTakerTokenAmount, v[0], r[0], s[0]);
}
}