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:
Name | Network | Account info contract hash | Contract owner |
---|---|---|---|
Factory | Testnet |
| Casper Association |
Wcspr | Testnet |
| Casper Association |
Dai | Testnet |
| 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:
Parameter Name | Type |
---|---|
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:
Parameter Name | Type |
---|---|
sender | Key |
amount0 | U256 |
amount1 | U256 |
data | String |
This method returns nothing.
Last updated