Forked from Totoro Finance Swap contracts. Modified to deploy in WAX.
core/contracts/swap/include/swap.hpp
: Replace LP_TOKEN_CONTRACT with the account where thelptoken
contract will be deployed.core/contracts/swap/include/swap.hpp
: In get_manager() function replace the manager with the account that will manage the contract.core/contracts/lptoken/include/utils.hpp
: Replace SWAP_CONTRACT with the account where theswap
contract will be deployed.
- cd to 'build' directory
- run the command 'cmake ..'
- run the command 'make'
- The built smart contract is under the 'build' directory
- You can then do a 'set contract' action with 'cleos' and point in to the './build/xxx' directory
cleos set contract swap.nefty ./artifacts swap.wasm swap.abi -p swap.nefty@active
cleos set contract lp.nefty ./artifacts lptoken.wasm lptoken.abi -p lp.nefty@active
cleos push action swap.nefty setname '["manager", "admin.nefty"]' -p admin.nefty
cleos push action swap.nefty setname '["fee.account", "sfees.nefty"]' -p admin.nefty
cleos push action swap.nefty setconfig '["fee.protocol", 10]' -p admin.nefty
cleos push action swap.nefty setconfig '["fee.trade", 20]' -p admin.nefty
cleos push action swap.nefty setconfig '["status", 1]' -p admin.nefty
cleos push action swap.nefty createpair '{"creator":"init.nefty","token0":{"contract":"eosio.token","sym":"8,WAX"},"token1":{"contract":"usdt.alcor","sym":"4,USDT"}}' -p init.nefty
cleos push action swap.nefty removepair '{"code":USDWAX}' -p admin.nefty
Disabling a pair would prevent deposits, adding liquidity and trading. Removing liquidity can still be done.
cleos push action swap.nefty setactive '{"code":USDWAX, "active": false}' -p admin.nefty
cleos push action swap.nefty setactive '{"code":USDWAX, "active": true}' -p admin.nefty
cleos push action eosio.token transfer '["init.nefty","swap.nefty","1000.00000000 WAX","deposit_to_pair:8,[email protected],[email protected]"]' -p init.nefty
cleos push action usdt.alcor transfer '["init.nefty","swap.nefty","2000.0000 USDT","deposit_to_pair:8,[email protected],[email protected]"]' -p init.nefty
cleos push action swap.nefty addliquidity '{"creator":"owner","token0":{"contract":"eosio.token","sym":"8,WAX"},"token1":{"contract":"usdt.alcor","sym":"4,USDT"}}' -p init.nefty
cleos push action swap.nefty cancel '["init.nefty",1]' -p init.nefty
cleos push action lptoken.ttr transfer '["init.nefty","swap.nefty","14832396 USDWAX",""]' -p init.nefty
cleos push action eosio.token transfer '["init.nefty","swap.nefty","1.00000000 WAX","swap:USDWAX"]' -p init.nefty
cleos push action usdt.alcor transfer '["init.nefty","swap.nefty","1.0000 USDT","swap:USDWAX"]' -p init.nefty
cleos push action usdt.alcor transfer '["init.nefty","swap.nefty","10.0000 USDT","swap:NEFWAX-USDWAX"]' -p init.nefty