From 3649cb4d576e04ebc231f362eaf99ab963d88bea Mon Sep 17 00:00:00 2001 From: Rye Nguyen Date: Fri, 12 Aug 2022 23:12:03 +0700 Subject: [PATCH] feat: add swingby contract (#65) --- src/modules/contracts/index.ts | 13 + .../contracts/swingby-swap-rewards-abi.json | 259 ++++++++++++++++++ 2 files changed, 272 insertions(+) create mode 100644 src/modules/contracts/swingby-swap-rewards-abi.json diff --git a/src/modules/contracts/index.ts b/src/modules/contracts/index.ts index e5bb7d8..96f1abd 100644 --- a/src/modules/contracts/index.ts +++ b/src/modules/contracts/index.ts @@ -4,6 +4,7 @@ import WBTC_ABI from './wbtc-abi.json'; import SBBTC_ABI from './sbbtc-abi.json'; import BTC_ERC_ABI from './btc_erc-abi.json'; import BTC_SKYPOOL_ABI from './btc_skypool-abi.json'; +import SWINGBY_SWAP_REWARDS_ABI from './swingby-swap-rewards-abi.json'; const WBTC = { test: { @@ -73,4 +74,16 @@ export const CONTRACTS = { }, }, }, + swap: { + swingby: { + test: { + address: '', // TODO: need change + abi: SWINGBY_SWAP_REWARDS_ABI as AbiItem[], + }, + production: { + address: '0x2a3040d8b2a4ea8d3c36c04ae2affb9c5a8e856d', + abi: SWINGBY_SWAP_REWARDS_ABI as AbiItem[], + }, + }, + }, } as const; diff --git a/src/modules/contracts/swingby-swap-rewards-abi.json b/src/modules/contracts/swingby-swap-rewards-abi.json new file mode 100644 index 0000000..04f9338 --- /dev/null +++ b/src/modules/contracts/swingby-swap-rewards-abi.json @@ -0,0 +1,259 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_swingby", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pricePerBTC", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rebate", + "type": "uint256" + } + ], + "name": "Paid", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pricePerBTC", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_dest", + "type": "address" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_swapped", + "type": "uint256" + } + ], + "name": "pullRewards", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_dest", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_receiver", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "_swapped", + "type": "uint256[]" + } + ], + "name": "pullRewardsMulti", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rebateRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pricePerBTC", + "type": "uint256" + } + ], + "name": "setSWINGBYPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_swap", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_newRebateRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_thresholdRatio", + "type": "uint256" + } + ], + "name": "setSwap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "swapContract", + "outputs": [ + { + "internalType": "contract ISwapContract", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "thresholdRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +]