aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-04 07:38:06 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-12-19 05:36:05 +0800
commitbab7569ed9b0739a3d01c64dea17adb1bf5b82e1 (patch)
treea790258c6b817f6e96936f7e7ae66e87b5cebfe4 /packages/contracts
parent16bd0ce7ec834029b5a6e8aa308c1d52ce6130ea (diff)
downloaddexon-sol-tools-bab7569ed9b0739a3d01c64dea17adb1bf5b82e1.tar
dexon-sol-tools-bab7569ed9b0739a3d01c64dea17adb1bf5b82e1.tar.gz
dexon-sol-tools-bab7569ed9b0739a3d01c64dea17adb1bf5b82e1.tar.bz2
dexon-sol-tools-bab7569ed9b0739a3d01c64dea17adb1bf5b82e1.tar.lz
dexon-sol-tools-bab7569ed9b0739a3d01c64dea17adb1bf5b82e1.tar.xz
dexon-sol-tools-bab7569ed9b0739a3d01c64dea17adb1bf5b82e1.tar.zst
dexon-sol-tools-bab7569ed9b0739a3d01c64dea17adb1bf5b82e1.zip
Refactoring asm
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol44
1 files changed, 41 insertions, 3 deletions
diff --git a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol b/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
index b79d8db54..4ad9092bd 100644
--- a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
+++ b/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
@@ -72,7 +72,42 @@ contract CompliantForwarder is ExchangeSelectors{
mstore(add(addressesToValidate_, offset), addressToValidate)
}
- function appendMakerAddressFromOrder(paramIndex) {
+ function toGlobalCalldataOffset(offset) -> globalOffset {
+ globalOffset := add(0x4, offset)
+ }
+
+ function toExchangeCalldataOffset(offset, orderParamIndex) -> exchangeOffset {
+ // exchangeTxPtr at global level
+ // 0x20 for length offset into exchange TX
+ // 0x4 for function selector in exhcange TX
+ let exchangeTxPtr := calldataload(0x44)
+ exchangeOffset := add(0x4, add(exchangeTxPtr, add(0x24, offset)))
+ }
+
+ function toOrderOffset(offset, orderParamIndex) -> orderOffset {
+ let exchangeOffset := calldataload(
+ toExchangeCalldataOffset(
+ offset,
+ orderParamIndex
+ )
+ )
+ orderOffset := toExchangeCalldataOffset(exchangeOffset, orderParamIndex)
+ }
+
+ // function readMakerFieldFromOrder()
+
+ /*
+ function readFieldFromOrder()
+
+ function readMakerFieldFromOrder()*/
+
+ function appendMakerAddressFromOrder(orderParamIndex) {
+ let makerAddress := calldataload(toOrderOffset(0 /* makerAddress is at 0'th field */, 0 /*order is 1st param*/))
+ addAddressToValidate(makerAddress)
+ }
+
+/*
+ function appendMakerAddressFromOrderSet(paramIndex) {
let exchangeTxPtr := calldataload(0x44)
// Add 0x20 for length offset and 0x04 for selector offset
let orderPtrRelativeToExchangeTx := calldataload(add(0x4, add(exchangeTxPtr, 0x24))) // 0x60
@@ -80,6 +115,7 @@ contract CompliantForwarder is ExchangeSelectors{
let makerAddress := calldataload(orderPtr)
addAddressToValidate(makerAddress)
}
+*/
// Extract addresses to validate
@@ -88,11 +124,13 @@ contract CompliantForwarder is ExchangeSelectors{
switch selector
case 0x097bb70b00000000000000000000000000000000000000000000000000000000 /* batchFillOrders */
{
-
+ //appendMakerAddressFromOrderSet()
}
case 0x3c28d86100000000000000000000000000000000000000000000000000000000 /* matchOrders */
{
-
+ // appendMakerAddressFromOrder(0)
+ //// appendMakerAddressFromOrder(1)
+ // addAddressToValidate(signerAddress)
}
case 0xb4be83d500000000000000000000000000000000000000000000000000000000 /* fillOrder */
{