Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stonegao/3836c8af270bbee0eef6fb99dc23df96 to your computer and use it in GitHub Desktop.
Save stonegao/3836c8af270bbee0eef6fb99dc23df96 to your computer and use it in GitHub Desktop.
contract WyvernExchange is Exchange {
function calculateMatchPrice_(
address[14] addrs,
uint[18] uints,
uint8[8] feeMethodsSidesKindsHowToCalls,
bytes calldataBuy,
bytes calldataSell,
bytes replacementPatternBuy,
bytes replacementPatternSell,
bytes staticExtradataBuy,
bytes staticExtradataSell)
public
view
returns (uint)
{
// implementation here
}
}
// graph-ts codegen
calculateMatchPrice_(
addrs: Array<Address>,
uints: Array<BigInt>,
feeMethodsSidesKindsHowToCalls: Array<i32>,
calldataBuy: Bytes,
calldataSell: Bytes,
replacementPatternBuy: Bytes,
replacementPatternSell: Bytes,
staticExtradataBuy: Bytes,
staticExtradataSell: Bytes
): BigInt {
let result = super.call(
"calculateMatchPrice_",
"calculateMatchPrice_(address[14],uint256[18],uint8[8],bytes,bytes,bytes,bytes,bytes,bytes):(uint256)",
[
ethereum.Value.fromAddressArray(addrs), // should use fromFixedSizedArray
ethereum.Value.fromUnsignedBigIntArray(uints), // should use fromFixedSizedArray
ethereum.Value.fromI32Array(feeMethodsSidesKindsHowToCalls), // should use fromFixedSizedArray AND also be UnsignedBigInt
ethereum.Value.fromBytes(calldataBuy),
ethereum.Value.fromBytes(calldataSell),
ethereum.Value.fromBytes(replacementPatternBuy),
ethereum.Value.fromBytes(replacementPatternSell),
ethereum.Value.fromBytes(staticExtradataBuy),
ethereum.Value.fromBytes(staticExtradataSell)
]
);
return result[0].toBigInt();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment