Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- using Neo.SmartContract.Framework;
- using Neo.SmartContract.Framework.Services.Neo;
- namespace CheckFuncContract
- {
- /// <summary>
- /// Multiownable logic.
- /// </summary>
- public static class Multiownable
- {
- /// <summary>
- /// Sha256 by OpCode.
- /// </summary>
- /// <param name="byteArray"></param>
- /// <returns></returns>
- [OpCode(Neo.VM.OpCode.SHA256)]
- public extern static byte[] Sha256(byte[] byteArray);
- /// <summary>
- /// Check accepted by some owners.
- /// </summary>
- /// <param name="originator"></param>
- /// <param name="functionName"></param>
- /// <param name="ownersCount"></param>
- /// <param name="args"></param>
- /// <returns></returns>
- public static Boolean IsAcceptedBySomeOwners(Byte[] originator,
- String functionName, BigInteger ownersCount, params Object[] args)
- {
- // Convert and concat.
- byte[] mainArray = functionName.AsByteArray().Concat(ownersCount.AsByteArray());
- for (int i = 0; i < args.Length; i++)
- mainArray.Concat((byte[])args[0]);
- // Get Sha256.
- byte[] shaMainArray = Sha256(mainArray);
- // Check timeout.
- var timeout = Storage.Get(Storage.CurrentContext, mainArray.Concat("timeout".AsByteArray()));
- uint curDate = Runtime.Time;
- if (curDate > (uint)timeout.AsBigInteger())
- {
- Runtime.Log("Overdue.");
- return false;
- }
- // TODO : Check all votes and return true or false.
- for (int i = 0; i < ownersCount; i++)
- {
- }
- return false;
- }
- /// <summary>
- /// Return owner count.
- /// </summary>
- /// <returns></returns>
- public static BigInteger GetOwnerCount()
- {
- // TODO : Get owner count.
- return 0;
- }
- /// <summary>
- /// Return index by owner.
- /// </summary>
- /// <param name="owner"></param>
- /// <returns></returns>
- public static Byte GetIndexByOwner(Byte[] owner)
- {
- // TODO : Get index by owner.
- return 0;
- }
- /// <summary>
- /// Return owner by index.
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- public static Byte[] GetOwnerByIndex(Byte index)
- {
- // TODO : Get owner by index.
- return new byte[] { };
- }
- /// <summary>
- /// Set new owners.
- /// </summary>
- /// <param name="newOwners"></param>
- /// <returns></returns>
- public static Boolean TransferOwnership(params Object[] newOwners)
- {
- // TODO : TransferOwnership.
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement