Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
feat(looksrare): Add staking v2 position
Browse files Browse the repository at this point in the history
  • Loading branch information
wpoulin committed Dec 12, 2023
1 parent 0116908 commit d49785c
Show file tree
Hide file tree
Showing 8 changed files with 853 additions and 5 deletions.
241 changes: 241 additions & 0 deletions src/apps/looks-rare/contracts/abis/looks-rare-staking-rewards-v-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_rewardsDistribution", "type": "address" },
{ "internalType": "address", "name": "_rewardToken", "type": "address" },
{ "internalType": "address", "name": "_stakingToken", "type": "address" },
{ "internalType": "uint256", "name": "_rewardsDuration", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [{ "internalType": "address", "name": "target", "type": "address" }],
"name": "AddressEmptyCode",
"type": "error"
},
{
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
"name": "AddressInsufficientBalance",
"type": "error"
},
{ "inputs": [], "name": "FailedInnerCall", "type": "error" },
{ "inputs": [], "name": "ReentrancyGuardReentrantCall", "type": "error" },
{
"inputs": [{ "internalType": "address", "name": "token", "type": "address" }],
"name": "SafeERC20FailedOperation",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "tokenAddress", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "Recovered",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "uint256", "name": "reward", "type": "uint256" }],
"name": "RewardAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "user", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "reward", "type": "uint256" }
],
"name": "RewardPaid",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": true, "internalType": "address", "name": "_rewardsDistribution", "type": "address" }],
"name": "RewardsDistributionUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "user", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "Staked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "user", "type": "address" },
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "Withdrawn",
"type": "event"
},
{
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
"name": "balanceOf",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
"name": "earned",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{ "inputs": [], "name": "exit", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{ "inputs": [], "name": "getReward", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{
"inputs": [],
"name": "lastTimeRewardApplicable",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "lastUpdateTime",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "reward", "type": "uint256" }],
"name": "notifyRewardAmount",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "periodFinish",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "tokenAddress", "type": "address" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "recoverERC20",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "rewardPerToken",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "rewardPerTokenStored",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "rewardRate",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "rewardToken",
"outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "rewards",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "rewardsDistribution",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "rewardsDuration",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_rewardsDistribution", "type": "address" }],
"name": "setNewRewardsDistribution",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }],
"name": "stake",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
{ "internalType": "address", "name": "onBehalf", "type": "address" }
],
"name": "stakeOnBehalf",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "stakingBase",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "stakingToken",
"outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "userRewardPerTokenPaid",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
5 changes: 4 additions & 1 deletion src/apps/looks-rare/contracts/viem.contract-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Injectable, Inject } from '@nestjs/common';
import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface';
import { Network } from '~types/network.interface';

import { LooksRareCompounder__factory, LooksRareFeeSharing__factory } from './viem';
import { LooksRareCompounder__factory, LooksRareFeeSharing__factory, LooksRareStakingRewardsV2__factory } from './viem';

type ContractOpts = { address: string; network: Network };

Expand All @@ -17,4 +17,7 @@ export class LooksRareViemContractFactory {
looksRareFeeSharing({ address, network }: ContractOpts) {
return LooksRareFeeSharing__factory.connect(address, this.appToolkit.getViemNetworkProvider(network));
}
looksRareStakingRewardsV2({ address, network }: ContractOpts) {
return LooksRareStakingRewardsV2__factory.connect(address, this.appToolkit.getViemNetworkProvider(network));
}
}
Loading

0 comments on commit d49785c

Please sign in to comment.