Skip to content

Commit caa0423

Browse files
committed
Updates codex api
1 parent 8ef190b commit caa0423

File tree

15 files changed

+96
-96
lines changed

15 files changed

+96
-96
lines changed

ProjectPlugins/CodexPlugin/ApiChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace CodexPlugin
1010
public class ApiChecker
1111
{
1212
// <INSERT-OPENAPI-YAML-HASH>
13-
private const string OpenApiYamlHash = "13-5A-2D-11-AD-A8-4B-72-95-5E-72-50-05-26-08-C4-53-AA-E9-FA-14-54-F8-1B-A7-C2-7C-2D-C6-4D-5D-F0";
13+
private const string OpenApiYamlHash = "6E-0D-3F-26-51-3B-C0-16-1A-A4-81-86-80-CA-08-BC-CB-6C-8A-2C-49-4B-30-CB-75-D8-0F-EA-9D-57-D6-8A";
1414
private const string OpenApiFilePath = "/codex/openapi.yaml";
1515
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";
1616

ProjectPlugins/CodexPlugin/Mapper.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public CodexOpenApi.SalesAvailabilityCREATE Map(StorageAvailability availability
6060
return new CodexOpenApi.SalesAvailabilityCREATE
6161
{
6262
Duration = ToDecInt(availability.MaxDuration.TotalSeconds),
63-
MinPrice = ToDecInt(availability.MinPriceForTotalSpace),
64-
MaxCollateral = ToDecInt(availability.MaxCollateral),
63+
MinPricePerBytePerSecond = ToDecInt(availability.MinPricePerBytePerSecond),
64+
TotalCollateral = ToDecInt(availability.TotalCollateral),
6565
TotalSize = ToDecInt(availability.TotalSpace.SizeInBytes)
6666
};
6767
}
@@ -72,8 +72,8 @@ public CodexOpenApi.StorageRequestCreation Map(StoragePurchaseRequest purchase)
7272
{
7373
Duration = ToDecInt(purchase.Duration.TotalSeconds),
7474
ProofProbability = ToDecInt(purchase.ProofProbability),
75-
Reward = ToDecInt(purchase.PricePerSlotPerSecond),
76-
Collateral = ToDecInt(purchase.RequiredCollateral),
75+
PricePerBytePerSecond = ToDecInt(purchase.PricePerBytePerSecond),
76+
CollateralPerByte = ToDecInt(purchase.CollateralPerByte),
7777
Expiry = ToDecInt(purchase.Expiry.TotalSeconds),
7878
Nodes = Convert.ToInt32(purchase.MinRequiredNumberOfNodes),
7979
Tolerance = Convert.ToInt32(purchase.NodeFailureTolerance)
@@ -91,8 +91,8 @@ public StorageAvailability Map(SalesAvailabilityREAD availability)
9191
(
9292
ToByteSize(availability.TotalSize),
9393
ToTimespan(availability.Duration),
94-
new TestToken(ToBigIng(availability.MinPrice)),
95-
new TestToken(ToBigIng(availability.MaxCollateral))
94+
new TestToken(ToBigIng(availability.MinPricePerBytePerSecond)),
95+
new TestToken(ToBigIng(availability.TotalCollateral))
9696
)
9797
{
9898
Id = availability.Id,

ProjectPlugins/CodexPlugin/MarketplaceTypes.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public StoragePurchaseRequest(ContentId cid)
1212
}
1313

1414
public ContentId ContentId { get; set; }
15-
public TestToken PricePerSlotPerSecond { get; set; } = 1.TstWei();
16-
public TestToken RequiredCollateral { get; set; } = 1.TstWei();
15+
public TestToken PricePerBytePerSecond { get; set; } = 1.TstWei();
16+
public TestToken CollateralPerByte { get; set; } = 1.TstWei();
1717
public uint MinRequiredNumberOfNodes { get; set; }
1818
public uint NodeFailureTolerance { get; set; }
1919
public int ProofProbability { get; set; }
@@ -23,8 +23,8 @@ public StoragePurchaseRequest(ContentId cid)
2323
public void Log(ILog log)
2424
{
2525
log.Log($"Requesting storage for: {ContentId.Id}... (" +
26-
$"pricePerSlotPerSecond: {PricePerSlotPerSecond}, " +
27-
$"requiredCollateral: {RequiredCollateral}, " +
26+
$"pricePerBytePerSecond: {PricePerBytePerSecond}, " +
27+
$"collateralPerByte: {CollateralPerByte}, " +
2828
$"minRequiredNumberOfNodes: {MinRequiredNumberOfNodes}, " +
2929
$"nodeFailureTolerance: {NodeFailureTolerance}, " +
3030
$"proofProbability: {ProofProbability}, " +
@@ -75,28 +75,28 @@ public class StorageContent
7575

7676
public class StorageAvailability
7777
{
78-
public StorageAvailability(ByteSize totalSpace, TimeSpan maxDuration, TestToken minPriceForTotalSpace, TestToken maxCollateral)
78+
public StorageAvailability(ByteSize totalSpace, TimeSpan maxDuration, TestToken minPricePerBytePerSecond, TestToken totalCollateral)
7979
{
8080
TotalSpace = totalSpace;
8181
MaxDuration = maxDuration;
82-
MinPriceForTotalSpace = minPriceForTotalSpace;
83-
MaxCollateral = maxCollateral;
82+
MinPricePerBytePerSecond = minPricePerBytePerSecond;
83+
TotalCollateral = totalCollateral;
8484
}
8585

8686
public string Id { get; set; } = string.Empty;
8787
public ByteSize TotalSpace { get; }
8888
public TimeSpan MaxDuration { get; }
89-
public TestToken MinPriceForTotalSpace { get; }
90-
public TestToken MaxCollateral { get; }
89+
public TestToken MinPricePerBytePerSecond { get; }
90+
public TestToken TotalCollateral { get; }
9191
public ByteSize FreeSpace { get; set; } = ByteSize.Zero;
9292

9393
public void Log(ILog log)
9494
{
9595
log.Log($"Storage Availability: (" +
9696
$"totalSize: {TotalSpace}, " +
9797
$"maxDuration: {Time.FormatDuration(MaxDuration)}, " +
98-
$"minPriceForTotalSpace: {MinPriceForTotalSpace}, " +
99-
$"maxCollateral: {MaxCollateral})");
98+
$"minPricePerBytePerSecond: {MinPricePerBytePerSecond}, " +
99+
$"totalCollateral: {TotalCollateral})");
100100
}
101101
}
102102
}

0 commit comments

Comments
 (0)