Skip to content

Commit

Permalink
New SafeExec contract handler and extension of services / Gnosis safe…
Browse files Browse the repository at this point in the history
… interface upgrade / abi
  • Loading branch information
juanfranblanco committed Dec 29, 2024
1 parent 66da017 commit 255b574
Show file tree
Hide file tree
Showing 6 changed files with 1,518 additions and 1,352 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public class EncodeTransactionDataFunctionBase : FunctionMessage
[Parameter("address", "to", 1)]
public virtual string To { get; set; }

[Parameter("uint256", "value", 2)] public virtual BigInteger Value { get; set; } = 0;
[Parameter("uint256", "value", 2)]
public virtual BigInteger Value { get; set; } = 0;
[Parameter("bytes", "data", 3)]
public virtual byte[] Data { get; set; }

Expand Down
108 changes: 42 additions & 66 deletions src/Nethereum.GnosisSafe/ContractDefinition/GnosisSafeDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,10 @@ namespace Nethereum.GnosisSafe.ContractDefinition
{


public partial class GnosisSafeDeployment : GnosisSafeDeploymentBase
{
public GnosisSafeDeployment() : base(BYTECODE) { }
public GnosisSafeDeployment(string byteCode) : base(byteCode) { }
}

public class GnosisSafeDeploymentBase : ContractDeploymentMessage
{
public static string BYTECODE = "0x";
public GnosisSafeDeploymentBase() : base(BYTECODE) { }
public GnosisSafeDeploymentBase(string byteCode) : base(byteCode) { }

}

public partial class VERSIONFunction : VERSIONFunctionBase { }
public partial class VersionFunction : VersionFunctionBase { }

[Function("VERSION", "string")]
public class VERSIONFunctionBase : FunctionMessage
public class VersionFunctionBase : FunctionMessage
{

}
Expand Down Expand Up @@ -104,7 +90,7 @@ public class EnableModuleFunctionBase : FunctionMessage
public virtual string Module { get; set; }
}



public partial class ExecTransactionFunction : ExecTransactionFunctionBase { }

Expand Down Expand Up @@ -369,7 +355,7 @@ public partial class AddedOwnerEventDTO : AddedOwnerEventDTOBase { }
[Event("AddedOwner")]
public class AddedOwnerEventDTOBase : IEventDTO
{
[Parameter("address", "owner", 1, false )]
[Parameter("address", "owner", 1, false)]
public virtual string Owner { get; set; }
}

Expand All @@ -378,9 +364,9 @@ public partial class ApproveHashEventDTO : ApproveHashEventDTOBase { }
[Event("ApproveHash")]
public class ApproveHashEventDTOBase : IEventDTO
{
[Parameter("bytes32", "approvedHash", 1, true )]
[Parameter("bytes32", "approvedHash", 1, true)]
public virtual byte[] ApprovedHash { get; set; }
[Parameter("address", "owner", 2, true )]
[Parameter("address", "owner", 2, true)]
public virtual string Owner { get; set; }
}

Expand All @@ -389,7 +375,7 @@ public partial class ChangedFallbackHandlerEventDTO : ChangedFallbackHandlerEven
[Event("ChangedFallbackHandler")]
public class ChangedFallbackHandlerEventDTOBase : IEventDTO
{
[Parameter("address", "handler", 1, false )]
[Parameter("address", "handler", 1, false)]
public virtual string Handler { get; set; }
}

Expand All @@ -398,7 +384,7 @@ public partial class ChangedGuardEventDTO : ChangedGuardEventDTOBase { }
[Event("ChangedGuard")]
public class ChangedGuardEventDTOBase : IEventDTO
{
[Parameter("address", "guard", 1, false )]
[Parameter("address", "guard", 1, false)]
public virtual string Guard { get; set; }
}

Expand All @@ -407,7 +393,7 @@ public partial class ChangedThresholdEventDTO : ChangedThresholdEventDTOBase { }
[Event("ChangedThreshold")]
public class ChangedThresholdEventDTOBase : IEventDTO
{
[Parameter("uint256", "threshold", 1, false )]
[Parameter("uint256", "threshold", 1, false)]
public virtual BigInteger Threshold { get; set; }
}

Expand All @@ -416,7 +402,7 @@ public partial class DisabledModuleEventDTO : DisabledModuleEventDTOBase { }
[Event("DisabledModule")]
public class DisabledModuleEventDTOBase : IEventDTO
{
[Parameter("address", "module", 1, false )]
[Parameter("address", "module", 1, false)]
public virtual string Module { get; set; }
}

