Skip to content

Commit

Permalink
Merge pull request #162 from MorpheusAIs/feature/builders-v2
Browse files Browse the repository at this point in the history
Feature/builders v2
  • Loading branch information
revomhere authored Feb 21, 2025
2 parents 1364af2 + ae785be commit ca5b424
Show file tree
Hide file tree
Showing 14 changed files with 753 additions and 156 deletions.
112 changes: 109 additions & 3 deletions src/abi/BuilderSubnets.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,25 @@
"name": "Staked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "treasury",
"type": "address"
}
],
"name": "SubnetCreationFeeSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -424,7 +443,7 @@
},
{
"internalType": "uint128",
"name": "minClaimLockEnd",
"name": "maxClaimLockEnd",
"type": "uint128"
}
],
Expand Down Expand Up @@ -462,6 +481,31 @@
"name": "SubnetFeeTreasurySet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "subnetId",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint128",
"name": "oldValue",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "newValue",
"type": "uint128"
}
],
"name": "SubnetMaxClaimLockEndSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -771,7 +815,7 @@
},
{
"internalType": "uint128",
"name": "minClaimLockEnd",
"name": "maxClaimLockEnd",
"type": "uint128"
}
],
Expand Down Expand Up @@ -918,7 +962,7 @@
},
{
"internalType": "uint128",
"name": "minClaimLockEnd",
"name": "maxClaimLockEnd",
"type": "uint128"
}
],
Expand Down Expand Up @@ -1365,6 +1409,24 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "subnetCreationFeeAmount_",
"type": "uint256"
},
{
"internalType": "address",
"name": "subnetCreationFeeTreasury_",
"type": "address"
}
],
"name": "setSubnetCreationFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand All @@ -1383,6 +1445,24 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "subnetId_",
"type": "bytes32"
},
{
"internalType": "uint128",
"name": "newValue_",
"type": "uint128"
}
],
"name": "setSubnetMaxClaimLockEnd",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -1509,6 +1589,32 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "subnetCreationFeeAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "subnetCreationFeeTreasury",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,13 @@ export const perChainDeployedContracts: Record<
..._emptyContracts,
[EthereumChains.Arbitrum]: '0xC0eD68f163d44B6e9985F0041fDf6f67c6BCFF3f',
[EthereumChains.ArbitrumSepolia]:
'0xCB27aC872bfF99b643c9276041FA4b3CCC713759',
'0xfc088c5ec4288a3B337C6b93968E521aAf06f346',
[EthereumChains.Base]: '0x42BB446eAE6dca7723a9eBdb81EA88aFe77eF4B9',
},
[ContractIds.feeConfig]: {
..._emptyContracts,
[EthereumChains.ArbitrumSepolia]:
'0x300aEB39b9bd45b375b918f398e2fB9E25eb7287',
'0x65b8676392432B1cBac1BE4792a5867A8CA2f375',
},
}

Expand Down
25 changes: 12 additions & 13 deletions src/graphql/BuildersQueries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fragment BuilderSubnetDefault on BuilderSubnet {
feeTreasury
startsAt
withdrawLockPeriodAfterStake
minClaimLockEnd
maxClaimLockEnd
slug
description
website
Expand Down Expand Up @@ -47,14 +47,19 @@ query getBuilderSubnetUsers(
skip: $skip
orderBy: $orderBy
orderDirection: $orderDirection
where: { builderSubnet_: {id: $builderSubnetId} }
where: { builderSubnet_: { id: $builderSubnetId } }
) {
...BuilderUserDefault
}
}

