-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: mattim0use <mattimose@gmail.com>
- Loading branch information
1 parent
11d37fd
commit 8fa9d7f
Showing
3 changed files
with
298 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] |