-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Lima
committed
Apr 30, 2024
1 parent
1f4c768
commit 7f3ab81
Showing
5 changed files
with
104 additions
and
15 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
scripts/orium-marketplace-royalties/08-set-trusted-tokens.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,21 @@ | ||
import { print, colors } from '../../utils/misc' | ||
import { callContractFunction } from '../../utils/write-contract' | ||
|
||
const TOKEN_ADDRESSES = ['0x8fbe243d898e7c88a6724bb9eb13d746614d23d6'] // GLMRApes address moonbeam | ||
const FEE_TOKEN_ADDRESSES = ['0xd10078fdbc835726c79533a4a19db40cfad69d7f'] // GLMB address moonbeam | ||
const IS_TRUSTED = [true] | ||
const CONTRACT_NAME = 'OriumMarketplaceRoyalties' | ||
const CONTRACT_FUNCTION = 'setTrustedFeeTokenForToken' | ||
const CONTRACT_ARGUMENTS = [TOKEN_ADDRESSES, FEE_TOKEN_ADDRESSES, IS_TRUSTED] | ||
async function main() { | ||
await callContractFunction(CONTRACT_NAME, CONTRACT_FUNCTION, CONTRACT_ARGUMENTS) | ||
} | ||
|
||
main() | ||
.then(() => { | ||
print(colors.bigSuccess, 'All done!') | ||
}) | ||
.catch(error => { | ||
console.error(error) | ||
process.exitCode = 1 | ||
}) |
19 changes: 19 additions & 0 deletions
19
scripts/orium-marketplace-royalties/09-set-default-nft-roles-registry copy.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,19 @@ | ||
import { ZeroAddress } from 'ethers' | ||
import { print, colors } from '../../utils/misc' | ||
import { callContractFunction } from '../../utils/write-contract' | ||
|
||
const CONTRACT_NAME = 'OriumMarketplaceRoyalties' | ||
const CONTRACT_FUNCTION = 'setDefaultNftRolesRegistry' | ||
const CONTRACT_ARGUMENTS = [ZeroAddress] | ||
async function main() { | ||
await callContractFunction(CONTRACT_NAME, CONTRACT_FUNCTION, CONTRACT_ARGUMENTS) | ||
} | ||
|
||
main() | ||
.then(() => { | ||
print(colors.bigSuccess, 'All done!') | ||
}) | ||
.catch(error => { | ||
console.error(error) | ||
process.exitCode = 1 | ||
}) |
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,12 @@ | ||
import { ethers, network } from 'hardhat' | ||
import { AwsKmsSigner } from './ethers-aws-kms-signer' | ||
|
||
const kmsCredentials = { | ||
accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'AKIAxxxxxxxxxxxxxxxx', // credentials for your IAM user with KMS access | ||
secretAccessKey: process.env.AWS_ACCESS_KEY_SECRET || 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // credentials for your IAM user with KMS access | ||
region: 'us-east-1', // region of your KMS key | ||
keyId: process.env.AWS_KMS_KEY_ID || 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', // KMS key id | ||
} | ||
const networkConfig: any = network.config | ||
export const kmsProvider = new ethers.JsonRpcProvider(networkConfig.url || '') | ||
export const kmsDeployer = new AwsKmsSigner(kmsCredentials).connect(kmsProvider) |
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,37 @@ | ||
import { ethers, network } from 'hardhat' | ||
import config, { Network } from '../addresses' | ||
import { print, colors, confirmOrDie } from '../utils/misc' | ||
import { kmsDeployer, kmsProvider } from './deployer' | ||
|
||
const NETWORK = network.name as Network | ||
|
||
/** | ||
* @notice Send a transaction to a contract | ||
* @dev The contract must be deployed on the network and the solidity file in the contracts folder | ||
* @param CONTRACT_NAME The name of the contract | ||
* @param FUNCTION_NAME The function to call | ||
* @param FUNCTION_ARGUMENTS The arguments to pass to the function | ||
* @param CUSTOM_FEE_DATA The custom fee data (optional) | ||
*/ | ||
export async function callContractFunction( | ||
CONTRACT_NAME: keyof (typeof config)[Network], | ||
FUNCTION_NAME: string, | ||
FUNCTION_ARGUMENTS: any, | ||
CUSTOM_FEE_DATA?: { maxFeePerGas: bigint; maxPriorityFeePerGas: bigint }, | ||
) { | ||
console.log('CONTRACT_NAME', CONTRACT_NAME) | ||
await confirmOrDie( | ||
`Are you sure you want to call ${FUNCTION_NAME} in ${CONTRACT_NAME} contract on ${NETWORK} network?`, | ||
) | ||
if (CUSTOM_FEE_DATA !== undefined) { | ||
const FEE_DATA: any = CUSTOM_FEE_DATA | ||
kmsProvider.getFeeData = async () => FEE_DATA | ||
} | ||
print(colors.warn, `Arguments: ${FUNCTION_ARGUMENTS}`) | ||
const contract = await ethers.getContractAt(CONTRACT_NAME, config[NETWORK][CONTRACT_NAME].address, kmsDeployer) | ||
print(colors.highlight, `Sending Transaction...`) | ||
const response = await contract[FUNCTION_NAME](...FUNCTION_ARGUMENTS) | ||
print(colors.highlight, `Waiting for transaction to be mined...`) | ||
const transaction = await response.wait() | ||
print(colors.bigSuccess, `Transaction sent! txHash: ${transaction?.hash}`) | ||
} |