diff --git a/src/adaptors/orbitalswap/abis/lp.json b/src/adaptors/orbitalswap/abis/lp.json new file mode 100644 index 0000000000..09dc5dc08a --- /dev/null +++ b/src/adaptors/orbitalswap/abis/lp.json @@ -0,0 +1,713 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0Out", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1Out", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint112", + "name": "reserve0", + "type": "uint112" + }, + { + "indexed": false, + "internalType": "uint112", + "name": "reserve1", + "type": "uint112" + } + ], + "name": "Sync", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MINIMUM_LIQUIDITY", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getReserves", + "outputs": [ + { + "internalType": "uint112", + "name": "_reserve0", + "type": "uint112" + }, + { + "internalType": "uint112", + "name": "_reserve1", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "_blockTimestampLast", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_token0", + "type": "address" + }, + { + "internalType": "address", + "name": "_token1", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kLast", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price0CumulativeLast", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price1CumulativeLast", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "skim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Out", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Out", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "swap", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "sync", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/src/adaptors/orbitalswap/abis/masterchef.json b/src/adaptors/orbitalswap/abis/masterchef.json new file mode 100644 index 0000000000..0a23cc03c5 --- /dev/null +++ b/src/adaptors/orbitalswap/abis/masterchef.json @@ -0,0 +1,1035 @@ +[ + { + "inputs": [ + { + "internalType": "contract OrbitalToken", + "name": "_orb", + "type": "address" + }, + { + "internalType": "address", + "name": "_devaddr", + "type": "address" + }, + { + "internalType": "address", + "name": "_burnAdmin", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IBEP20", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isRegular", + "type": "bool" + } + ], + "name": "AddPool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "EmergencyWithdraw", + "type": "event" + }, + { + "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": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "devaddr", + "type": "address" + } + ], + "name": "SetDev", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + } + ], + "name": "SetPool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "boostContract", + "type": "address" + } + ], + "name": "UpdateBoostContract", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldMultiplier", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMultiplier", + "type": "uint256" + } + ], + "name": "UpdateBoostMultiplier", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "UpdateBurnAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "burnRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "regularFarmRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "specialFarmRate", + "type": "uint256" + } + ], + "name": "UpdateOrbRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lastRewardBlock", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "accOrbPerShare", + "type": "uint256" + } + ], + "name": "UpdatePool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isValid", + "type": "bool" + } + ], + "name": "UpdateWhiteList", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "ACC_ORB_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BOOST_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MASTERCHEF_ORB_PER_BLOCK", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_BOOST_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ORB_RATE_TOTAL_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_allocPoint", + "type": "uint256" + }, + { + "internalType": "contract IBEP20", + "name": "_lpToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isRegular", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_startBlockNumber", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_withUpdate", + "type": "bool" + } + ], + "name": "add", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "boostContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "burnAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_withUpdate", + "type": "bool" + } + ], + "name": "burnOrb", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_devaddr", + "type": "address" + } + ], + "name": "dev", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "devaddr", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + } + ], + "name": "emergencyWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + } + ], + "name": "getBoostMultiplier", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastBurnedBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "lpToken", + "outputs": [ + { + "internalType": "contract IBEP20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "massUpdatePools", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "orb", + "outputs": [ + { + "internalType": "contract OrbitalToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_isRegular", + "type": "bool" + } + ], + "name": "orbPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "orbPerBlockToBurn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "orbRateToBurn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "orbRateToRegularFarm", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "orbRateToSpecialFarm", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "pendingOrb", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "accOrbPerShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBoostedShare", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRegular", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolLength", + "outputs": [ + { + "internalType": "uint256", + "name": "pools", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_allocPoint", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_withUpdate", + "type": "bool" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalRegularAllocPoint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSpecialAllocPoint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newBoostContract", + "type": "address" + } + ], + "name": "updateBoostContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_newMultiplier", + "type": "uint256" + } + ], + "name": "updateBoostMultiplier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newAdmin", + "type": "address" + } + ], + "name": "updateBurnAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_burnRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_regularFarmRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_specialFarmRate", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_withUpdate", + "type": "bool" + } + ], + "name": "updateOrbRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + } + ], + "name": "updatePool", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "accOrbPerShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBoostedShare", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isRegular", + "type": "bool" + } + ], + "internalType": "struct MasterChef.PoolInfo", + "name": "pool", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isValid", + "type": "bool" + } + ], + "name": "updateWhiteList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDebt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "boostMultiplier", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "whiteList", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/src/adaptors/orbitalswap/index.js b/src/adaptors/orbitalswap/index.js new file mode 100644 index 0000000000..e167cdd289 --- /dev/null +++ b/src/adaptors/orbitalswap/index.js @@ -0,0 +1,240 @@ +const utils = require('../utils'); +const sdk = require('@defillama/sdk'); +const { default: BigNumber } = require('bignumber.js'); +const superagent = require('superagent'); +const masterChefABI = require('./abis/masterchef.json'); +const lpABI = require('./abis/lp.json'); + +const ORB_TOKEN = '0x42b98a2f73a282d731b0b8f4acfb6caf3565496b'; +const MASTERCHEF_ADDRESS = '0xd67a0CE4B1484DBa8dB53349F9b26a3272dB04F5'; +const BSC_BLOCK_TIME = 3; +const BLOCKS_PER_YEAR = Math.floor((60 / BSC_BLOCK_TIME) * 60 * 24 * 365); +// exclude pool sigle token +const EXCLUDE = [ + '0xC446ca59C44F931Ac5b7e0F6a7424e654dB57876', + '0x3e4BdABF4a9dAbB4438C00A61558D9AC8a965FbB', +]; + +const getORBPriceBUSD = async () => { + const reservesRes = await sdk.api.abi.call({ + abi: lpABI.filter(({ name }) => name === 'getReserves')[0], + target: '0xE1a104f204c6063B06577d8A7E6C796058494e82', + chain: 'bsc', + }); + return ((reservesRes.output._reserve1 / reservesRes.output._reserve0)); +}; + +const getPairInfo = async (pair, tokenAddress) => { + const [tokenSymbol, tokenDecimals] = await Promise.all( + ['erc20:symbol', 'erc20:decimals'].map((method) => + sdk.api.abi.multiCall({ + abi: method, + calls: tokenAddress.map((address) => ({ + target: address, + })), + chain: 'bsc', + requery: true, + } + ) + )); + return { + lpToken: pair.toLowerCase(), + pairName: tokenSymbol.output.map(e => e.output).join('-'), + token0: { + address: tokenAddress[0], + symbol: tokenSymbol.output[0].output, + decimals: tokenDecimals.output[0].output + }, + token1: { + address: tokenAddress[1], + symbol: tokenSymbol.output[1].output, + decimals: tokenDecimals.output[1].output + } + }; +} + +const getPrices = async (addresses) => { + const prices = ( + await superagent.post('https://coins.llama.fi/prices').send({ + coins: addresses.map((address) => `bsc:${address}`), + }) + ).body.coins; + + const pricesObj = Object.entries(prices).reduce( + (acc, [address, price]) => ({ + ...acc, + [address.split(':')[1].toLowerCase()]: price.price, + }), + {} + ); + + return pricesObj; +}; + +const calculateApy = ( + poolInfo, + totalAllocPoint, + ORBPerBlock, + ORBPrice, + reserveUSD +) => { + const poolWeight = poolInfo.allocPoint / totalAllocPoint.output; + const ORBPerYear = BLOCKS_PER_YEAR * ORBPerBlock; + return ((poolWeight * ORBPerYear * ORBPrice) / reserveUSD) * 100; +}; + +const calculateReservesUSD = ( + reserves, + reservesRatio, + token0, + token1, + tokenPrices +) => { + const { decimals: token0Decimals, address: token0Address } = token0; + const { decimals: token1Decimals, address: token1Address } = token1; + const token0Price = tokenPrices[token0Address.toLowerCase()]; + const token1Price = tokenPrices[token1Address.toLowerCase()]; + + const reserve0 = new BigNumber(reserves._reserve0) + .times(reservesRatio) + .times(10 ** (18 - token0Decimals)); + const reserve1 = new BigNumber(reserves._reserve1) + .times(reservesRatio) + .times(10 ** (18 - token1Decimals)); + + if (token0Price) return reserve0.times(token0Price).times(2); + if (token1Price) return reserve1.times(token1Price).times(2); +}; + +const getApy = async () => { + const poolLength = await sdk.api.abi.call({ + target: MASTERCHEF_ADDRESS, + chain: 'bsc', + abi: masterChefABI.find((e) => e.name === 'poolLength'), + }); + const totalAllocPoint = await sdk.api.abi.call({ + target: MASTERCHEF_ADDRESS, + chain: 'bsc', + abi: masterChefABI.find((e) => e.name === 'totalRegularAllocPoint'), + }); + const ORBPerBlock = await sdk.api.abi.call({ + target: MASTERCHEF_ADDRESS, + chain: 'bsc', + params: [true], + abi: masterChefABI.find((e) => e.name === 'orbPerBlock'), + }); + const normalizedORBPerBlock = ORBPerBlock.output / 1e18; + + const poolsRes = await sdk.api.abi.multiCall({ + abi: masterChefABI.filter(({ name }) => name === 'poolInfo')[0], + calls: [...Array(Number(poolLength.output)).keys()].map((i) => ({ + target: MASTERCHEF_ADDRESS, + params: i, + })), + chain: 'bsc', + requery: true, + }); + const lpTokensRes = await sdk.api.abi.multiCall({ + abi: masterChefABI.filter(({ name }) => name === 'lpToken')[0], + calls: [...Array(Number(poolLength.output)).keys()].map((i) => ({ + target: MASTERCHEF_ADDRESS, + params: i, + })), + chain: 'bsc', + requery: true, + }); + + + const pools = poolsRes.output + .map(({ output }, i) => ({ ...output, i })) + .filter((_, index) => index > 1) + .filter((e) => e.allocPoint !== '0'); + const lpTokens = lpTokensRes.output + .map(({ output }) => output) + .filter(e => !EXCLUDE.includes(e)) + + const [reservesRes, supplyRes, masterChefBalancesRes] = await Promise.all( + ['getReserves', 'totalSupply', 'balanceOf'].map((method) => + sdk.api.abi.multiCall({ + abi: lpABI.filter(({ name }) => name === method)[0], + calls: lpTokens.map((address) => ({ + target: address, + params: method === 'balanceOf' ? [MASTERCHEF_ADDRESS] : null, + })), + chain: 'bsc', + requery: true, + }) + ) + ); + + const [underlyingToken0, underlyingToken1] = await Promise.all( + ['token0', 'token1'].map((method) => + sdk.api.abi.multiCall({ + abi: lpABI.filter(({ name }) => name === method)[0], + calls: lpTokens.map((address) => ({ + target: address, + })), + chain: 'bsc', + requery: true, + }) + ) + ); + + const reservesData = reservesRes.output.map((res) => res.output); + const supplyData = supplyRes.output.map((res) => res.output); + const masterChefBalData = masterChefBalancesRes.output.map( + (res, i) => res.output + ); + const tokens0 = underlyingToken0.output.map((res) => res.output); + const tokens1 = underlyingToken1.output.map((res) => res.output); + const tokensPrices = await getPrices([...tokens0, ...tokens1]); + const ORBPrice = await getORBPriceBUSD(); + tokensPrices[ORB_TOKEN.toLowerCase()] = ORBPrice; + const poolsApy = []; + for(const [i, pool] of pools.entries()) { + const pairInfo = await getPairInfo(lpTokens[i], [tokens0[i], tokens1[i]]); + const poolInfo = pool; + const reserves = reservesData[i]; + + const supply = supplyData[i]; + const masterChefBalance = masterChefBalData[i]; + + const masterChefReservesUsd = calculateReservesUSD( + reserves, + masterChefBalance / supply, + pairInfo.token0, + pairInfo.token1, + tokensPrices + ) + .div(1e18) + .toString(); + + const apy = calculateApy( + poolInfo, + totalAllocPoint, + normalizedORBPerBlock, + ORBPrice, + masterChefReservesUsd + ); + + poolsApy.push({ + pool: lpTokens[i], + chain: utils.formatChain('binance'), + project: 'orbitalswap', + symbol: `${pairInfo.token0.symbol}-${pairInfo.token1.symbol}`, + tvlUsd: Number(masterChefReservesUsd), + apyReward: apy, + underlyingTokens: [tokens0[i], tokens1[i]], + rewardTokens: [ORB_TOKEN], + }); + } + + + return poolsApy; +}; + +module.exports = { + timetravel: false, + apy: getApy, + url: 'https://orbitalswap.com/', +};