Skip to content

Commit

Permalink
PlutoAllianceStaking Submission
Browse files Browse the repository at this point in the history
Signed-off-by: mattim0use <mattimose@gmail.com>
  • Loading branch information
mattim0use authored and raymondfeng committed Aug 31, 2023
1 parent 11d37fd commit 8fa9d7f
Show file tree
Hide file tree
Showing 3 changed files with 298 additions and 1 deletion.
42 changes: 42 additions & 0 deletions src/adapters/plutoalliance.adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {BindingScope, extensionFor, injectable} from '@loopback/core';
import {BigNumber} from 'ethers';
import {STAKING_ADAPTERS_EXTENSION_POINT} from '../keys';
import {BaseStakingContractAdapter, StakingAsset} from '../staking';
// Use the full path to import instead of `../types`
import {PlutoallianceStaking__factory} from '../types/factories/PlutoallianceStaking__factory';

@injectable(
{
scope: BindingScope.SINGLETON, // Mark the adapter as a singleton
},
// Mark it as an extension to staking contracts service
extensionFor(STAKING_ADAPTERS_EXTENSION_POINT),
)
export class PlutoallianceStakingAdapter extends BaseStakingContractAdapter {
/**
* The contract address
*/
contractAddress = '0x882eA36F2031F3EDD6Cc243472f6Bea7195ECaf3';

/**
* Assets that can be staked to this contract
*/
supportedAssets: StakingAsset[] = [
{
asset: 'ERC721:0xDfe3AC769b2d8E382cB86143E0b0B497E1ED5447',
},
];

/**
* Get staked token ids for the given owner
* @param owner - Owner address
* @returns
*/
getStakedTokenIds(owner: string): Promise<BigNumber[]> {
const contract = PlutoallianceStaking__factory.connect(
this.contractAddress,
this.provider,
);
return contract.getStakedTokens(owner);
}
}
4 changes: 3 additions & 1 deletion src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {GenKStakingContractAdapter} from './adapters/genk-staking.adapter';
import {MoonrunnersStakingContractAdapter} from './adapters/moonrunners.adapter';
import {MtgStakingContractAdapter} from './adapters/mtg.adapter';
import {OmniguardEternalsStakingContractAdapter} from './adapters/omniguard-eternals.adapter';
import {PlutoallianceStakingAdapter} from './adapters/plutoalliance.adapter';
import {RandomStakingContractAdapter} from './adapters/random-staking.adapter';
import {RDStakingContractAdapter} from './adapters/rd-staking.adapter';
import {RektDogsStakingContractAdapter} from './adapters/rekt-dogs-adapter';
Expand All @@ -44,9 +45,9 @@ import {RoboStakingContractAdapter} from './adapters/robo.adapter';
import {SkyFarmStakingContractAdapter} from './adapters/sky-farm.adapter';
import {SpitYardContractAdapter} from './adapters/spit-yard.adapter';
import {UwULendStakingContractAdapter} from './adapters/uwulend-staking.adapter';
import {XenoStakingContractAdapter} from './adapters/xeno-mining.adapter';
import {STAKING_CONTRACTS_COMPONENT} from './keys';
import {StakingContractsService} from './services/staking-contracts.service';
import {XenoStakingContractAdapter} from './adapters/xeno-mining.adapter';

// Configure the binding for StakingContractsComponent
@injectable({
Expand Down Expand Up @@ -88,6 +89,7 @@ export class StakingContractsComponent implements Component {
OmniguardEternalsStakingContractAdapter,
MoonrunnersStakingContractAdapter,
XenoStakingContractAdapter,
PlutoallianceStakingAdapter,
];
constructor() {}
}
253 changes: 253 additions & 0 deletions src/contracts/plutoalliance-staking.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "token_id",
"type": "uint256"
},
{
"indexed": true,
"internalType": "enum StakeNFT.StakingStatus",
"name": "status",
"type": "uint8"
}
],
"name": "tokenCancelComplete",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "token_id",
"type": "uint256"
},
{
"indexed": true,
"internalType": "enum StakeNFT.StakingStatus",
"name": "status",
"type": "uint8"
}
],
"name": "tokenClaimStatus",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "staker",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "token_id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "enum StakeNFT.StakingStatus",
"name": "status",
"type": "uint8"
}
],
"name": "tokenStaked",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "_tokenID",
"type": "uint256"
}
],
"name": "callStakeToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256[]",
"name": "tokenIds",
"type": "uint256[]"
}
],
"name": "cancelMultiStakes",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "address",
"name": "staker",
"type": "address"
}
],
"name": "checkStake",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "staker",
"type": "address"
},
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "releaseTime",
"type": "uint256"
},
{
"internalType": "enum StakeNFT.StakingStatus",
"name": "status",
"type": "uint8"
}
],
"internalType": "struct StakeNFT.Staking",
"name": "",
"type": "tuple"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_wallet",
"type": "address"
}
],
"name": "getStakedTokens",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "_tokenIds",
"type": "uint256[]"
}
],
"name": "multiStakeToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "viewStake",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "staker",
"type": "address"
},
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "releaseTime",
"type": "uint256"
},
{
"internalType": "enum StakeNFT.StakingStatus",
"name": "status",
"type": "uint8"
}
],
"internalType": "struct StakeNFT.Staking",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
}
]

0 comments on commit 8fa9d7f

Please sign in to comment.