Skip to content

Commit 900eaad

Browse files
added protocol erc1400
1 parent 8c58d11 commit 900eaad

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

web3swift.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@
210210
E228BED021A4C89F0085268C /* Web3Legacy+Eth.swift in Sources */ = {isa = PBXBuildFile; fileRef = E228BEC921A4C89E0085268C /* Web3Legacy+Eth.swift */; };
211211
E228BED121A4C89F0085268C /* Web3Legacy+Instance.swift in Sources */ = {isa = PBXBuildFile; fileRef = E228BECA21A4C89F0085268C /* Web3Legacy+Instance.swift */; };
212212
E228BED221A4C89F0085268C /* Web3Legacy+Instance.swift in Sources */ = {isa = PBXBuildFile; fileRef = E228BECA21A4C89F0085268C /* Web3Legacy+Instance.swift */; };
213+
E279C9EC21C316D90081695F /* Web3+ERC1400.swift in Sources */ = {isa = PBXBuildFile; fileRef = E279C9EB21C316D90081695F /* Web3+ERC1400.swift */; };
213214
E2DCA653218C875100F94FBA /* web3swift_ENS_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81A7B2782143C978004CD2C7 /* web3swift_ENS_Tests.swift */; };
214215
E2DCA654218C879900F94FBA /* ENS.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2E668CD214F8A7B00C3CC2D /* ENS.swift */; };
215216
E2DCA655218C879900F94FBA /* ENSResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B219DC162154F3EE0035BF94 /* ENSResolver.swift */; };
@@ -390,6 +391,7 @@
390391
E23B5ADC20EA685D00DC7F32 /* web3swift_EIP67_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = web3swift_EIP67_Tests.swift; sourceTree = "<group>"; };
391392
E23B5AE020EA695400DC7F32 /* web3swift_rinkeby_personalSignature_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = web3swift_rinkeby_personalSignature_Tests.swift; sourceTree = "<group>"; };
392393
E23B5AE220EA69B900DC7F32 /* web3swift_numberFormattingUtil_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = web3swift_numberFormattingUtil_Tests.swift; sourceTree = "<group>"; };
394+
E279C9EB21C316D90081695F /* Web3+ERC1400.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+ERC1400.swift"; sourceTree = "<group>"; };
393395
E2C590752152835400FF53D3 /* JSONRPCrequestDispatcher+ObjC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "JSONRPCrequestDispatcher+ObjC.swift"; sourceTree = "<group>"; };
394396
E2E94C5F217788E0005F54A0 /* Web3+ERC721.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+ERC721.swift"; sourceTree = "<group>"; };
395397
FB43EC035C593F9E5A3644B6 /* Pods-web3swift-macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-web3swift-macOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-web3swift-macOS/Pods-web3swift-macOS.debug.xcconfig"; sourceTree = "<group>"; };
@@ -610,6 +612,7 @@
610612
8159C50921343EF900197B91 /* PrecompiledContracts */ = {
611613
isa = PBXGroup;
612614
children = (
615+
E279C9EA21C316BE0081695F /* ERC1400 */,
613616
E2E94C5E2177886C005F54A0 /* ERC721 */,
614617
8159C50621343ED300197B91 /* ERC20 */,
615618
);
@@ -945,6 +948,14 @@
945948
path = Classes;
946949
sourceTree = "<group>";
947950
};
951+
E279C9EA21C316BE0081695F /* ERC1400 */ = {
952+
isa = PBXGroup;
953+
children = (
954+
E279C9EB21C316D90081695F /* Web3+ERC1400.swift */,
955+
);
956+
path = ERC1400;
957+
sourceTree = "<group>";
958+
};
948959
E2E94C5E2177886C005F54A0 /* ERC721 */ = {
949960
isa = PBXGroup;
950961
children = (
@@ -1227,6 +1238,7 @@
12271238
81C0FCF720441A1D00D82FAF /* TransactionSigner.swift in Sources */,
12281239
8125F06920499AC300A0F2FE /* BloomFilter.swift in Sources */,
12291240
810B0F9A1FEC446B00CF0DA2 /* Web3+JSONRPC.swift in Sources */,
1241+
E279C9EC21C316D90081695F /* Web3+ERC1400.swift in Sources */,
12301242
81195AB020D7FF8500ABC6B1 /* Promise+Web3+Contract+GetIndexedEvents.swift in Sources */,
12311243
81EB1E4B208173D7003BD47F /* Web3+Personal.swift in Sources */,
12321244
E228BE7821A4492B0085268C /* Web3Legacy+BrowserFunctions.swift in Sources */,
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// Web3+ERC1400.swift
3+
// web3swift-iOS
4+
//
5+
// Created by Anton Grigorev on 14/12/2018.
6+
// Copyright © 2018 The Matter Inc. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import BigInt
11+
import EthereumAddress
12+
import PromiseKit
13+
14+
// ERC1400 = ERC20 + IERC1400
15+
protocol IERC1400 {
16+
17+
// Document Management
18+
func getDocument(name: Data) throws -> (String, Data)
19+
func setDocument(name: Data, uri: String, documentHash: Data) throws -> WriteTransaction
20+
21+
// Token Information
22+
func balanceOfByPartition(partition: Data, tokenHolder: EthereumAddress) throws -> BigUInt
23+
func partitionsOf(tokenHolder: EthereumAddress) throws -> [Data]
24+
25+
// Transfers
26+
func transferWithData(from: EthereumAddress, to: EthereumAddress, amount: String, data: [UInt8]) throws -> WriteTransaction
27+
func transferFromWithData(from: EthereumAddress, to: EthereumAddress, originalOwner: EthereumAddress, amount: String, data: [UInt8]) throws -> WriteTransaction
28+
29+
// Partition Token Transfers
30+
func transferByPartition(partition: Data, from: EthereumAddress, to: EthereumAddress, amount: String, data: [UInt8]) throws -> WriteTransaction
31+
func operatorTransferByPartition(partition: Data, from: EthereumAddress, to: EthereumAddress, originalOwner: EthereumAddress, amount: String, data: [UInt8]) throws -> WriteTransaction
32+
33+
// Controller Operation
34+
func isControllable() throws -> Bool
35+
func controllerTransfer(from: EthereumAddress, to: EthereumAddress, originalOwner: EthereumAddress, amount: String, data: [UInt8], operatorData: [UInt8]) throws -> WriteTransaction
36+
func controllerRedeem(from: EthereumAddress, to: EthereumAddress, amount: String, data: [UInt8], operatorData: [UInt8]) throws -> WriteTransaction
37+
38+
// Operator Management
39+
func authorizeOperator(operator: EthereumAddress) throws -> WriteTransaction
40+
func revokeOperator(operator: EthereumAddress) throws -> WriteTransaction
41+
func authorizeOperatorByPartition(partition: Data, operator: EthereumAddress) throws -> WriteTransaction
42+
func revokeOperatorByPartition(partition: Data, operator: EthereumAddress) throws -> WriteTransaction
43+
44+
// Operator Information
45+
func isOperator(operator: EthereumAddress, tokenHolder: EthereumAddress) throws -> Bool
46+
func isOperatorForPartition(partition: Data, operator: EthereumAddress, tokenHolder: EthereumAddress) throws -> Bool
47+
48+
// Token Issuance
49+
func isIssuable() throws -> Bool
50+
func issue(from: EthereumAddress, tokenHolder: EthereumAddress, amount: String, data: [UInt8]) -> WriteTransaction
51+
func issueByPartition(partition: Data, from: EthereumAddress, tokenHolder: EthereumAddress, amount: String, data: [UInt8]) -> WriteTransaction
52+
53+
// Token Redemption
54+
func redeem(from: EthereumAddress, amount: String, data: [UInt8]) throws -> WriteTransaction
55+
func redeemFrom(tokenHolder: EthereumAddress, from: EthereumAddress, amount: String, data: [UInt8]) throws -> WriteTransaction
56+
func redeemByPartition(partition: Data, from: EthereumAddress, amount: String, data: [UInt8]) throws -> WriteTransaction
57+
func operatorRedeemByPartition(partition: Data, tokenHolder: EthereumAddress, from: EthereumAddress, amount: String, operatorData: [UInt8]) throws -> WriteTransaction
58+
59+
// Transfer Validity
60+
func canTransfer(to: EthereumAddress, amount: String, data: [UInt8]) throws -> ([UInt8], Data)
61+
func canTransferFrom(originalOwner: EthereumAddress, to: EthereumAddress, amount: String, data: [UInt8]) throws -> ([UInt8], Data)
62+
func canTransferByPartition(originalOwner: EthereumAddress, to: EthereumAddress, partition: Data, amount: String, data: [UInt8]) throws -> ([UInt8], Data, Data)
63+
}
64+
65+
// This namespace contains functions to work with ERC1400 tokens.
66+
// variables are lazyly evaluated or global token information (name, ticker, total supply)
67+
// can be imperatively read and saved

0 commit comments

Comments
 (0)