Skip to content

Commit

Permalink
add new hh task uri. (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr13tech authored Jan 30, 2023
1 parent b909128 commit cb2f30b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions tasks/spaceibles/asset/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './mint.task'
export * from './grantCreatorRole.task'
export * from './toggleOpenCreate.task'
export * from './uri'
24 changes: 24 additions & 0 deletions tasks/spaceibles/asset/uri.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { task } from 'hardhat/config'

import contractNames from '../../../constants/contract.names'

const TASK = {
NAME: 'spaceibles:uri',
DESC: 'call `uri()`',
CONTRACT_NAME: contractNames.SPACEIBLE_ASSET,

PARAMS: {
SPACEIBLE_ASSET_ADDRESS: 'address',
SPACEIBLE_ASSET_ADDRESS_DESC: 'address of deployed spaceible asset'
}
}

export default task(TASK.NAME, TASK.DESC)
.addParam(TASK.PARAMS.SPACEIBLE_ASSET_ADDRESS, TASK.PARAMS.SPACEIBLE_ASSET_ADDRESS_DESC)
.setAction(
async ({ address }, hre) =>
await hre.ethers
.getContractAt(TASK.CONTRACT_NAME, address)
.then(contract => contract.uri())
.then(uri => console.log(uri))
)

0 comments on commit cb2f30b

Please sign in to comment.