Skip to content

Commit

Permalink
Update partner minter contract
Browse files Browse the repository at this point in the history
  • Loading branch information
marshall2112 committed Apr 14, 2023
1 parent 14ecfdc commit 47014b9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
3 changes: 1 addition & 2 deletions apps/dapp/src/components/Vault/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { BigNumber } from 'ethers';
import { parseUnits, formatUnits } from 'ethers/lib/utils';

import { GraphVault, GraphVaultGroup } from 'hooks/core/types';
import { formatNumber } from 'utils/formatter';
import { fromAtto, ZERO } from 'utils/bigNumber';
import { fromAtto } from 'utils/bigNumber';
import { Vault, VaultGroup, MarkerType, Marker } from './types';
import { VaultGroupBalances } from 'hooks/core/use-vault-group-token-balance';

Expand Down
2 changes: 1 addition & 1 deletion apps/dapp/src/constants/env/preview-nexus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const env: Environment = {
templeShardsAddress: '0xaBf139511C381f7804EdD6E4c78383b775d8CeeF',
templeSacrificeAddress: '0xD0A07fc8Bfe7e2846A67B8C34C6b573Aff5e2511',
templeToken: '0xB8FeDaCB1780b3936251b1b0169b4E11A5bA8277',
templePartnerMinterAddress: '0x7ED0F069f34Be49B736b5b52dEE019035AeB534f',
templePartnerMinterAddress: '0x6C1b2C8073344B7686a54Fcf2CFA28E5b13379d5',
recipes: [
{ id: 0, required_ids: [0, 1], required_amounts: [1, 1], reward_ids: [2], reward_amounts: [1] },
{ id: 2, required_ids: [0, 1], required_amounts: [2, 3], reward_ids: [2], reward_amounts: [1] },
Expand Down
2 changes: 1 addition & 1 deletion apps/dapp/src/constants/env/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const env: Environment = {
templeShardsAddress: '0xaBf139511C381f7804EdD6E4c78383b775d8CeeF',
templeSacrificeAddress: '0xD0A07fc8Bfe7e2846A67B8C34C6b573Aff5e2511',
templeToken: '0xB8FeDaCB1780b3936251b1b0169b4E11A5bA8277',
templePartnerMinterAddress: '0x7ED0F069f34Be49B736b5b52dEE019035AeB534f',
templePartnerMinterAddress: '0x6C1b2C8073344B7686a54Fcf2CFA28E5b13379d5',
recipes: [
{ id: 0, required_ids: [0, 1], required_amounts: [1, 1], reward_ids: [2], reward_amounts: [1] },
{ id: 2, required_ids: [0, 1], required_amounts: [2, 3], reward_ids: [2], reward_amounts: [1] },
Expand Down
8 changes: 2 additions & 6 deletions apps/dapp/src/providers/RelicProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,20 +320,16 @@ export const RelicProvider = (props: PropsWithChildren<{}>) => {
});

const mintShard = async () => {
console.log('--- inside here');
console.log(signer);
console.log(wallet);

if (!signer || !wallet) {
return;
}

// TODO: Add error handling
const partnerMinterContract = new PartnerMinter__factory(signer).attach(env.nexus.templePartnerMinterAddress);
console.log('--- HERE');

let receipt: ContractReceipt;
try {
const txnReceipt = await partnerMinterContract.mintShard(1);
const txnReceipt = await partnerMinterContract.mintShard();
receipt = await txnReceipt.wait();
} catch (error: any) {
console.log(error.message);
Expand Down
5 changes: 3 additions & 2 deletions protocol/contracts/nexus/PartnerMinter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface IShards {
contract PartnerMinter is Ownable {
IShards private SHARDS;
IRelic private RELIC;
uint256 public SHARD_ID = 1;

modifier canMint() {
uint256 balance = RELIC.balanceOf(msg.sender);
Expand All @@ -39,8 +40,8 @@ contract PartnerMinter is Ownable {

mapping(uint256 => bool) relicIdToMinted;

function mintShard(uint256 _itemId) external canMint {
SHARDS.partnerMint(msg.sender, _itemId, 1, "");
function mintShard() external canMint {
SHARDS.partnerMint(msg.sender, SHARD_ID, 1, "");
}

function setRelicShards(
Expand Down

0 comments on commit 47014b9

Please sign in to comment.