Expand All @@ -425,7 +411,7 @@ public partial class EnabledModuleEventDTO : EnabledModuleEventDTOBase { }
[Event("EnabledModule")]
public class EnabledModuleEventDTOBase : IEventDTO
{
[Parameter("address", "module", 1, false )]
[Parameter("address", "module", 1, false)]
public virtual string Module { get; set; }
}

Expand All @@ -434,9 +420,9 @@ public partial class ExecutionFailureEventDTO : ExecutionFailureEventDTOBase { }
[Event("ExecutionFailure")]
public class ExecutionFailureEventDTOBase : IEventDTO
{
[Parameter("bytes32", "txHash", 1, false )]
[Parameter("bytes32", "txHash", 1, false)]
public virtual byte[] TxHash { get; set; }
[Parameter("uint256", "payment", 2, false )]
[Parameter("uint256", "payment", 2, false)]
public virtual BigInteger Payment { get; set; }
}

Expand All @@ -445,7 +431,7 @@ public partial class ExecutionFromModuleFailureEventDTO : ExecutionFromModuleFai
[Event("ExecutionFromModuleFailure")]
public class ExecutionFromModuleFailureEventDTOBase : IEventDTO
{
[Parameter("address", "module", 1, true )]
[Parameter("address", "module", 1, true)]
public virtual string Module { get; set; }
}

Expand All @@ -454,7 +440,7 @@ public partial class ExecutionFromModuleSuccessEventDTO : ExecutionFromModuleSuc
[Event("ExecutionFromModuleSuccess")]
public class ExecutionFromModuleSuccessEventDTOBase : IEventDTO
{
[Parameter("address", "module", 1, true )]
[Parameter("address", "module", 1, true)]
public virtual string Module { get; set; }
}

Expand All @@ -463,9 +449,9 @@ public partial class ExecutionSuccessEventDTO : ExecutionSuccessEventDTOBase { }
[Event("ExecutionSuccess")]
public class ExecutionSuccessEventDTOBase : IEventDTO
{
[Parameter("bytes32", "txHash", 1, false )]
[Parameter("bytes32", "txHash", 1, false)]
public virtual byte[] TxHash { get; set; }
[Parameter("uint256", "payment", 2, false )]
[Parameter("uint256", "payment", 2, false)]
public virtual BigInteger Payment { get; set; }
}

Expand All @@ -474,7 +460,7 @@ public partial class RemovedOwnerEventDTO : RemovedOwnerEventDTOBase { }
[Event("RemovedOwner")]
public class RemovedOwnerEventDTOBase : IEventDTO
{
[Parameter("address", "owner", 1, false )]
[Parameter("address", "owner", 1, false)]
public virtual string Owner { get; set; }
}

Expand All @@ -483,9 +469,9 @@ public partial class SafeReceivedEventDTO : SafeReceivedEventDTOBase { }
[Event("SafeReceived")]
public class SafeReceivedEventDTOBase : IEventDTO
{
[Parameter("address", "sender", 1, true )]
[Parameter("address", "sender", 1, true)]
public virtual string Sender { get; set; }
[Parameter("uint256", "value", 2, false )]
[Parameter("uint256", "value", 2, false)]
public virtual BigInteger Value { get; set; }
}

Expand All @@ -494,15 +480,15 @@ public partial class SafeSetupEventDTO : SafeSetupEventDTOBase { }
[Event("SafeSetup")]
public class SafeSetupEventDTOBase : IEventDTO
{
[Parameter("address", "initiator", 1, true )]
[Parameter("address", "initiator", 1, true)]
public virtual string Initiator { get; set; }
[Parameter("address[]", "owners", 2, false )]
[Parameter("address[]", "owners", 2, false)]
public virtual List<string> Owners { get; set; }
[Parameter("uint256", "threshold", 3, false )]
[Parameter("uint256", "threshold", 3, false)]
public virtual BigInteger Threshold { get; set; }
[Parameter("address", "initializer", 4, false )]
[Parameter("address", "initializer", 4, false)]
public virtual string Initializer { get; set; }
[Parameter("address", "fallbackHandler", 5, false )]
[Parameter("address", "fallbackHandler", 5, false)]
public virtual string FallbackHandler { get; set; }
}