query getUserAccountBuilderSubnets($address: Bytes = "", $builder_subnet_id: Bytes = "") {
builderUsers(where: {address: $address, builderSubnet_: {id: $builder_subnet_id}}) {
query getUserAccountBuilderSubnets(
$address: Bytes = ""
$builder_subnet_id: Bytes = ""
) {
builderUsers(
where: { address: $address, builderSubnet_: { id: $builder_subnet_id } }
) {
...BuilderUserDefault
builderSubnet {
...BuilderSubnetDefault
Expand All @@ -70,7 +75,6 @@ query combinedBuilderSubnets(
$usersOrderBy: BuilderUser_orderBy
$usersDirection: OrderDirection
$builderSubnetName: String! = ""

$address: Bytes = ""
) {
builderSubnets(
Expand All @@ -83,11 +87,10 @@ query combinedBuilderSubnets(
...BuilderSubnetDefault
}


builderUsers(
orderBy: $usersOrderBy
orderDirection: $usersDirection
where: {address: $address}
where: { address: $address }
) {
...BuilderUserDefault
builderSubnet {
Expand All @@ -114,19 +117,15 @@ query combinedBuilderSubnetsFilteredByPredefinedBuilders(
builderSubnets(
orderBy: $orderBy
orderDirection: $orderDirection
where: {name_in: $name_in}
where: { name_in: $name_in }
) {
...BuilderSubnetDefault
}


builderUsers(
orderBy: $usersOrderBy
orderDirection: $usersDirection
where: {
address: $address
builderSubnet_: {name_in: $name_in}
}
where: { address: $address, builderSubnet_: { name_in: $name_in } }
) {
...BuilderUserDefault
builderSubnet {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/error-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class ErrorHandler {

errorMessage =
typeof reason === 'string' && reason.length
? capitalize(reason)
? capitalize(reason).replaceAll('BS: ', '')
: t('errors.default')
}
}
Expand Down
22 changes: 16 additions & 6 deletions src/localization/resources/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,8 @@
"lock-period-after-stake-note": "After each stake, the user will not be able to withdraw his deposit this time",
"min-deposit-plh": "Minimal stake",
"min-deposit-note": "Example: “0.001 MOR”",
"claim-lock-end-plh": "Subnet claim lock end timestamp",
"claim-lock-end-note": "At this point, the claim will open. Example: “05.05.2030 02:00 PM",
"claim-lock-end-plh": "Max Stakers claim lock end timestamp",
"claim-lock-end-note": "Stakers will be able to lock their claim until this timestamp. Affects the Power Factor. Example: \"05 Jul 2030 02:00 PM\"",

"section-3-title": "Subnet Emission",
"emissions-fee-plh": "% of the MOR Emissions the Subnet receives",
Expand Down Expand Up @@ -854,7 +854,7 @@
"builders-stake-modal": {
"modal-title": "Stake MOR",
"available-to-stake-balance-value": "{amount} MOR",
"claim-lock-end-validation-msg": "Should be more that {date}",
"claim-lock-end-validation-msg": "Should be less than {date}",
"power-factor-lbl": "Power Factor",
"power-factor-tooltip": "The power factor depends on the claim lock timestamp, the longer the claim lock, the larger the power factor.",
"power-factor-value": "x{powerFactor}",
Expand All @@ -880,10 +880,9 @@
"subnet-lbl": "Subnet",
"claim-receiver-lbl": "Receiver",
"amount-lbl": "Amount",
"protocol-fee-lbl": "Protocol emission",
"emissions-lbl": "% of the MOR Emissions \n the Subnet receives",
"protocol-fee-lbl": "% of the MOR emission \n the Protocol receives",
"emissions-lbl": "% of the MOR emissions \n the Subnet receives",
"final-claim-lbl": "Final Claim",

"cancel-btn": "Cancel",
"submit-btn": "Confirm"
},
Expand Down Expand Up @@ -968,6 +967,17 @@
"claim-success-msg": "The transaction was confirmed, you can view it in the explorer <a class=\"link\" href={explorerTxUrl} target=\"blank\" rel=\"noopener noreferrer\">here</a>",
"empty-dash": "-"
},
"builders-creation-cost-modal": {
"modal-title": "Create Your Subnet",
"modal-description": "Creating a subnet costs {price} MOR, the funds will be taken from your connected wallet.",
"network-lbl": "Network",
"subnet-lbl": "Subnet name",
"admin-lbl": "Admin address",
"balance-lbl": "Your MOR balance",
"balance-after-lbl": "MOR balance after the Subnet creation",
"cancel-btn": "Cancel",
"create-btn": "Create"
},
"file-field": {
"drag-n-drop-lbl": "Drag & drop",
"drag-n-drop-divider": "or",
Expand Down
Loading

0 comments on commit ca5b424

Please sign in to comment.