This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(silo-finance): Added STIP claimables on Arbitrum (#3170)
- Loading branch information
Showing
6 changed files
with
991 additions
and
2 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/apps/silo-finance/arbitrum/silo-finance.claimable.contract-position-fetcher.ts
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,53 @@ | ||
import { Inject } from '@nestjs/common'; | ||
|
||
import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface'; | ||
import { PositionTemplate } from '~app-toolkit/decorators/position-template.decorator'; | ||
import { getLabelFromToken } from '~app-toolkit/helpers/presentation/image.present'; | ||
import { MetaType } from '~position/position.interface'; | ||
import { ContractPositionTemplatePositionFetcher } from '~position/template/contract-position.template.position-fetcher'; | ||
import { | ||
GetDisplayPropsParams, | ||
GetTokenBalancesParams, | ||
GetTokenDefinitionsParams, | ||
} from '~position/template/contract-position.template.types'; | ||
|
||
import { SiloFinanceViemContractFactory } from '../contracts'; | ||
import { SiloStipController } from '../contracts/viem'; | ||
|
||
@PositionTemplate() | ||
export class ArbitrumSiloFinanceClaimableContractPositionFetcher extends ContractPositionTemplatePositionFetcher<SiloStipController> { | ||
groupLabel = 'Claimables'; | ||
|
||
constructor( | ||
@Inject(APP_TOOLKIT) protected readonly appToolkit: IAppToolkit, | ||
@Inject(SiloFinanceViemContractFactory) protected readonly contractFactory: SiloFinanceViemContractFactory, | ||
) { | ||
super(appToolkit); | ||
} | ||
|
||
getContract(address: string) { | ||
return this.contractFactory.siloStipController({ address, network: this.network }); | ||
} | ||
|
||
async getDefinitions() { | ||
return [{ address: '0xd592f705bdc8c1b439bd4d665ed99c4faad5a680' }]; | ||
} | ||
|
||
async getTokenDefinitions({ contract }: GetTokenDefinitionsParams<SiloStipController>) { | ||
return [ | ||
{ | ||
metaType: MetaType.SUPPLIED, | ||
address: await contract.read.REWARD_TOKEN(), | ||
network: this.network, | ||
}, | ||
]; | ||
} | ||
|
||
async getLabel({ contractPosition }: GetDisplayPropsParams<SiloStipController>) { | ||
return getLabelFromToken(contractPosition.tokens[0]); | ||
} | ||
|
||
async getTokenBalancesPerPosition({ address, contract }: GetTokenBalancesParams<SiloStipController>) { | ||
return [await contract.read.getUserUnclaimedRewards([address])]; | ||
} | ||
} |
276 changes: 276 additions & 0 deletions
276
src/apps/silo-finance/contracts/abis/silo-stip-controller.json
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,276 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ "internalType": "contract IERC20", "name": "rewardToken", "type": "address" }, | ||
{ "internalType": "address", "name": "emissionManager", "type": "address" } | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "constructor" | ||
}, | ||
{ "inputs": [], "name": "ClaimerUnauthorized", "type": "error" }, | ||
{ "inputs": [], "name": "IndexOverflow", "type": "error" }, | ||
{ "inputs": [], "name": "IndexOverflowAtEmissionsPerSecond", "type": "error" }, | ||
{ "inputs": [], "name": "InvalidConfiguration", "type": "error" }, | ||
{ "inputs": [], "name": "InvalidToAddress", "type": "error" }, | ||
{ "inputs": [], "name": "InvalidUserAddress", "type": "error" }, | ||
{ "inputs": [], "name": "OnlyEmissionManager", "type": "error" }, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, | ||
{ "indexed": false, "internalType": "uint256", "name": "emission", "type": "uint256" } | ||
], | ||
"name": "AssetConfigUpdated", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, | ||
{ "indexed": false, "internalType": "uint256", "name": "index", "type": "uint256" } | ||
], | ||
"name": "AssetIndexUpdated", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, | ||
{ "indexed": true, "internalType": "address", "name": "claimer", "type": "address" } | ||
], | ||
"name": "ClaimerSet", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [{ "indexed": false, "internalType": "uint256", "name": "newDistributionEnd", "type": "uint256" }], | ||
"name": "DistributionEndUpdated", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, | ||
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } | ||
], | ||
"name": "RewardsAccrued", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, | ||
{ "indexed": true, "internalType": "address", "name": "to", "type": "address" }, | ||
{ "indexed": true, "internalType": "address", "name": "claimer", "type": "address" }, | ||
{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } | ||
], | ||
"name": "RewardsClaimed", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, | ||
{ "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, | ||
{ "indexed": false, "internalType": "uint256", "name": "index", "type": "uint256" } | ||
], | ||
"name": "UserIndexUpdated", | ||
"type": "event" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "DISTRIBUTION_END", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "EMISSION_MANAGER", | ||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "PRECISION", | ||
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "REVISION", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "REWARD_TOKEN", | ||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "TEN_POW_PRECISION", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }], | ||
"name": "assets", | ||
"outputs": [ | ||
{ "internalType": "uint104", "name": "emissionPerSecond", "type": "uint104" }, | ||
{ "internalType": "uint104", "name": "index", "type": "uint104" }, | ||
{ "internalType": "uint40", "name": "lastUpdateTimestamp", "type": "uint40" } | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address[]", "name": "assets", "type": "address[]" }, | ||
{ "internalType": "uint256", "name": "amount", "type": "uint256" }, | ||
{ "internalType": "address", "name": "to", "type": "address" } | ||
], | ||
"name": "claimRewards", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address[]", "name": "assets", "type": "address[]" }, | ||
{ "internalType": "uint256", "name": "amount", "type": "uint256" }, | ||
{ "internalType": "address", "name": "user", "type": "address" }, | ||
{ "internalType": "address", "name": "to", "type": "address" } | ||
], | ||
"name": "claimRewardsOnBehalf", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address[]", "name": "assets", "type": "address[]" }, | ||
{ "internalType": "uint256", "name": "amount", "type": "uint256" } | ||
], | ||
"name": "claimRewardsToSelf", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address[]", "name": "assets", "type": "address[]" }, | ||
{ "internalType": "uint256[]", "name": "emissionsPerSecond", "type": "uint256[]" } | ||
], | ||
"name": "configureAssets", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], | ||
"name": "getAssetData", | ||
"outputs": [ | ||
{ "internalType": "uint256", "name": "", "type": "uint256" }, | ||
{ "internalType": "uint256", "name": "", "type": "uint256" }, | ||
{ "internalType": "uint256", "name": "", "type": "uint256" } | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "user", "type": "address" }], | ||
"name": "getClaimer", | ||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "getDistributionEnd", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address[]", "name": "assets", "type": "address[]" }, | ||
{ "internalType": "address", "name": "user", "type": "address" } | ||
], | ||
"name": "getRewardsBalance", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address", "name": "user", "type": "address" }, | ||
{ "internalType": "address", "name": "asset", "type": "address" } | ||
], | ||
"name": "getUserAssetData", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], | ||
"name": "getUserUnclaimedRewards", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address", "name": "user", "type": "address" }, | ||
{ "internalType": "uint256", "name": "totalSupply", "type": "uint256" }, | ||
{ "internalType": "uint256", "name": "userBalance", "type": "uint256" } | ||
], | ||
"name": "handleAction", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "notificationReceiverPing", | ||
"outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], | ||
"stateMutability": "pure", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address", "name": "", "type": "address" }, | ||
{ "internalType": "address", "name": "_from", "type": "address" }, | ||
{ "internalType": "address", "name": "_to", "type": "address" }, | ||
{ "internalType": "uint256", "name": "_amount", "type": "uint256" } | ||
], | ||
"name": "onAfterTransfer", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ "inputs": [], "name": "rescueRewards", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address", "name": "user", "type": "address" }, | ||
{ "internalType": "address", "name": "caller", "type": "address" } | ||
], | ||
"name": "setClaimer", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "uint256", "name": "distributionEnd", "type": "uint256" }], | ||
"name": "setDistributionEnd", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
} | ||
] |
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
Oops, something went wrong.