Skip to content

Commit

Permalink
Merge pull request #225 from 0xsequence/Fix/contract-wrappers-compiler
Browse files Browse the repository at this point in the history
Fixed ABIElement and GetStringField compiler issues
  • Loading branch information
caballoninja authored Oct 30, 2024
2 parents f7d5174 + b4da9bf commit 2751e65
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 70 deletions.
6 changes: 3 additions & 3 deletions Plugins/SequencePlugin/SequencePlugin.uplugin
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"EngineVersion":"5.4",
"EngineVersion": "5.4",
"FileVersion": 3,
"Version": 3,
"VersionName": "1.3",
"VersionName": "1.4.0",
"FriendlyName": "SequencePlugin",
"Description": "",
"Category": "Sequence",
Expand All @@ -26,7 +26,7 @@
"Name": "SequencePlugin",
"Type": "Runtime",
"LoadingPhase": "Default",
"WhitelistPlatforms": [
"PlatformAllowList": [
"Mac",
"Win64",
"Android",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "ABI/ABI.h"
#include "ABI/ABIElement.h"
#include "Eth/Crypto.h"
#include "Internationalization/Regex.h"
#include "Types/BinaryData.h"

TFixedABIData ABI::UInt32(uint32 Input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "../../Public/Sequence/SequenceWalletQrCode.h"

#include "ObjectHandler.h"
#include "Misc/Base64.h"
#include "Util/Log.h"
#include "Sequence/SequenceAPI.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FRawTransaction UERC1155::MakeGrantRoleTransaction(const FString& role, const FS

TFixedABIData ABIAccount = ABI::Address(WalletAddressBytes);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;

Arr.Add(&ABIProof);
Arr.Add(&ABIAccount);
Expand All @@ -55,8 +55,7 @@ FRawTransaction UERC1155::MakeSetApprovalForAllTransaction(const FString& Oppera
TFixedABIData ABIAccount = ABI::Address(WalletAddressBytes);
TFixedABIData ABIApproval = ABI::Bool(Approved);


TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAccount);
Arr.Add(&ABIApproval);

Expand Down Expand Up @@ -84,7 +83,7 @@ FRawTransaction UERC1155::MakeMintTransaction(const FString& ToAddress, const in
TFixedABIData ABIAmount = ABI::Int32(Amount);
TDynamicABIData ABIData = ABI::String(Data);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAccount);
Arr.Add(&ABITokenId);
Arr.Add(&ABIAmount);
Expand All @@ -110,23 +109,25 @@ FRawTransaction UERC1155::MakeBatchMintTransaction(const FString& ToAddress, con

TFixedABIData ABIAccount = ABI::Address(WalletAddressBytes);

TArray<ABIEncodeable*> TokenIdsArray;
TArray<TSharedPtr<ABIElement>> TokenIdsArray;
for (uint32 TokenId : TokenIds)
{
TokenIdsArray.Add(new TFixedABIData(ABI::Int32(TokenId)));
const TFixedABIData* TokenIdData = new TFixedABIData(ABI::Int32(TokenId));
TokenIdsArray.Add(MakeShared<TFixedABIData>(*TokenIdData));
}
TDynamicABIArray ABIArrayTokenIds(TokenIdsArray);

TArray<ABIEncodeable*> AmountsArray;
TArray<TSharedPtr<ABIElement>> AmountsArray;
for (uint32 Amount : Amounts)
{
AmountsArray.Add(new TFixedABIData(ABI::Int32(Amount)));
const TFixedABIData* AmountData = new TFixedABIData(ABI::Int32(Amount));
AmountsArray.Add(MakeShared<TFixedABIData>(*AmountData));
}

TDynamicABIArray ABIArrayAmounts(AmountsArray);

TDynamicABIData ABIData = ABI::String(Data);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAccount);
Arr.Add(&ABIArrayTokenIds);
Arr.Add(&ABIArrayAmounts);
Expand All @@ -150,7 +151,7 @@ FRawTransaction UERC1155::MakeBurnTransaction(int32 TokenId, int32 Amount)

TFixedABIData ABIFixedAmount = ABI::Int32(Amount);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;

Arr.Add(&ABITokenId);
Arr.Add(&ABIFixedAmount);
Expand All @@ -169,21 +170,23 @@ FRawTransaction UERC1155::MakeBatchBurnTransaction(const TArray<int32>& TokenIds
{
FString FunctionSignature = "burn(uint256[],uint256[])";

TArray<ABIEncodeable*> TokenIdsArray;
TArray<TSharedPtr<ABIElement>> TokenIdsArray;
for (uint32 TokenId : TokenIds)
{
TokenIdsArray.Add(new TFixedABIData(ABI::Int32(TokenId)));
const TFixedABIData* TokenIdData = new TFixedABIData(ABI::Int32(TokenId));
TokenIdsArray.Add(MakeShared<TFixedABIData>(*TokenIdData));
}
TDynamicABIArray ABIArrayTokenIds(TokenIdsArray);

TArray<ABIEncodeable*> AmountsArray;
TArray<TSharedPtr<ABIElement>> AmountsArray;
for (uint32 Amount : Amounts)
{
AmountsArray.Add(new TFixedABIData(ABI::Int32(Amount)));
const TFixedABIData* AmountData = new TFixedABIData(ABI::Int32(Amount));
AmountsArray.Add(MakeShared<TFixedABIData>(*AmountData));
}
TDynamicABIArray ABIArrayAmounts(AmountsArray);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIArrayTokenIds);
Arr.Add(&ABIArrayAmounts);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,31 @@ FRawTransaction UERC1155SaleContract::MakePurchaseTransaction(const FString& ToA

TFixedABIData ABIAccount = ABI::Address(WalletAddressBytes);

TArray<ABIEncodeable*> TokenIdsArray;
TArray<TSharedPtr<ABIElement>> TokenIdsArray;
for (uint32 TokenId : TokenIds)
{
TokenIdsArray.Add(new TFixedABIData(ABI::Int32(TokenId)));
const TFixedABIData* TokenIdData = new TFixedABIData(ABI::Int32(TokenId));
TokenIdsArray.Add(MakeShared<TFixedABIData>(*TokenIdData));
}
TDynamicABIArray ABIArrayTokenIds(TokenIdsArray);

TArray<ABIEncodeable*> AmountsArray;
TArray<TSharedPtr<ABIElement>> AmountsArray;
for (uint32 Amount : Amounts)
{
AmountsArray.Add(new TFixedABIData(ABI::Int32(Amount)));
const TFixedABIData* AmountData = new TFixedABIData(ABI::Int32(Amount));
AmountsArray.Add(MakeShared<TFixedABIData>(*AmountData));
}
TDynamicABIArray ABIArrayAmounts(AmountsArray);

TArray<ABIEncodeable*> ProofArray;
TArray<TSharedPtr<ABIElement>> ProofArray;
for (const FString& ProofEntry : Proof)
{
TArray<uint8> ProofBytes;
ProofBytes.SetNumUninitialized(32);
FMemory::Memcpy(ProofBytes.GetData(), TCHAR_TO_UTF8(*ProofEntry), FMath::Min(ProofEntry.Len(), 32));
ProofArray.Add(new TFixedABIData(ProofBytes));

const TFixedABIData* ProofData = new TFixedABIData(ProofBytes);
ProofArray.Add(MakeShared<TFixedABIData>(*ProofData));
}
TDynamicABIArray ABIArrayProof(ProofArray);

Expand All @@ -52,7 +56,7 @@ FRawTransaction UERC1155SaleContract::MakePurchaseTransaction(const FString& ToA
TFixedABIData ABIAmount = ABI::UInt32(MaxTotal);


TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAccount);
Arr.Add(&ABIArrayTokenIds);
Arr.Add(&ABIArrayAmounts);
Expand All @@ -74,7 +78,7 @@ FRawTransaction UERC1155SaleContract::MakePurchaseTransaction(const FString& ToA
FContractCall UERC1155SaleContract::GetPaymentToken()
{
FString FunctionSignature = "paymentToken()";
TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
FUnsizedData EncodedData = ABI::Encode(FunctionSignature, Arr);

FContractCall CallData;
Expand All @@ -87,7 +91,7 @@ FContractCall UERC1155SaleContract::GetPaymentToken()
FContractCall UERC1155SaleContract::GetGlobalSaleDetails()
{
FString FunctionSignature = "globalSaleDetails()";
TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
FUnsizedData EncodedData = ABI::Encode(FunctionSignature, Arr);

FContractCall CallData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ FRawTransaction UERC20::MakeGrantRoleTransaction(const FString& role,const FStri

TFixedABIData ABIAccount = ABI::Address(WalletAddressBytes);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;

Arr.Add(&ABIProof);
Arr.Add(&ABIAccount);
Expand Down Expand Up @@ -56,7 +56,7 @@ FRawTransaction UERC20::MakeApproveTransaction(const FString& Spender, const int

TFixedABIData ABITokenId = ABI::Int32(Amount);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAccount);
Arr.Add(&ABITokenId);

Expand All @@ -82,7 +82,7 @@ FRawTransaction UERC20::MakeMintTransaction(const FString& ToAddress, const int3

TFixedABIData ABIAmount = ABI::Int32(Amount);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAccount);
Arr.Add(&ABIAmount);

Expand All @@ -103,7 +103,7 @@ FRawTransaction UERC20::MakeBurnTransaction(const int32 Amount)

TFixedABIData ABIAmount = ABI::Int32(Amount);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAmount);

FUnsizedData EncodedData = ABI::Encode(FunctionSignature, Arr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ FRawTransaction UERC721::MakeGrantRoleTransaction(const FString& role, const FSt

TFixedABIData ABIAccount = ABI::Address(WalletAddressBytes);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;

Arr.Add(&ABIProof);
Arr.Add(&ABIAccount);
Expand All @@ -55,7 +55,7 @@ FRawTransaction UERC721::MakeApproveTransaction(const FString& ToAddress, const

TFixedABIData ABITokenId = ABI::Int32(TokenId);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAccount);
Arr.Add(&ABITokenId);

Expand All @@ -81,7 +81,7 @@ FRawTransaction UERC721::MakeMintTransaction(const FString& ToAddress, const int

TFixedABIData ABITokenId = ABI::Int32(TokenId);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAccount);
Arr.Add(&ABITokenId);

Expand All @@ -101,7 +101,7 @@ FRawTransaction UERC721::MakeBurnTransaction(const int32 TokenId)

TFixedABIData ABITokenId = ABI::Int32(TokenId);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABITokenId);

FUnsizedData EncodedData = ABI::Encode(FunctionSignature, Arr);
Expand All @@ -119,14 +119,15 @@ FRawTransaction UERC721::MakeBatchBurnTransaction(const TArray<int32>& TokenIds)
{
FString FunctionSignature = "burn(uint256[])";

TArray<ABIEncodeable*> TokenIdsArray;
TArray<TSharedPtr<ABIElement>> TokenIdsArray;
for (uint32 TokenId : TokenIds)
{
TokenIdsArray.Add(new TFixedABIData(ABI::Int32(TokenId)));
const TFixedABIData* TokenIdData = new TFixedABIData(ABI::Int32(TokenId));
TokenIdsArray.Add(MakeShared<TFixedABIData>(*TokenIdData));
}
TDynamicABIArray ABIArrayTokenIds(TokenIdsArray);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIArrayTokenIds);

FUnsizedData EncodedData = ABI::Encode(FunctionSignature, Arr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@ FRawTransaction UERC721SaleContract::MakePurchaseTransaction(const FString& ToAd

TFixedABIData ABIMaxTotal = ABI::Int32(MaxTotal);

TArray<ABIEncodeable*> ProofArray;
TArray<TSharedPtr<ABIElement>> ProofArray;
for (const FString& ProofEntry : Proof)
{
TArray<uint8> ProofBytes;
ProofBytes.SetNumUninitialized(32);
FMemory::Memcpy(ProofBytes.GetData(), TCHAR_TO_UTF8(*ProofEntry), FMath::Min(ProofEntry.Len(), 32));
ProofArray.Add(new TFixedABIData(ProofBytes));

const TFixedABIData* ProofData = new TFixedABIData(ProofBytes);
ProofArray.Add(MakeShared<TFixedABIData>(*ProofData));
}
TDynamicABIArray ABIArrayProof(ProofArray);

TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
Arr.Add(&ABIAccountTo);
Arr.Add(&ABIAmount);
Arr.Add(&ABIAddressPayment);
Expand All @@ -60,7 +62,7 @@ FRawTransaction UERC721SaleContract::MakePurchaseTransaction(const FString& ToAd
FContractCall UERC721SaleContract::GetSaleDetails()
{
FString FunctionSignature = "saleDetails()";
TArray<ABIEncodeable*> Arr;
TArray<ABIElement*> Arr;
FUnsizedData EncodedData = ABI::Encode(FunctionSignature, Arr);

FContractCall CallData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ struct SEQUENCEPLUGIN_API FSeqOrder

void Setup(FJsonObject& json_in)
{
OrderId = json_in.GetStringField("orderId");
OrderId = json_in.GetStringField(TEXT("orderId"));

if (!json_in.TryGetField(TEXT("marketplace")))
Marketplace = EMarketplaceKind(json_in.GetIntegerField(TEXT("marketplace")));
Expand All @@ -167,25 +167,25 @@ struct SEQUENCEPLUGIN_API FSeqOrder
if (!json_in.TryGetField(TEXT("status")))
Status = EOrderStatus(json_in.GetIntegerField(TEXT("Status")));

ChainId = json_in.GetNumberField("chainId");
CollectionContractAddress = json_in.GetStringField("collectionContractAddress");
TokenId = json_in.GetStringField("tokenId");
CreatedBy = json_in.GetStringField("createdBy");
PriceAmount = json_in.GetStringField("priceAmount");
PriceAmountFormatted = json_in.GetStringField("priceAmountFormatted");
PriceAmountNet = json_in.GetStringField("priceAmountNet");
PriceAmountNetFormatted = json_in.GetStringField("priceAmountNetFormatted");
PriceCurrencyAddress = json_in.GetStringField("priceCurrencyAddress");
PriceDecimals = json_in.GetNumberField("priceDecimals");
PriceUSD = json_in.GetNumberField("priceUSD");
QuantityInitial = json_in.GetStringField("quantityInitial");
QuantityInitialFormatted = json_in.GetStringField("quantityInitialFormatted");
QuantityRemaining = json_in.GetStringField("quantityRemaining");
QuantityRemainingFormatted = json_in.GetStringField("quantityRemainingFormatted");
QuantityAvailable = json_in.GetStringField("quantityAvailable");
QuantityAvailableFormatted = json_in.GetStringField("quantityAvailableFormatted");
QuantityDecimals = json_in.GetNumberField("quantityDecimals");
FeeBps = json_in.GetNumberField("feeBps");
ChainId = json_in.GetNumberField(TEXT("chainId"));
CollectionContractAddress = json_in.GetStringField(TEXT("collectionContractAddress"));
TokenId = json_in.GetStringField(TEXT("tokenId"));
CreatedBy = json_in.GetStringField(TEXT("createdBy"));
PriceAmount = json_in.GetStringField(TEXT("priceAmount"));
PriceAmountFormatted = json_in.GetStringField(TEXT("priceAmountFormatted"));
PriceAmountNet = json_in.GetStringField(TEXT("priceAmountNet"));
PriceAmountNetFormatted = json_in.GetStringField(TEXT("priceAmountNetFormatted"));
PriceCurrencyAddress = json_in.GetStringField(TEXT("priceCurrencyAddress"));
PriceDecimals = json_in.GetNumberField(TEXT("priceDecimals"));
PriceUSD = json_in.GetNumberField(TEXT("priceUSD"));
QuantityInitial = json_in.GetStringField(TEXT("quantityInitial"));
QuantityInitialFormatted = json_in.GetStringField(TEXT("quantityInitialFormatted"));
QuantityRemaining = json_in.GetStringField(TEXT("quantityRemaining"));
QuantityRemainingFormatted = json_in.GetStringField(TEXT("quantityRemainingFormatted"));
QuantityAvailable = json_in.GetStringField(TEXT("quantityAvailable"));
QuantityAvailableFormatted = json_in.GetStringField(TEXT("quantityAvailableFormatted"));
QuantityDecimals = json_in.GetNumberField(TEXT("quantityDecimals"));
FeeBps = json_in.GetNumberField(TEXT("feeBps"));

if (json_in.HasField(TEXT("feeBreakdown")))
{
Expand All @@ -204,12 +204,12 @@ struct SEQUENCEPLUGIN_API FSeqOrder
}
}

ValidFrom = json_in.GetStringField("validFrom");
ValidUntil = json_in.GetStringField("validUntil");
OrderCreatedAt = json_in.GetStringField("orderCreatedAt");
OrderUpdatedAt = json_in.GetStringField("orderUpdatedAt");
CreatedAt = json_in.GetStringField("createdAt");
UpdatedAt = json_in.GetStringField("updatedAt");
DeletedAt = json_in.GetStringField("deletedAt");
ValidFrom = json_in.GetStringField(TEXT("validFrom"));
ValidUntil = json_in.GetStringField(TEXT("validUntil"));
OrderCreatedAt = json_in.GetStringField(TEXT("orderCreatedAt"));
OrderUpdatedAt = json_in.GetStringField(TEXT("orderUpdatedAt"));
CreatedAt = json_in.GetStringField(TEXT("createdAt"));
UpdatedAt = json_in.GetStringField(TEXT("updatedAt"));
DeletedAt = json_in.GetStringField(TEXT("deletedAt"));
}
};

0 comments on commit 2751e65

Please sign in to comment.