FLASH SWAPPER
Deploying FLASH SWAPPER contract manually
If you need to deploy the Flash swapper contract
manually you'll have to pass the other contracts hashes as parameters.
The following is the command necessary to deploy the Flash Swapper contract:
You will need to deploy other contracts before deploying the Flash Swapper Contract, and pass these contracts hashes to the respective parameters above.
These contracts have already been deployed and their hashes are displayed in the table below:
Factory
Testnet
hash-13cc83616c3fb4e6ea22ead5e61eb6319d728783ed02eab51b1f442085e605a7
Casper Association
Wcspr
Testnet
hash-4f2d1b772147b9ce3706919fe0750af6964249b0931e2115045f97e1e135e80b
Casper Association
Dai
Testnet
hash-ffb8fa3073c7623484f76d79bc8baad110b24936b92d5ebc854d401895e88c95
Casper Association
Listed below are the command templates for manually deploying these contracts:
Factory
Wcspr
Dai
Entry point methods
Flash Swapper's entry point methods are listed below:
start_swap
Starts swap.
Special Instructions: The user has to call this (start_swap) method first in order to call the uniswap_v2_call
method. In turn,Start_swap
will call 3 additional methods:
simple_flash_loan This method will be invoked if both tokens (token_borrow and token_pay) are the same.
simple_flash_swap This method will be invoked if both tokens (token_borrow and token_pay) are not the same. One of them must be equal to “Hash-0000000000000000000000000000000000000000000000000000000000000000”
triangular_flash_swap This method will be invoked if both tokens (token_borrow and token_pay) are not the same. The above methods will invoke the swap methods of
Pair
Contract by using thepermissioned_pair_address,
upon which theswap
method will invoke theuniswap_v2_call
method.
Parameters table:
token_borrow
Key
amount
U256
token_pay
Key
user_data
String
This method returns nothing.
uniswap_v2_call
Calls the swap
method of pair contract
.
The sender must be a Flash Swapper Contract
hash if user data contains a value.
Uniswap_v2_call
must be called from a contract, as users cannot directly invoke this method.
Parameters table:
sender
Key
amount0
U256
amount1
U256
data
String
This method returns nothing.
Last updated