Last active
July 2, 2021 08:10
-
-
Save zeroXBami/4bd01cbc12844f79057ab035c1a9ba1a to your computer and use it in GitHub Desktop.
Vyper raw_call example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@public | |
def _swapOneSplit(OneSplitEHT_ADDR: address | |
fromToken: address, | |
toToken: address, | |
amount: uint256, | |
minReturn: uint256, | |
trade_dist: uint256[4], | |
disableFlags: uint256): | |
funcSig: bytes[4] = method_id("swap(address,address,uint256,uint256,uint256[],uint256)", bytes[4]) | |
data: bytes[352] = concat( convert(fromToken, bytes32), | |
convert(toToken, bytes32), | |
convert(amount, bytes32), | |
convert(minReturn, bytes32), | |
convert(160, bytes32), | |
convert(4, bytes32), | |
convert(trade_dist[0], bytes32), | |
convert(trade_dist[1], bytes32), | |
convert(trade_dist[2], bytes32), | |
convert(trade_dist[3], bytes32), | |
convert(disableFlags, bytes32) | |
) | |
full_data: bytes[356] = concat(funcSig, data) | |
raw_call( | |
OneSplitEHT_ADDR, | |
full_data, | |
outsize=0, | |
gas=msg.gas | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good one