Skip to content

Commit

Permalink
add another token to uniV2 scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroXbrock committed Dec 16, 2024
1 parent 295c47b commit a191db8
Showing 1 changed file with 137 additions and 5 deletions.
142 changes: 137 additions & 5 deletions scenarios/univ2ConfigTest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ name = "testToken"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
bytecode = "0x60806040523480156200001157600080fd5b5060405162000b0938038062000b09833981016040819052620000349162000223565b604051806040016040528060098152602001682a32b9ba2a37b5b2b760b91b815250604051806040016040528060038152602001622a25a760e91b8152508160039081620000839190620002e4565b506004620000928282620002e4565b505050620000a73382620000ae60201b60201c565b50620003d8565b6001600160a01b038216620000de5760405163ec442f0560e01b8152600060048201526024015b60405180910390fd5b620000ec60008383620000f0565b5050565b6001600160a01b0383166200011f578060026000828254620001139190620003b0565b90915550620001939050565b6001600160a01b03831660009081526020819052604090205481811015620001745760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401620000d5565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216620001b157600280548290039055620001d0565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200021691815260200190565b60405180910390a3505050565b6000602082840312156200023657600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200026857607f821691505b6020821081036200028957634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002df576000816000526020600020601f850160051c81016020861015620002ba5750805b601f850160051c820191505b81811015620002db57828155600101620002c6565b5050505b505050565b81516001600160401b038111156200030057620003006200023d565b620003188162000311845462000253565b846200028f565b602080601f831160018114620003505760008415620003375750858301515b600019600386901b1c1916600185901b178555620002db565b600085815260208120601f198616915b82811015620003815788860151825594840194600190910190840162000360565b5085821015620003a05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820180821115620003d257634e487b7160e01b600052601160045260246000fd5b92915050565b61072180620003e86000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce567146100fe57806370a082311461010d57806395d89b4114610136578063a9059cbb1461013e578063dd62ed3e1461015157600080fd5b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100d957806323b872dd146100eb575b600080fd5b6100a061018a565b6040516100ad919061056a565b60405180910390f35b6100c96100c43660046105d5565b61021c565b60405190151581526020016100ad565b6002545b6040519081526020016100ad565b6100c96100f93660046105ff565b610236565b604051601281526020016100ad565b6100dd61011b36600461063b565b6001600160a01b031660009081526020819052604090205490565b6100a061025a565b6100c961014c3660046105d5565b610269565b6100dd61015f36600461065d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461019990610690565b80601f01602080910402602001604051908101604052809291908181526020018280546101c590610690565b80156102125780601f106101e757610100808354040283529160200191610212565b820191906000526020600020905b8154815290600101906020018083116101f557829003601f168201915b5050505050905090565b60003361022a818585610277565b60019150505b92915050565b600033610244858285610289565b61024f85858561030c565b506001949350505050565b60606004805461019990610690565b60003361022a81858561030c565b610284838383600161036b565b505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461030657818110156102f757604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b6103068484848403600061036b565b50505050565b6001600160a01b03831661033657604051634b637e8f60e11b8152600060048201526024016102ee565b6001600160a01b0382166103605760405163ec442f0560e01b8152600060048201526024016102ee565b610284838383610440565b6001600160a01b0384166103955760405163e602df0560e01b8152600060048201526024016102ee565b6001600160a01b0383166103bf57604051634a1406b160e11b8152600060048201526024016102ee565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561030657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161043291815260200190565b60405180910390a350505050565b6001600160a01b03831661046b57806002600082825461046091906106ca565b909155506104dd9050565b6001600160a01b038316600090815260208190526040902054818110156104be5760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016102ee565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166104f957600280548290039055610518565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161055d91815260200190565b60405180910390a3505050565b60006020808352835180602085015260005b818110156105985785810183015185820160400152820161057c565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146105d057600080fd5b919050565b600080604083850312156105e857600080fd5b6105f1836105b9565b946020939093013593505050565b60008060006060848603121561061457600080fd5b61061d846105b9565b925061062b602085016105b9565b9150604084013590509250925092565b60006020828403121561064d57600080fd5b610656826105b9565b9392505050565b6000806040838503121561067057600080fd5b610679836105b9565b9150610687602084016105b9565b90509250929050565b600181811c908216806106a457607f821691505b6020821081036106c457634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561023057634e487b7160e01b600052601160045260246000fdfea2646970667358221220a39541e410f65911c43f31309b31f8820573a9b5537c0bb5e14096efb9bff7ba64736f6c63430008170033{initialSupply}"