Expand All @@ -511,14 +497,14 @@ public partial class SignMsgEventDTO : SignMsgEventDTOBase { }
[Event("SignMsg")]
public class SignMsgEventDTOBase : IEventDTO
{
[Parameter("bytes32", "msgHash", 1, true )]
[Parameter("bytes32", "msgHash", 1, true)]
public virtual byte[] MsgHash { get; set; }
}

public partial class VERSIONOutputDTO : VERSIONOutputDTOBase { }
public partial class VersionOutputDTO : VersionOutputDTOBase { }

[FunctionOutput]
public class VERSIONOutputDTOBase : IFunctionOutputDTO
public class VersionOutputDTOBase : IFunctionOutputDTO
{
[Parameter("string", "", 1)]
public virtual string ReturnValue1 { get; set; }
Expand All @@ -531,7 +517,7 @@ public class VERSIONOutputDTOBase : IFunctionOutputDTO
public partial class ApprovedHashesOutputDTO : ApprovedHashesOutputDTOBase { }

[FunctionOutput]
public class ApprovedHashesOutputDTOBase : IFunctionOutputDTO
public class ApprovedHashesOutputDTOBase : IFunctionOutputDTO
{
[Parameter("uint256", "", 1)]
public virtual BigInteger ReturnValue1 { get; set; }
Expand All @@ -544,7 +530,7 @@ public class ApprovedHashesOutputDTOBase : IFunctionOutputDTO
public partial class DomainSeparatorOutputDTO : DomainSeparatorOutputDTOBase { }

[FunctionOutput]
public class DomainSeparatorOutputDTOBase : IFunctionOutputDTO
public class DomainSeparatorOutputDTOBase : IFunctionOutputDTO
{
[Parameter("bytes32", "", 1)]
public virtual byte[] ReturnValue1 { get; set; }
Expand All @@ -555,7 +541,7 @@ public class DomainSeparatorOutputDTOBase : IFunctionOutputDTO
public partial class EncodeTransactionDataOutputDTO : EncodeTransactionDataOutputDTOBase { }

[FunctionOutput]
public class EncodeTransactionDataOutputDTOBase : IFunctionOutputDTO
public class EncodeTransactionDataOutputDTOBase : IFunctionOutputDTO
{
[Parameter("bytes", "", 1)]
public virtual byte[] ReturnValue1 { get; set; }
Expand All @@ -568,7 +554,7 @@ public class EncodeTransactionDataOutputDTOBase : IFunctionOutputDTO
public partial class ExecTransactionFromModuleReturnDataOutputDTO : ExecTransactionFromModuleReturnDataOutputDTOBase { }

[FunctionOutput]
public class ExecTransactionFromModuleReturnDataOutputDTOBase : IFunctionOutputDTO
public class ExecTransactionFromModuleReturnDataOutputDTOBase : IFunctionOutputDTO
{
[Parameter("bool", "success", 1)]
public virtual bool Success { get; set; }
Expand All @@ -579,7 +565,7 @@ public class ExecTransactionFromModuleReturnDataOutputDTOBase : IFunctionOutputD
public partial class GetChainIdOutputDTO : GetChainIdOutputDTOBase { }

[FunctionOutput]
public class GetChainIdOutputDTOBase : IFunctionOutputDTO
public class GetChainIdOutputDTOBase : IFunctionOutputDTO
{
[Parameter("uint256", "", 1)]
public virtual BigInteger ReturnValue1 { get; set; }
Expand All @@ -588,7 +574,7 @@ public class GetChainIdOutputDTOBase : IFunctionOutputDTO
public partial class GetModulesPaginatedOutputDTO : GetModulesPaginatedOutputDTOBase { }

[FunctionOutput]
public class GetModulesPaginatedOutputDTOBase : IFunctionOutputDTO
public class GetModulesPaginatedOutputDTOBase : IFunctionOutputDTO
{
[Parameter("address[]", "array", 1)]
public virtual List<string> Array { get; set; }
Expand All @@ -599,7 +585,7 @@ public class GetModulesPaginatedOutputDTOBase : IFunctionOutputDTO
public partial class GetOwnersOutputDTO : GetOwnersOutputDTOBase { }

[FunctionOutput]
public class GetOwnersOutputDTOBase : IFunctionOutputDTO
public class GetOwnersOutputDTOBase : IFunctionOutputDTO
{
[Parameter("address[]", "", 1)]
public virtual List<string> ReturnValue1 { get; set; }
Expand All @@ -608,7 +594,7 @@ public class GetOwnersOutputDTOBase : IFunctionOutputDTO
public partial class GetStorageAtOutputDTO : GetStorageAtOutputDTOBase { }

[FunctionOutput]
public class GetStorageAtOutputDTOBase : IFunctionOutputDTO
public class GetStorageAtOutputDTOBase : IFunctionOutputDTO
{
[Parameter("bytes", "", 1)]
public virtual byte[] ReturnValue1 { get; set; }
Expand All @@ -617,7 +603,7 @@ public class GetStorageAtOutputDTOBase : IFunctionOutputDTO
public partial class GetThresholdOutputDTO : GetThresholdOutputDTOBase { }

[FunctionOutput]
public class GetThresholdOutputDTOBase : IFunctionOutputDTO
public class GetThresholdOutputDTOBase : IFunctionOutputDTO
{
[Parameter("uint256", "", 1)]
public virtual BigInteger ReturnValue1 { get; set; }
Expand All @@ -626,7 +612,7 @@ public class GetThresholdOutputDTOBase : IFunctionOutputDTO
public partial class GetTransactionHashOutputDTO : GetTransactionHashOutputDTOBase { }

[FunctionOutput]
public class GetTransactionHashOutputDTOBase : IFunctionOutputDTO
public class GetTransactionHashOutputDTOBase : IFunctionOutputDTO
{
[Parameter("bytes32", "", 1)]
public virtual byte[] ReturnValue1 { get; set; }
Expand All @@ -635,7 +621,7 @@ public class GetTransactionHashOutputDTOBase : IFunctionOutputDTO
public partial class IsModuleEnabledOutputDTO : IsModuleEnabledOutputDTOBase { }

[FunctionOutput]
public class IsModuleEnabledOutputDTOBase : IFunctionOutputDTO
public class IsModuleEnabledOutputDTOBase : IFunctionOutputDTO
{
[Parameter("bool", "", 1)]
public virtual bool ReturnValue1 { get; set; }
Expand All @@ -644,7 +630,7 @@ public class IsModuleEnabledOutputDTOBase : IFunctionOutputDTO
public partial class IsOwnerOutputDTO : IsOwnerOutputDTOBase { }

[FunctionOutput]
public class IsOwnerOutputDTOBase : IFunctionOutputDTO
public class IsOwnerOutputDTOBase : IFunctionOutputDTO
{
[Parameter("bool", "", 1)]
public virtual bool ReturnValue1 { get; set; }
Expand All @@ -653,32 +639,22 @@ public class IsOwnerOutputDTOBase : IFunctionOutputDTO
public partial class NonceOutputDTO : NonceOutputDTOBase { }

[FunctionOutput]
public class NonceOutputDTOBase : IFunctionOutputDTO
public class NonceOutputDTOBase : IFunctionOutputDTO
{
[Parameter("uint256", "", 1)]
public virtual BigInteger ReturnValue1 { get; set; }
}











public partial class SignedMessagesOutputDTO : SignedMessagesOutputDTOBase { }

[FunctionOutput]
public class SignedMessagesOutputDTOBase : IFunctionOutputDTO
public class SignedMessagesOutputDTOBase : IFunctionOutputDTO
{
[Parameter("uint256", "", 1)]
public virtual BigInteger ReturnValue1 { get; set; }
}




}
13 changes: 2 additions & 11 deletions src/Nethereum.GnosisSafe/ExtendedGnosisSafeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,19 @@
using Nethereum.Signer;
using Nethereum.Signer.EIP712;
using Nethereum.RLP;
using Nethereum.Web3;


namespace Nethereum.GnosisSafe
{
public partial class GnosisSafeService
public partial class GnosisSafeService:ContractWeb3ServiceBase
{
public class SafeSignature
{
public string Address { get; set; }
public string Signature { get; set; }
}

public Task<string> VersionQueryAsync(VERSIONFunction versionFunction, BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<VERSIONFunction, string>(versionFunction, blockParameter);
}

public Task<string> VersionQueryAsync(BlockParameter blockParameter = null)
{
return ContractHandler.QueryAsync<VERSIONFunction, string>(null, blockParameter);
}

public async Task<ExecTransactionFunction> BuildTransactionAsync(
EncodeTransactionDataFunction transactionData,
BigInteger chainId,
Expand Down
Loading

0 comments on commit 255b574

Please sign in to comment.