[[create]]
name = "testToken2"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
bytecode = "0x60806040523480156200001157600080fd5b5060405162000b0938038062000b09833981016040819052620000349162000223565b604051806040016040528060098152602001682a32b9ba2a37b5b2b760b91b815250604051806040016040528060038152602001622a25a760e91b8152508160039081620000839190620002e4565b506004620000928282620002e4565b505050620000a73382620000ae60201b60201c565b50620003d8565b6001600160a01b038216620000de5760405163ec442f0560e01b8152600060048201526024015b60405180910390fd5b620000ec60008383620000f0565b5050565b6001600160a01b0383166200011f578060026000828254620001139190620003b0565b90915550620001939050565b6001600160a01b03831660009081526020819052604090205481811015620001745760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401620000d5565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216620001b157600280548290039055620001d0565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200021691815260200190565b60405180910390a3505050565b6000602082840312156200023657600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200026857607f821691505b6020821081036200028957634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002df576000816000526020600020601f850160051c81016020861015620002ba5750805b601f850160051c820191505b81811015620002db57828155600101620002c6565b5050505b505050565b81516001600160401b038111156200030057620003006200023d565b620003188162000311845462000253565b846200028f565b602080601f831160018114620003505760008415620003375750858301515b600019600386901b1c1916600185901b178555620002db565b600085815260208120601f198616915b82811015620003815788860151825594840194600190910190840162000360565b5085821015620003a05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820180821115620003d257634e487b7160e01b600052601160045260246000fd5b92915050565b61072180620003e86000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce567146100fe57806370a082311461010d57806395d89b4114610136578063a9059cbb1461013e578063dd62ed3e1461015157600080fd5b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100d957806323b872dd146100eb575b600080fd5b6100a061018a565b6040516100ad919061056a565b60405180910390f35b6100c96100c43660046105d5565b61021c565b60405190151581526020016100ad565b6002545b6040519081526020016100ad565b6100c96100f93660046105ff565b610236565b604051601281526020016100ad565b6100dd61011b36600461063b565b6001600160a01b031660009081526020819052604090205490565b6100a061025a565b6100c961014c3660046105d5565b610269565b6100dd61015f36600461065d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461019990610690565b80601f01602080910402602001604051908101604052809291908181526020018280546101c590610690565b80156102125780601f106101e757610100808354040283529160200191610212565b820191906000526020600020905b8154815290600101906020018083116101f557829003601f168201915b5050505050905090565b60003361022a818585610277565b60019150505b92915050565b600033610244858285610289565b61024f85858561030c565b506001949350505050565b60606004805461019990610690565b60003361022a81858561030c565b610284838383600161036b565b505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461030657818110156102f757604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b6103068484848403600061036b565b50505050565b6001600160a01b03831661033657604051634b637e8f60e11b8152600060048201526024016102ee565b6001600160a01b0382166103605760405163ec442f0560e01b8152600060048201526024016102ee565b610284838383610440565b6001600160a01b0384166103955760405163e602df0560e01b8152600060048201526024016102ee565b6001600160a01b0383166103bf57604051634a1406b160e11b8152600060048201526024016102ee565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561030657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161043291815260200190565b60405180910390a350505050565b6001600160a01b03831661046b57806002600082825461046091906106ca565b909155506104dd9050565b6001600160a01b038316600090815260208190526040902054818110156104be5760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016102ee565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166104f957600280548290039055610518565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161055d91815260200190565b60405180910390a3505050565b60006020808352835180602085015260005b818110156105985785810183015185820160400152820161057c565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146105d057600080fd5b919050565b600080604083850312156105e857600080fd5b6105f1836105b9565b946020939093013593505050565b60008060006060848603121561061457600080fd5b61061d846105b9565b925061062b602085016105b9565b9150604084013590509250925092565b60006020828403121561064d57600080fd5b610656826105b9565b9392505050565b6000806040838503121561067057600080fd5b610679836105b9565b9150610687602084016105b9565b90509250929050565b600181811c908216806106a457607f821691505b6020821081036106c457634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561023057634e487b7160e01b600052601160045260246000fdfea2646970667358221220a39541e410f65911c43f31309b31f8820573a9b5537c0bb5e14096efb9bff7ba64736f6c63430008170033{initialSupply}"


[[create]]
# requires {feeToSetter}
name = "uniV2Factory"
Expand Down Expand Up @@ -48,7 +54,7 @@ value = "10000000000000000000"
## uniV2 pair: weth/token ######################################################

[[setup]]
kind = "univ2_create_pair"
kind = "univ2_create_pair_token1-weth"
to = "{uniV2Factory}"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
signature = "function createPair(address tokenA, address tokenB) external returns (address pair)"
Expand All @@ -57,6 +63,26 @@ args = [
"{testToken}"
]

[[setup]]
kind = "univ2_create_pair_token2-weth"
to = "{uniV2Factory}"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
signature = "function createPair(address tokenA, address tokenB) external returns (address pair)"
args = [
"{weth}",
"{testToken2}"
]

[[setup]]
kind = "univ2_create_pair_token1-token2"
to = "{uniV2Factory}"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
signature = "function createPair(address tokenA, address tokenB) external returns (address pair)"
args = [
"{testToken}",
"{testToken2}"
]

## transfer funds to Unicheat ##################################################

[[setup]]
Expand All @@ -79,6 +105,17 @@ args = [
"500000000000000000000000"
]

[[setup]]
kind = "testToken2_fund_unicheat"
to = "{testToken2}"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
signature = "function transfer(address recipient, uint256 amount) external returns (bool)"
args = [
"{unicheat}",
"500000000000000000000000"
]


## token approvals #############################################################

#admin
Expand All @@ -102,30 +139,73 @@ args = [
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
]

[[setup]]
kind = "admin_approve_router_testToken2"
to = "{testToken2}"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
signature = "approve(address spender, uint256 amount) returns (bool)"
args = [
"{uniRouterV2}",
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
]

## add liquidity ###############################################################

[[setup]]
kind = "admin_univ2_add_liquidity"
kind = "admin_univ2_add_liquidity_weth-testToken"
to = "{uniRouterV2}"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
signature = "addLiquidity(address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline) returns (uint amountA, uint amountB, uint liquidity)"
args = [
"{weth}",
"{testToken}",
"5000000000000000000",
"2500000000000000000",
"50000000000000000000000",
"100000000000000",
"5000000000000000",
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"10000000000000"
]

[[setup]]
kind = "admin_univ2_add_liquidity_weth-testToken2"
to = "{uniRouterV2}"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
signature = "addLiquidity(address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline) returns (uint amountA, uint amountB, uint liquidity)"
args = [
"{weth}",
"{testToken2}",
"2500000000000000000",
"50000000000000000000000",
"100000000000000",
"5000000000000000",
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"10000000000000"
]

[[setup]]
kind = "admin_univ2_add_liquidity_testToken-testToken2"
to = "{uniRouterV2}"
from = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
signature = "addLiquidity(address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline) returns (uint amountA, uint amountB, uint liquidity)"
args = [
"{testToken}",
"{testToken2}",
"50000000000000000000000",
"50000000000000000000000",
"5000000000000000",
"5000000000000000",
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"10000000000000"
]


### SPAM

[[spam]]

[spam.tx]
kind = "uniswap_v2"
kind = "uniswap_v2_swap_weth-testToken"
to = "{unicheat}"
from_pool = "pool1"
signature = "function swap(address tokenIn, address tokenOut, uint256 amountIn) public"
Expand All @@ -138,7 +218,7 @@ args = [
[[spam]]

[spam.tx]
kind = "uniswap_v2"
kind = "uniswap_v2_swap_testToken-weth"
to = "{unicheat}"
from_pool = "pool2"
signature = "function swap(address tokenIn, address tokenOut, uint256 amountIn) public"
Expand All @@ -147,3 +227,55 @@ args = [
"{weth}",
"1000000000000000000"
]

[[spam]]

[spam.tx]
kind = "uniswap_v2_swap_weth-testToken2"
to = "{unicheat}"
from_pool = "pool3"
signature = "function swap(address tokenIn, address tokenOut, uint256 amountIn) public"
args = [
"{weth}",
"{testToken2}",
"10000000000000000"
]

[[spam]]

[spam.tx]
kind = "uniswap_v2_swap_testToken2-weth"
to = "{unicheat}"
from_pool = "pool4"
signature = "function swap(address tokenIn, address tokenOut, uint256 amountIn) public"
args = [
"{testToken2}",
"{weth}",
"1000000000000000000"
]

[[spam]]

[spam.tx]
kind = "uniswap_v2_swap_testToken-testToken2"
to = "{unicheat}"
from_pool = "pool5"
signature = "function swap(address tokenIn, address tokenOut, uint256 amountIn) public"
args = [
"{testToken}",
"{testToken2}",
"1000000000000000000"
]

[[spam]]

[spam.tx]
kind = "uniswap_v2_swap_testToken2-testToken"
to = "{unicheat}"
from_pool = "pool6"
signature = "function swap(address tokenIn, address tokenOut, uint256 amountIn) public"
args = [
"{testToken2}",
"{testToken}",
"1000000000000000000"
]

0 comments on commit a191db8

Please sign in to comment.