├── .gitbook.yaml ├── .soliumignore ├── docs ├── api │ ├── README.md │ ├── functionsigclash1.md │ ├── functionsigclash2.md │ ├── iburn.md │ ├── mockpolyoracle.md │ ├── wallet.md │ ├── istostorage.md │ ├── icheckpoint.md │ ├── iupgradabletokenfactory.md │ ├── address.md │ ├── mockstrgetter.md │ ├── presalestostorage.md │ ├── dummystostorage.md │ ├── statuscodes.md │ ├── cappedstostorage.md │ ├── mockstgetter.md │ ├── moduleregistryproxy.md │ ├── counttransfermanagerstorage.md │ ├── icheckpermission.md │ ├── securitytokenmock.md │ ├── securitytokenregistryproxy.md │ ├── erc20dividendcheckpointstorage.md │ ├── mockmoduleregistry.md │ ├── datastorefactory.md │ ├── percentagetransfermanagerstorage.md │ ├── votingcheckpointstorage.md │ ├── generalpermissionmanagerstorage.md │ ├── reclaimtokens.md │ ├── securitytokenregistrymock.md │ ├── weightedvotecheckpointstorage.md │ ├── decimalmath.md │ ├── manualapprovaltransfermanagerstorage.md │ ├── datastorestorage.md │ ├── math.md │ ├── iownable.md │ ├── migrations.md │ ├── stostorage.md │ ├── mockwrongtypefactory.md │ ├── lockuptransfermanagerstorage.md │ ├── teststofactory.md │ ├── datastoreproxy.md │ ├── ecdsa.md │ ├── blacklisttransfermanagerstorage.md │ ├── securitytokenproxy.md │ ├── kyctransfermanagerfactory.md │ ├── upgradeabilityproxy.md │ ├── plcrvotingcheckpointstorage.md │ ├── vestingescrowwalletproxy.md │ ├── counttransfermanagerproxy.md │ └── lockuptransfermanagerproxy.md ├── misc │ ├── README.md │ ├── images │ │ ├── PolymathCore.png │ │ ├── Polymath Core v3.png │ │ └── Core Architecture 2.0.0 Diagram.png │ ├── investor_flags.md │ └── ethereum_status_codes.md ├── wiki │ ├── README.md │ ├── transfer-ownership.md │ ├── time-travel-contract-testing.md │ └── cli-commands-for-polymath-core.md └── .gitbook │ └── assets │ ├── polymath.png │ └── polymath (1).png ├── .gitattributes ├── .npmignore ├── CLI ├── data │ ├── Transfer │ │ ├── LockupTM │ │ │ ├── delete_lockup_data.csv │ │ │ ├── add_lockup_data.csv │ │ │ ├── modify_lockup_data.csv │ │ │ ├── add_lockup_investor_data.csv │ │ │ └── remove_lockup_investor_data.csv │ │ ├── BlacklistTM │ │ │ ├── delete_blacklist_data.csv │ │ │ ├── add_blacklist_data.csv │ │ │ ├── modify_blacklist_data.csv │ │ │ ├── add_investor_blacklist_data.csv │ │ │ └── remove_investor_blacklist_data.csv │ │ ├── VRTM │ │ │ ├── remove_custom_restriction_data.csv │ │ │ ├── remove_daily_restriction_data.csv │ │ │ ├── modify_daily_restriction_data.csv │ │ │ ├── modify_custom_restriction_data.csv │ │ │ ├── add_daily_restriction_data.csv │ │ │ └── add_custom_restriction_data.csv │ │ ├── MATM │ │ │ ├── revoke_manualapproval_data.csv │ │ │ ├── add_manualapproval_data.csv │ │ │ └── modify_manualapproval_data.csv │ │ ├── PercentageTM │ │ │ └── whitelist_data.csv │ │ └── GTM │ │ │ ├── flag_data.csv │ │ │ └── whitelist_data.csv │ ├── Wallet │ │ └── VEW │ │ │ ├── revoke_schedule_data.csv │ │ │ ├── modify_schedule_data.csv │ │ │ ├── add_schedule_from_template_data.csv │ │ │ └── add_schedule_data.csv │ ├── Checkpoint │ │ ├── exclusions_data.csv │ │ └── tax_withholding_data.csv │ ├── STO │ │ ├── USDTieredSTO │ │ │ ├── nonAccreditedLimits_data.csv │ │ │ └── accredited_data.csv │ │ ├── capped_sto_data.yml │ │ └── usd_tiered_sto_data.yml │ ├── ST │ │ └── multi_mint_data.csv │ └── Ticker │ │ └── ticker_data.csv ├── scripts │ └── stable_coin.sh ├── package.json └── commands │ ├── helpers │ └── csv.js │ ├── common │ └── constants.js │ ├── IO │ └── output.js │ └── transfer_ownership.js ├── .babelrc ├── logo.png ├── Polymath.png ├── scripts ├── coverage.sh ├── gasUsage.sh ├── docs.sh ├── patch.js ├── wincov.cmd ├── wintest.cmd ├── calculateSize.js └── encoders │ └── encode_CappedSTO.js ├── audit reports ├── Polymath Audit Report Final.pdf ├── Polymath Core 2.0.0 Audit Report .pdf ├── Polymath Audit Report - STO Modules .pdf └── V3 Audit Report by Consensys Diligence - April 2019.pdf ├── contracts ├── mocks │ ├── FunctionSigClash2.sol │ ├── FunctionSigClash1.sol │ ├── MockPolyOracle.sol │ ├── Dummy │ │ ├── DummySTOStorage.sol │ │ └── DummySTOProxy.sol │ ├── MockSTRGetter.sol │ ├── SecurityTokenMock.sol │ ├── MockModuleRegistry.sol │ ├── SecurityTokenRegistryMock.sol │ ├── MockSTGetter.sol │ ├── MockCountTransferManager.sol │ ├── MockWrongTypeFactory.sol │ ├── MockBurnFactory.sol │ ├── MockFactory.sol │ ├── TestSTOFactory.sol │ └── MockOracle.sol ├── modules │ ├── Burn │ │ └── IBurn.sol │ ├── Checkpoint │ │ ├── ICheckpoint.sol │ │ ├── Dividend │ │ │ ├── ERC20 │ │ │ │ ├── ERC20DividendCheckpointStorage.sol │ │ │ │ └── ERC20DividendCheckpointProxy.sol │ │ │ └── Ether │ │ │ │ └── EtherDividendCheckpointProxy.sol │ │ └── Voting │ │ │ ├── Transparent │ │ │ ├── WeightedVoteCheckpointStorage.sol │ │ │ └── WeightedVoteCheckpointProxy.sol │ │ │ └── PLCR │ │ │ ├── PLCRVotingCheckpointProxy.sol │ │ │ └── PLCRVotingCheckpointStorage.sol │ ├── Wallet │ │ ├── Wallet.sol │ │ ├── VestingEscrowWalletProxy.sol │ │ └── VestingEscrowWalletFactory.sol │ ├── STO │ │ ├── PreSale │ │ │ ├── PreSaleSTOStorage.sol │ │ │ └── PreSaleSTOProxy.sol │ │ ├── Capped │ │ │ ├── CappedSTOStorage.sol │ │ │ └── CappedSTOProxy.sol │ │ └── USDTiered │ │ │ └── USDTieredSTOProxy.sol │ ├── TransferManager │ │ ├── CTM │ │ │ ├── CountTransferManagerStorage.sol │ │ │ └── CountTransferManagerProxy.sol │ │ ├── PTM │ │ │ ├── PercentageTransferManagerStorage.sol │ │ │ └── PercentageTransferManagerProxy.sol │ │ ├── MATM │ │ │ ├── ManualApprovalTransferManagerStorage.sol │ │ │ └── ManualApprovalTransferManagerProxy.sol │ │ ├── BTM │ │ │ ├── BlacklistTransferManagerStorage.sol │ │ │ └── BlacklistTransferManagerProxy.sol │ │ ├── VRTM │ │ │ └── VolumeRestrictionTMProxy.sol │ │ ├── LTM │ │ │ ├── LockUpTransferManagerProxy.sol │ │ │ └── LockUpTransferManagerStorage.sol │ │ ├── TransferManager.sol │ │ └── GTM │ │ │ ├── GeneralTransferManagerStorage.sol │ │ │ └── GeneralTransferManagerProxy.sol │ ├── PermissionManager │ │ ├── GeneralPermissionManagerStorage.sol │ │ └── GeneralPermissionManagerProxy.sol │ └── Experimental │ │ ├── TransferManager │ │ ├── KYCTransferManagerFactory.sol │ │ └── SignedTransferManagerFactory.sol │ │ ├── Burn │ │ ├── TrackedRedemption.sol │ │ └── TrackedRedemptionFactory.sol │ │ └── Mixed │ │ └── ScheduledCheckpointFactory.sol ├── storage │ └── modules │ │ ├── Checkpoint │ │ └── Voting │ │ │ └── VotingCheckpointStorage.sol │ │ ├── STO │ │ ├── ISTOStorage.sol │ │ └── STOStorage.sol │ │ └── ModuleStorage.sol ├── interfaces │ ├── IUpgradableTokenFactory.sol │ ├── IModule.sol │ ├── ICheckPermission.sol │ ├── IOracle.sol │ ├── IPolymathRegistry.sol │ ├── IOwnable.sol │ ├── ISTO.sol │ ├── IFeatureRegistry.sol │ ├── token │ │ ├── IERC1644.sol │ │ ├── IERC1643.sol │ │ └── IERC1594.sol │ ├── IPoly.sol │ └── ITransferManager.sol ├── libraries │ ├── StatusCodes.sol │ ├── DecimalMath.sol │ └── Encoder.sol ├── datastore │ ├── DataStoreFactory.sol │ ├── DataStoreStorage.sol │ └── DataStoreProxy.sol ├── proxy │ ├── ModuleRegistryProxy.sol │ ├── SecurityTokenRegistryProxy.sol │ └── Proxy.sol ├── Migrations.sol ├── ReclaimTokens.sol ├── external │ └── IMedianizer.sol ├── tokens │ ├── OZStorage.sol │ └── SecurityTokenProxy.sol ├── PolymathRegistry.sol ├── FeatureRegistry.sol └── Pausable.sol ├── greenkeeper.json ├── test └── helpers │ ├── contracts │ └── PolyToken.sol │ ├── testprivateKey.js │ ├── latestTime.js │ ├── encodeCall.js │ └── utils.js ├── .soliumrc.json ├── migrations └── 1_deploy_token.js ├── .eslintrc.js ├── .gitignore ├── .solcover.js ├── upgrade.js ├── PULL_REQUEST_TEMPLATE.md ├── .github └── ISSUE_TEMPLATE │ └── feature_request.md ├── .travis.yml └── truffle-ci.js /.gitbook.yaml: -------------------------------------------------------------------------------- 1 | root: ./docs/ -------------------------------------------------------------------------------- /.soliumignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /docs/api/README.md: -------------------------------------------------------------------------------- 1 | # api 2 | 3 | -------------------------------------------------------------------------------- /docs/misc/README.md: -------------------------------------------------------------------------------- 1 | # misc 2 | 3 | -------------------------------------------------------------------------------- /docs/wiki/README.md: -------------------------------------------------------------------------------- 1 | # wiki 2 | 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .npm-debug.log 2 | *.DS_Store 3 | coverage 4 | -------------------------------------------------------------------------------- /CLI/data/Transfer/LockupTM/delete_lockup_data.csv: -------------------------------------------------------------------------------- 1 | "TwoHours" 2 | "4Hours" -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-2", "stage-3"] 3 | } 4 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/logo.png -------------------------------------------------------------------------------- /Polymath.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/Polymath.png -------------------------------------------------------------------------------- /CLI/data/Transfer/BlacklistTM/delete_blacklist_data.csv: -------------------------------------------------------------------------------- 1 | "FirstTenDays" 2 | "Every90" 3 | "NoRepeat" 4 | "TwoHours" -------------------------------------------------------------------------------- /docs/.gitbook/assets/polymath.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/docs/.gitbook/assets/polymath.png -------------------------------------------------------------------------------- /docs/misc/images/PolymathCore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/docs/misc/images/PolymathCore.png -------------------------------------------------------------------------------- /scripts/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | rm -rf flat 4 | 5 | COVERAGE=true POLYMATH_NATIVE_SOLC=true scripts/test.sh 6 | -------------------------------------------------------------------------------- /docs/.gitbook/assets/polymath (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/docs/.gitbook/assets/polymath (1).png -------------------------------------------------------------------------------- /docs/misc/images/Polymath Core v3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/docs/misc/images/Polymath Core v3.png -------------------------------------------------------------------------------- /CLI/data/Transfer/VRTM/remove_custom_restriction_data.csv: -------------------------------------------------------------------------------- 1 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98 2 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3 3 | -------------------------------------------------------------------------------- /audit reports/Polymath Audit Report Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/audit reports/Polymath Audit Report Final.pdf -------------------------------------------------------------------------------- /contracts/mocks/FunctionSigClash2.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | contract functionSigClash2 { 4 | // function proxyOwner() public { 5 | // } 6 | } 7 | -------------------------------------------------------------------------------- /audit reports/Polymath Core 2.0.0 Audit Report .pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/audit reports/Polymath Core 2.0.0 Audit Report .pdf -------------------------------------------------------------------------------- /contracts/mocks/FunctionSigClash1.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | contract functionSigClash1 { 4 | // function clash550254402() public { 5 | // } 6 | } 7 | -------------------------------------------------------------------------------- /audit reports/Polymath Audit Report - STO Modules .pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/audit reports/Polymath Audit Report - STO Modules .pdf -------------------------------------------------------------------------------- /docs/misc/images/Core Architecture 2.0.0 Diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/docs/misc/images/Core Architecture 2.0.0 Diagram.png -------------------------------------------------------------------------------- /CLI/data/Wallet/VEW/revoke_schedule_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef -------------------------------------------------------------------------------- /greenkeeper.json: -------------------------------------------------------------------------------- 1 | { 2 | "groups": { 3 | "default": { 4 | "packages": [ 5 | "CLI/package.json", 6 | "package.json" 7 | ] 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /audit reports/V3 Audit Report by Consensys Diligence - April 2019.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PolymathNetwork/polymath-core/HEAD/audit reports/V3 Audit Report by Consensys Diligence - April 2019.pdf -------------------------------------------------------------------------------- /CLI/data/Transfer/LockupTM/add_lockup_data.csv: -------------------------------------------------------------------------------- 1 | 1000,1560178800,600,1,"TenMinutes" 2 | 1000,1560621600,3600,60,"OneHour" 3 | 2000,1567252800,7200,3600,"TwoHours" 4 | 3000,1567303200,14400,4800,"4Hours" 5 | -------------------------------------------------------------------------------- /CLI/data/Transfer/LockupTM/modify_lockup_data.csv: -------------------------------------------------------------------------------- 1 | 1000,1560178800,600,10,"TenMinutes" 2 | 1000,1560623200,3600,60,"OneHour" 3 | 2000,1567252800,7200,3600,"TwoHours" 4 | 6000,1567303200,14400,4800,"4Hours" 5 | -------------------------------------------------------------------------------- /CLI/data/Transfer/BlacklistTM/add_blacklist_data.csv: -------------------------------------------------------------------------------- 1 | 1559401200,1560178800,"FirstTenDays",30 2 | 1560535200,1560621600,"NoRepeat",0 3 | 1566734400,1567252800,"Every90",90 4 | 1567296000,1567303200,"TwoHours",2 5 | -------------------------------------------------------------------------------- /scripts/gasUsage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | mv truffle-config.js truffle-config-bk.js 4 | cp truffle-config-gas.js truffle-config.js 5 | 6 | scripts/test.sh 7 | 8 | mv truffle-config-bk.js truffle-config.js -------------------------------------------------------------------------------- /CLI/data/Transfer/BlacklistTM/modify_blacklist_data.csv: -------------------------------------------------------------------------------- 1 | 1559412000,1560178800,"FirstTenDays",30 2 | 1560535200,1561032000,"NoRepeat",0 3 | 1566734400,1567252800,"Every90",90 4 | 1567296000,1567303200,"TwoHours",3 5 | -------------------------------------------------------------------------------- /CLI/data/Transfer/MATM/revoke_manualapproval_data.csv: -------------------------------------------------------------------------------- 1 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0x1DDF4FDBB8eaDB5dD6EeC6edB1A91a0926940a33 2 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0xB849AC17d881183800300A31f022d3fe4B82D457 -------------------------------------------------------------------------------- /contracts/modules/Burn/IBurn.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Interface to be implemented by all checkpoint modules 5 | */ 6 | /*solium-disable-next-line no-empty-blocks*/ 7 | interface IBurn { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /CLI/data/Wallet/VEW/modify_schedule_data.csv: -------------------------------------------------------------------------------- 1 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,First Example,1573991004 2 | 0x10223927009b8add0960359dd90d1449415b7ca9,Second Example,1573991004 3 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,Third Example,1570794204 -------------------------------------------------------------------------------- /contracts/storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | contract VotingCheckpointStorage { 4 | 5 | mapping(address => uint256) defaultExemptIndex; 6 | address[] defaultExemptedVoters; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /test/helpers/contracts/PolyToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | import "openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol"; 4 | 5 | contract PolyToken is ERC20Mintable { 6 | constructor() public { 7 | 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /CLI/data/Wallet/VEW/add_schedule_from_template_data.csv: -------------------------------------------------------------------------------- 1 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,First Example,1570794204 2 | 0x10223927009b8add0960359dd90d1449415b7ca9,Second Example,1570794204 3 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,Third Example,1573991004 -------------------------------------------------------------------------------- /contracts/modules/Checkpoint/ICheckpoint.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Interface to be implemented by all checkpoint modules 5 | */ 6 | /*solium-disable-next-line no-empty-blocks*/ 7 | interface ICheckpoint { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /contracts/modules/Wallet/Wallet.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../Module.sol"; 4 | 5 | /** 6 | * @title Interface to be implemented by all Wallet modules 7 | * @dev abstract contract 8 | */ 9 | contract Wallet is Module { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/helpers/testprivateKey.js: -------------------------------------------------------------------------------- 1 | export const pk = { 2 | account_0: "2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200", 3 | account_1: "2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501201" 4 | }; 5 | 6 | export default { pk }; 7 | -------------------------------------------------------------------------------- /CLI/data/Checkpoint/exclusions_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1 2 | 0x49fc0b78238dab644698a90fa351b4c749e123d2 3 | 0x10223927009b8add0960359dd90d1449415b7ca9 4 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399 5 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98 -------------------------------------------------------------------------------- /.soliumrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solium:recommended", 3 | "plugins": [ 4 | "security" 5 | ], 6 | "rules": { 7 | "quotes": [ 8 | "error", 9 | "double" 10 | ], 11 | "indentation": [ 12 | "error", 13 | 4 14 | ] 15 | } 16 | } -------------------------------------------------------------------------------- /contracts/modules/STO/PreSale/PreSaleSTOStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Contract used to store layout for the PreSaleSTO storage 5 | */ 6 | contract PreSaleSTOStorage { 7 | 8 | mapping (address => uint256) public investors; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /CLI/data/Wallet/VEW/add_schedule_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,First Example,1000,100,10,1570794204 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,Second Example,5000,2500,50,1570794204 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,Third Example,3000,3000,150,1573991004 -------------------------------------------------------------------------------- /contracts/mocks/MockPolyOracle.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../oracles/PolyOracle.sol"; 4 | 5 | contract MockPolyOracle is PolyOracle { 6 | constructor() public payable { 7 | OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /test/helpers/latestTime.js: -------------------------------------------------------------------------------- 1 | // Returns the time of the last mined block in seconds 2 | export default async function latestTime() { 3 | let block = await latestBlock(); 4 | return block.timestamp; 5 | } 6 | 7 | async function latestBlock() { 8 | return web3.eth.getBlock("latest"); 9 | } 10 | -------------------------------------------------------------------------------- /CLI/data/Transfer/VRTM/remove_daily_restriction_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2 5 | 0x10223927009b8add0960359dd90d1449415b7ca9 6 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399 7 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/CTM/CountTransferManagerStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Contract used to store layout for the CountTransferManager storage 5 | */ 6 | contract CountTransferManagerStorage { 7 | 8 | // The maximum number of concurrent token holders 9 | uint256 public maxHolderCount; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /contracts/mocks/Dummy/DummySTOStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Contract used to store layout for the DummySTO storage 5 | */ 6 | contract DummySTOStorage { 7 | 8 | uint256 public investorCount; 9 | 10 | uint256 public cap; 11 | string public someString; 12 | 13 | mapping (address => uint256) public investors; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title It holds the storage variables related to ERC20DividendCheckpoint module 5 | */ 6 | contract ERC20DividendCheckpointStorage { 7 | // Mapping to token address for each dividend 8 | mapping(uint256 => address) public dividendTokens; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /CLI/data/STO/USDTieredSTO/nonAccreditedLimits_data.csv: -------------------------------------------------------------------------------- 1 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,2000 2 | 0x10223927009b8add0960359dd90d1449415b7ca9,1000 3 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,2500 4 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,500 5 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,3500 6 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,5000 7 | 0xbb276b6f68f0a41d54b7e0a608fe8eb1ebdee7b0,2000 8 | -------------------------------------------------------------------------------- /migrations/1_deploy_token.js: -------------------------------------------------------------------------------- 1 | const DevPolyToken = artifacts.require("./PolyTokenFaucet.sol"); 2 | const Web3 = require("web3"); 3 | web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); 4 | 5 | module.exports = function(deployer, network, accounts) { 6 | const PolymathAccount = accounts[0]; 7 | return deployer.deploy(DevPolyToken, { from: PolymathAccount }).then(() => {}); 8 | }; 9 | -------------------------------------------------------------------------------- /contracts/interfaces/IUpgradableTokenFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Interface to be implemented by upgradable token factories 5 | */ 6 | interface IUpgradableTokenFactory { 7 | 8 | /** 9 | * @notice Used to upgrade a token 10 | * @param _maxModuleType maximum module type enumeration 11 | */ 12 | function upgradeToken(uint8 _maxModuleType) external; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /docs/misc/investor_flags.md: -------------------------------------------------------------------------------- 1 | # Flags List 2 | 3 | | Flag | Name | Description | 4 | | :--- | :--- | :--- | 5 | | 0 | isAccredited | Defines if an Investor is Accredited or not. True for Accredited, false for not Accredited. | 6 | | 1 | canNotBuyFromSto | Defines if an Investor is restricted from participating in STOs | 7 | | 2 | isVolRestricted | Defines if an Investor has the trade volume restriction \(VRTM\) or not | 8 | 9 | -------------------------------------------------------------------------------- /docs/api/functionsigclash1.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-functionSigClash1 3 | title: functionSigClash1 4 | original_id: functionSigClash1 5 | --- 6 | 7 | # functionSigClash1.sol 8 | 9 | View Source: [contracts/mocks/FunctionSigClash1.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/FunctionSigClash1.sol) 10 | 11 | **functionSigClash1** 12 | 13 | ## Functions 14 | 15 | -------------------------------------------------------------------------------- /docs/api/functionsigclash2.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-functionSigClash2 3 | title: functionSigClash2 4 | original_id: functionSigClash2 5 | --- 6 | 7 | # functionSigClash2.sol 8 | 9 | View Source: [contracts/mocks/FunctionSigClash2.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/FunctionSigClash2.sol) 10 | 11 | **functionSigClash2** 12 | 13 | ## Functions 14 | 15 | -------------------------------------------------------------------------------- /CLI/data/Transfer/VRTM/modify_daily_restriction_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,2000,8/1/2019,10/10/2019,"Fixed" 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,2000,8/1/2019,10/10/2019,"Fixed" 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,500,8/1/2019,10/10/2019,"Fixed" 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,0.15,8/1/2019,20/10/2019,"Percentage" 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,25,8/1/2019,10/10/2019,"Fixed" 6 | -------------------------------------------------------------------------------- /contracts/mocks/MockSTRGetter.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../STRGetter.sol"; 4 | 5 | /** 6 | * @title Registry contract for issuers to register their security tokens 7 | */ 8 | contract MockSTRGetter is STRGetter { 9 | /// @notice It is a dummy function 10 | /// Alert! Alert! Do NOT use it for the mainnet release 11 | 12 | function newFunction() public pure returns (uint256) { 13 | return 99; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /CLI/data/Transfer/VRTM/modify_custom_restriction_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,2000,8/1/2019,90,12/10/2019,"Fixed" 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,2000,8/2/2019,30,10/10/2019,"Fixed" 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,500,8/1/2019,20,10/10/2019,"Fixed" 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,0.15,8/1/2019,90,12/10/2019,"Percentage" 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,25,8/1/2019,30,10/10/2019,"Fixed" 6 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "extends": "standard", 3 | "globals" : { 4 | "artifacts": false, 5 | "contract": false, 6 | "assert": false, 7 | "web3": false 8 | }, 9 | 10 | "rules": { 11 | "indent": 0, 12 | "camelcase": 0, 13 | "no-unused-vars": 0, 14 | "quotes": 0, 15 | "semi": 0, 16 | "no-undef": 0, 17 | "key-spacing": 0, 18 | "no-tabs": 0, 19 | "no-mixed-spaces-and-tabs":0 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /CLI/data/Checkpoint/tax_withholding_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,0.5 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,1 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,2 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,10 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,15 6 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,50 7 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,0 8 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,23 9 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,45 10 | 0xbb276b6f68f0a41d54b7e0a608fe8eb1ebdee7b0,67 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /CLI/node_modules 3 | /build 4 | /CLI/node_modules 5 | .npm-debug.log 6 | *.DS_Store 7 | keyStore 8 | keyStoreLocal 9 | privKey 10 | privKeyLocal 11 | coverage/ 12 | coverage.json 13 | .vscode/ 14 | bridge.log 15 | scTopics 16 | coverageEnv 17 | /flat 18 | /tempPoly 19 | .eslintrc.js 20 | package-lock.json 21 | bridge.log 22 | .node-xml* 23 | .solcover.js.bk 24 | allFiredEvents 25 | extract/ 26 | extract.py 27 | extract.zip 28 | /test-results 29 | .env 30 | yarn-error.log 31 | polymath-developer-portal 32 | -------------------------------------------------------------------------------- /CLI/data/ST/multi_mint_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,123.4 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,1000 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,234.5 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,1000 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,345.6 6 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,1000 7 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,1000 8 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,1000 9 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,1000 10 | 0xbb276b6f68f0a41d54b7e0a608fe8eb1ebdee7b0,1000 -------------------------------------------------------------------------------- /CLI/scripts/stable_coin.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Exit script as soon as a command fails. 4 | set -o errexit 5 | 6 | # Token symbol read from args. 7 | TOKEN_SYMBOL=$1 8 | 9 | # Paths 10 | CWD="$(pwd)" 11 | WHITELIST='/data/Transfer/GTM/whitelist_data.csv' 12 | MULTIMINT='/data/ST/multi_mint_data.csv' 13 | 14 | # Scripts 15 | 16 | node polymath-cli st -t $TOKEN_SYMBOL -o false -n $TOKEN_SYMBOL -d '' -D true 17 | node polymath-cli tm -t $TOKEN_SYMBOL -w $CWD$WHITELIST 18 | node polymath-cli stm -t $TOKEN_SYMBOL -m $CWD$MULTIMINT 19 | -------------------------------------------------------------------------------- /CLI/data/STO/USDTieredSTO/accredited_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,true 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,true 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,true 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,false 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,false 6 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,false 7 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,false 8 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,false 9 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,false 10 | 0xbb276b6f68f0a41d54b7e0a608fe8eb1ebdee7b0,false -------------------------------------------------------------------------------- /CLI/data/Transfer/PercentageTM/whitelist_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,true 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,true 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,true 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,true 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,true 6 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,true 7 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,true 8 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,false 9 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,false 10 | 0xbb276b6f68f0a41d54b7e0a608fe8eb1ebdee7b0,false -------------------------------------------------------------------------------- /contracts/interfaces/IModule.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Interface that every module contract should implement 5 | */ 6 | interface IModule { 7 | /** 8 | * @notice This function returns the signature of configure function 9 | */ 10 | function getInitFunction() external pure returns(bytes4 initFunction); 11 | 12 | /** 13 | * @notice Return the permission flags that are associated with a module 14 | */ 15 | function getPermissions() external view returns(bytes32[] memory permissions); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /.solcover.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | norpc: true, 3 | port: 8545, 4 | copyPackages: ['openzeppelin-solidity'], 5 | testCommand: 'node --max-old-space-size=3500 ../node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js -and ! -name s_v130_to_v140_upgrade.js -and ! -name q_usd_tiered_sto_sim.js -and ! -name z_general_permission_manager_fuzzer.js` --network coverage', 6 | skipFiles: ['external', 'flat', 'helpers', 'mocks', 'oracles', 'libraries/KindMath.sol', 'libraries/BokkyPooBahsDateTimeLibrary.sol', 'storage', 'modules/Experimental'], 7 | }; 8 | -------------------------------------------------------------------------------- /CLI/data/Transfer/GTM/flag_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,0,true 2 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,2,true 3 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,0,true 4 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,1,true 5 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,2,true 6 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,1,true 7 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,1,true 8 | 0x10223927009b8add0960359dd90d1449415b7ca9,2,true 9 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,1,true 10 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,5,true 11 | -------------------------------------------------------------------------------- /contracts/mocks/SecurityTokenMock.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../tokens/SecurityToken.sol"; 4 | 5 | contract SecurityTokenMock is SecurityToken { 6 | 7 | /** 8 | * @notice Initialization function 9 | * @dev Expected to be called atomically with the proxy being created, by the owner of the token 10 | * @dev Can only be called once 11 | */ 12 | function initialize(address _getterDelegate) public { 13 | super.initialize(_getterDelegate); 14 | securityTokenVersion = SemanticVersion(2, 2, 0); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /scripts/docs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Exit script as soon as a command fails. 4 | set -o errexit 5 | # set -x 6 | 7 | # Get latest tag name 8 | latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) 9 | versionNo=$(echo "$latestTag" | cut -b 2-6) 10 | CORE_ROUTE=$PWD 11 | OUTPUT_DIRECTORY="$PWD/docs/api" 12 | mkdir -p "$OUTPUT_DIRECTORY" 13 | # rm "$OUTPUT_DIRECTORY"/* 2> /dev/null 14 | echo "Generating docs in $OUTPUT_DIRECTORY" 15 | "$CORE_ROUTE"/node_modules/solidoc/cli.js "$CORE_ROUTE" "$OUTPUT_DIRECTORY" "$NO_COMPILE" en "$versionNo" '**/PolyOracle.json' -------------------------------------------------------------------------------- /docs/api/iburn.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-IBurn 3 | title: IBurn 4 | original_id: IBurn 5 | --- 6 | 7 | # Interface to be implemented by all checkpoint modules \(IBurn.sol\) 8 | 9 | View Source: [contracts/modules/Burn/IBurn.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/Burn/IBurn.sol) 10 | 11 | **↘ Derived Contracts:** [**TrackedRedemption**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/TrackedRedemption.md) 12 | 13 | **IBurn** 14 | 15 | ## Functions 16 | 17 | -------------------------------------------------------------------------------- /contracts/libraries/StatusCodes.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | library StatusCodes { 4 | 5 | // ERC1400 status code inspired from ERC1066 6 | enum Status { 7 | TransferFailure, 8 | TransferSuccess, 9 | InsufficientBalance, 10 | InsufficientAllowance, 11 | TransfersHalted, 12 | FundsLocked, 13 | InvalidSender, 14 | InvalidReceiver, 15 | InvalidOperator 16 | } 17 | 18 | function code(Status _status) internal pure returns (byte) { 19 | return byte(uint8(0x50) + (uint8(_status))); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /contracts/datastore/DataStoreFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./DataStoreProxy.sol"; 4 | 5 | contract DataStoreFactory { 6 | 7 | address public implementation; 8 | 9 | constructor(address _implementation) public { 10 | require(_implementation != address(0), "Address should not be 0x"); 11 | implementation = _implementation; 12 | } 13 | 14 | function generateDataStore(address _securityToken) public returns (address) { 15 | DataStoreProxy dsProxy = new DataStoreProxy(_securityToken, implementation); 16 | return address(dsProxy); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /contracts/proxy/ModuleRegistryProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../storage/EternalStorage.sol"; 4 | import "./OwnedUpgradeabilityProxy.sol"; 5 | 6 | /** 7 | * @title ModuleRegistryProxy 8 | * @dev This proxy holds the storage of the ModuleRegistry contract and delegates every call to the current implementation set. 9 | * Besides, it allows upgrading the contract's behaviour towards further implementations, and provides basic 10 | * authorization control functionalities 11 | */ 12 | /*solium-disable-next-line no-empty-blocks*/ 13 | contract ModuleRegistryProxy is EternalStorage, OwnedUpgradeabilityProxy { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /contracts/mocks/MockModuleRegistry.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../ModuleRegistry.sol"; 4 | 5 | /** 6 | * @title Registry contract for issuers to register their security tokens 7 | */ 8 | contract MockModuleRegistry is ModuleRegistry { 9 | /// @notice It is dummy functionality 10 | /// Alert! Alert! Do not use it for the mainnet release 11 | function addMoreReputation(address _moduleFactory, address[] memory _tokens) public onlyOwner { 12 | for (uint8 i = 0; i < _tokens.length; i++) { 13 | pushArray(Encoder.getKey("reputation", _moduleFactory), _tokens[i]); 14 | } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /contracts/mocks/SecurityTokenRegistryMock.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../SecurityTokenRegistry.sol"; 4 | 5 | /** 6 | * @title Registry contract for issuers to register their security tokens 7 | */ 8 | contract SecurityTokenRegistryMock is SecurityTokenRegistry { 9 | /// @notice It is a dummy function 10 | /// Alert! Alert! Do NOT use it for the mainnet release 11 | 12 | uint256 public someValue; 13 | 14 | function changeTheFee(uint256 _newFee) public { 15 | set(STLAUNCHFEE, _newFee); 16 | } 17 | 18 | function configure(uint256 _someValue) public { 19 | someValue = _someValue; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /CLI/data/Ticker/ticker_data.csv: -------------------------------------------------------------------------------- 1 | 0xfd4c0f5848642fc2041c003cb684fc66b16217bc,WE.R.LIVE,Polymath Test Token,0x0000000000000000000000000000000000000000000000000000000000000000 2 | 0xfd4c0f5848642fc2,blaksdf,asdfasdf,0x0000000000000000000000000000000000000000000000000000000000000000 3 | 0xfd4c0f5848642fc2041c003cb684fc66b16217bc,WE.R.LIVE,asdfasdf,0x0000000000000000000000000000000000000000000000000000000000000000 4 | 0xaC7dB13BA5d8a304Dfb2a56D76935D4F31073665,Stephane,Stephane token,0x0000000000000000000000000000000000000000000000000000000000000000 5 | 0xfd4c0f5848642fc2041c003cb684fc66b16217bc,WE.R //LIVE,asdfasdf,0x0000000000000000000000000000000000000000000000000000000000000000 6 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/PTM/PercentageTransferManagerStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Contract used to store layout for the PercentageTransferManager storage 5 | */ 6 | contract PercentageTransferManagerStorage { 7 | 8 | // Maximum percentage that any holder can have, multiplied by 10**16 - e.g. 20% is 20 * 10**16 9 | uint256 public maxHolderPercentage; 10 | 11 | // Ignore transactions which are part of the primary issuance 12 | bool public allowPrimaryIssuance = true; 13 | 14 | // Addresses on this list are always able to send / receive tokens 15 | mapping (address => bool) public whitelist; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /CLI/data/Transfer/MATM/add_manualapproval_data.csv: -------------------------------------------------------------------------------- 1 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0x1DDF4FDBB8eaDB5dD6EeC6edB1A91a0926940a33,10,12/12/2019,Lorem ipsum dolor sit amet 2 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0xB849AC17d881183800300A31f022d3fe4B82D457,20,12/12/2019,Consectetur adipiscing elit 3 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0xD122e1951cfb337D5CC8bc5aDECC0eb66ffb4B80,25,12/12/2019,Pellentesque ultrices eros 4 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0x1D9127821A244b64852E8Da431bb389B81710985,20,12/12/2019,Non eleifend ante tincidunt eget 5 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0x42dc79375E511Fb7Ee17fF50417141bAE5E5698E,10,12/12/2019,Sed ante arcu -------------------------------------------------------------------------------- /CLI/data/Transfer/MATM/modify_manualapproval_data.csv: -------------------------------------------------------------------------------- 1 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0x1DDF4FDBB8eaDB5dD6EeC6edB1A91a0926940a33,12/12/2019,1,Lorem ipsum dolor sit amet,0 2 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0xB849AC17d881183800300A31f022d3fe4B82D457,12/12/2019,2,Consectetur adipiscing elit,0 3 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0xD122e1951cfb337D5CC8bc5aDECC0eb66ffb4B80,12/12/2019,3,Pellentesque ultrices eros,1 4 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0x1D9127821A244b64852E8Da431bb389B81710985,12/12/2019,4,Non eleifend ante tincidunt eget,2 5 | 0x127b4F58A825Dfc6d4058AcdB7bB397d1F0411b5,0x42dc79375E511Fb7Ee17fF50417141bAE5E5698E,12/12/2019,5,Sed ante arcu,1 -------------------------------------------------------------------------------- /CLI/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "polymath-cli", 3 | "version": "1.4.0", 4 | "description": "CLI for Polymath-core", 5 | "main": "polymath-cli.js", 6 | "scripts": { 7 | "stable_coin": "scripts/stable_coin.sh" 8 | }, 9 | "author": "Polymath Inc", 10 | "license": "Apache-2.0", 11 | "dependencies": { 12 | "bignumber.js": "^8.1.1", 13 | "chalk": "^2.4.1", 14 | "commander": "^4.0.1", 15 | "csv-parse": "^4.4.6", 16 | "ethers": "^4.0.7", 17 | "moment": "^2.22.2", 18 | "readline-sync": "^1.4.9", 19 | "request": "^2.88.0", 20 | "request-promise": "^4.2.2", 21 | "table": "^5.1.1", 22 | "web3": "1.0.0-beta.35" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Contract used to store layout for the GeneralPermissionManager storage 5 | */ 6 | contract GeneralPermissionManagerStorage { 7 | 8 | // Mapping used to hold the permissions on the modules provided to delegate, module add => delegate add => permission bytes32 => bool 9 | mapping (address => mapping (address => mapping (bytes32 => bool))) public perms; 10 | // Mapping hold the delagate details 11 | mapping (address => bytes32) public delegateDetails; 12 | // Array to track all delegates 13 | address[] public allDelegates; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /contracts/proxy/SecurityTokenRegistryProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../storage/EternalStorage.sol"; 4 | import "./OwnedUpgradeabilityProxy.sol"; 5 | 6 | /** 7 | * @title SecurityTokenRegistryProxy 8 | * @dev This proxy holds the storage of the SecurityTokenRegistry contract and delegates every call to the current implementation set. 9 | * Besides, it allows to upgrade the SecurityTokenRegistry's behaviour towards further implementations, and provides basic 10 | * authorization control functionalities 11 | */ 12 | /*solium-disable-next-line no-empty-blocks*/ 13 | contract SecurityTokenRegistryProxy is EternalStorage, OwnedUpgradeabilityProxy { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /CLI/data/Transfer/VRTM/add_daily_restriction_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,1000,8/1/2019,10/10/2019,"Fixed" 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,2000,8/2/2019,10/12/2019,"Fixed" 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,500,8/1/2019,10/10/2019,"Fixed" 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,0.15,8/3/2019,10/1/2019,"Percentage" 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,0.25,8/1/2019,10/10/2019,"Percentage" 6 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,0.1,8/1/2019,10/5/2019,"Percentage" 7 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,1234,8/12/2019,10/10/2019,"Fixed" 8 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,5678,8/1/2019,10/10/2019,"Fixed" -------------------------------------------------------------------------------- /upgrade.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const glob = require("glob"); 3 | 4 | let regex = new RegExp('((const|let|var) (.*) = artifacts.require(.)*)', 'gi'); 5 | let m; 6 | 7 | glob("test/**/*.js", function (er, files) { 8 | files.forEach(function(filename) { 9 | fs.readFile(filename, 'utf-8', function(err, content) { 10 | if (err) { 11 | return console.log(err); 12 | } 13 | content = content.replace(regex, '$1\n$3.numberFormat = "BN";'); 14 | fs.writeFile(filename, content, 'utf8', function (err) { 15 | if (err) return console.log(err); 16 | }); 17 | }); 18 | }); 19 | }) -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | contract Migrations { 4 | address public owner; 5 | 6 | uint public lastCompletedMigration; 7 | 8 | modifier restricted() { 9 | require(msg.sender == owner, "Sender must be owner"); 10 | _; 11 | } 12 | 13 | constructor() public { 14 | owner = msg.sender; 15 | } 16 | 17 | function setCompleted(uint _completed) public restricted { 18 | lastCompletedMigration = _completed; 19 | } 20 | 21 | function upgrade(address _newAddress) public restricted { 22 | Migrations upgraded = Migrations(_newAddress); 23 | upgraded.setCompleted(lastCompletedMigration); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CLI/data/Transfer/VRTM/add_custom_restriction_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,1000,8/1/2019,90,12/10/2019,"Fixed" 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,2000,8/2/2019,30,10/12/2019,"Fixed" 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,500,8/1/2019,15,10/1/2019,"Fixed" 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,0.15,8/5/2019,90,12/10/2019,"Percentage" 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,0.25,8/3/2019,30,10/15/2019,"Percentage" 6 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,0.1,8/10/2019,15,10/10/2019,"Percentage" 7 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,1234,8/20/2019,10,10/22/2019,"Fixed" 8 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,5678,8/1/2019,2,10/10/2019,"Fixed" 9 | -------------------------------------------------------------------------------- /CLI/data/STO/capped_sto_data.yml: -------------------------------------------------------------------------------- 1 | # type -> 'CappedSTO' for cappedSTO, 'USDTieredSTO' for USDTieredSTO 2 | type: 'CappedSTO' 3 | # cap -> Maximum No. of tokens for sale. 4 | cap: 1000000 5 | # startTime -> Unix timestamp at which offering get started. '' for CLI default (one minute from now) 6 | startTime: '' 7 | # endTime -> Unix timestamp at which offering get ended. '' for CLI default (one month from now) 8 | endTime: '' 9 | # wallet -> Ethereum account address to hold the funds 10 | wallet: '0x0a519b4b6501f92e8f516230b97aca83257b0c01' 11 | # raiseType -> Type of currency used to collect the funds. [0] for ETH, [1] for POLY 12 | raiseType: [0] 13 | # rate -> Token units a buyer gets per unit of selected raise type. 14 | rate: 1000 -------------------------------------------------------------------------------- /CLI/data/Transfer/LockupTM/add_lockup_investor_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,"TenMinutes" 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,"TenMinutes" 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,"TenMinutes" 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,"TenMinutes" 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,"TenMinutes" 6 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,"OneHour" 7 | 0x10223927009b8add0960359dd90d1449415b7ca9,"OneHour" 8 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,"OneHour" 9 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,"OneHour" 10 | 0x10223927009b8add0960359dd90d1449415b7ca9,"OneHour" 11 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,"OneHour" 12 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,"OneHour" -------------------------------------------------------------------------------- /contracts/interfaces/ICheckPermission.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | interface ICheckPermission { 4 | /** 5 | * @notice Validate permissions with PermissionManager if it exists, If no Permission return false 6 | * @dev Note that IModule withPerm will allow ST owner all permissions anyway 7 | * @dev this allows individual modules to override this logic if needed (to not allow ST owner all permissions) 8 | * @param _delegate address of delegate 9 | * @param _module address of PermissionManager module 10 | * @param _perm the permissions 11 | * @return success 12 | */ 13 | function checkPermission(address _delegate, address _module, bytes32 _perm) external view returns(bool hasPerm); 14 | } 15 | -------------------------------------------------------------------------------- /CLI/data/Transfer/LockupTM/remove_lockup_investor_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,"TenMinutes" 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,"TenMinutes" 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,"TenMinutes" 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,"TenMinutes" 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,"TenMinutes" 6 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,"OneHour" 7 | 0x10223927009b8add0960359dd90d1449415b7ca9,"OneHour" 8 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,"OneHour" 9 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,"OneHour" 10 | 0x10223927009b8add0960359dd90d1449415b7ca9,"OneHour" 11 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,"OneHour" 12 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,"OneHour" -------------------------------------------------------------------------------- /contracts/storage/modules/STO/ISTOStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Storage layout for the ISTO contract 5 | */ 6 | contract ISTOStorage { 7 | 8 | mapping (uint8 => bool) public fundRaiseTypes; 9 | mapping (uint8 => uint256) public fundsRaised; 10 | 11 | // Start time of the STO 12 | uint256 public startTime; 13 | // End time of the STO 14 | uint256 public endTime; 15 | // Time STO was paused 16 | uint256 public pausedTime; 17 | // Number of individual investors 18 | uint256 public investorCount; 19 | // Address where ETH & POLY funds are delivered 20 | address public wallet; 21 | // Final amount of tokens sold 22 | uint256 public totalTokensSold; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /CLI/data/Transfer/BlacklistTM/add_investor_blacklist_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,"FirstTenDays" 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,"FirstTenDays" 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,"FirstTenDays" 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,"FirstTenDays" 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,"FirstTenDays" 6 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,"NoRepeat" 7 | 0x10223927009b8add0960359dd90d1449415b7ca9,"NoRepeat" 8 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,"NoRepeat" 9 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,"NoRepeat" 10 | 0x10223927009b8add0960359dd90d1449415b7ca9,"Every90" 11 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,"Every90" 12 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,"Every90" -------------------------------------------------------------------------------- /contracts/interfaces/IOracle.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | interface IOracle { 4 | /** 5 | * @notice Returns address of oracle currency (0x0 for ETH) 6 | */ 7 | function getCurrencyAddress() external view returns(address currency); 8 | 9 | /** 10 | * @notice Returns symbol of oracle currency (0x0 for ETH) 11 | */ 12 | function getCurrencySymbol() external view returns(bytes32 symbol); 13 | 14 | /** 15 | * @notice Returns denomination of price 16 | */ 17 | function getCurrencyDenominated() external view returns(bytes32 denominatedCurrency); 18 | 19 | /** 20 | * @notice Returns price - should throw if not valid 21 | */ 22 | function getPrice() external returns(uint256 price); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /CLI/data/Transfer/BlacklistTM/remove_investor_blacklist_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,"FirstTenDays" 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,"FirstTenDays" 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,"FirstTenDays" 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,"FirstTenDays" 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,"FirstTenDays" 6 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,"NoRepeat" 7 | 0x10223927009b8add0960359dd90d1449415b7ca9,"NoRepeat" 8 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,"NoRepeat" 9 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,"NoRepeat" 10 | 0x10223927009b8add0960359dd90d1449415b7ca9,"Every90" 11 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,"Every90" 12 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,"Every90" -------------------------------------------------------------------------------- /docs/api/mockpolyoracle.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-MockPolyOracle 3 | title: MockPolyOracle 4 | original_id: MockPolyOracle 5 | --- 6 | 7 | # MockPolyOracle.sol 8 | 9 | View Source: [contracts/mocks/MockPolyOracle.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/MockPolyOracle.sol) 10 | 11 | **↗ Extends:** [**PolyOracle**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PolyOracle.md) 12 | 13 | **MockPolyOracle** 14 | 15 | ## Functions 16 | 17 | * [\(\)](mockpolyoracle.md) 18 | 19 | ```javascript 20 | function () public payable 21 | ``` 22 | 23 | **Arguments** 24 | 25 | | Name | Type | Description | 26 | | :--- | :--- | :--- | 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/api/wallet.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-Wallet 3 | title: Wallet 4 | original_id: Wallet 5 | --- 6 | 7 | # Interface to be implemented by all Wallet modules \(Wallet.sol\) 8 | 9 | View Source: [contracts/modules/Wallet/Wallet.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/Wallet/Wallet.sol) 10 | 11 | **↗ Extends:** [**Module**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/Module.md) **↘ Derived Contracts:** [**VestingEscrowWallet**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/VestingEscrowWallet.md) 12 | 13 | **Wallet** 14 | 15 | abstract contract 16 | 17 | ## Functions 18 | 19 | -------------------------------------------------------------------------------- /contracts/modules/STO/Capped/CappedSTOStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Contract used to store layout for the CappedSTO storage 5 | */ 6 | contract CappedSTOStorage { 7 | 8 | // Determine whether users can invest on behalf of a beneficiary 9 | bool public allowBeneficialInvestments = false; 10 | // How many token units a buyer gets (multiplied by 10^18) per wei / base unit of POLY 11 | // If rate is 10^18, buyer will get 1 token unit for every wei / base unit of poly. 12 | uint256 public rate; 13 | //How many token base units this STO will be allowed to sell to investors 14 | // 1 full token = 10^decimals_of_token base units 15 | uint256 public cap; 16 | 17 | mapping (address => uint256) public investors; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /contracts/interfaces/IPolymathRegistry.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | interface IPolymathRegistry { 4 | 5 | event ChangeAddress(string _nameKey, address indexed _oldAddress, address indexed _newAddress); 6 | 7 | /** 8 | * @notice Returns the contract address 9 | * @param _nameKey is the key for the contract address mapping 10 | * @return address 11 | */ 12 | function getAddress(string calldata _nameKey) external view returns(address registryAddress); 13 | 14 | /** 15 | * @notice Changes the contract address 16 | * @param _nameKey is the key for the contract address mapping 17 | * @param _newAddress is the new contract address 18 | */ 19 | function changeAddress(string calldata _nameKey, address _newAddress) external; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | ### Please check if the PR fulfills these requirements 3 | - [ ] The commit message follows our Submission guidelines 4 | - [ ] Tests for the changes have been added (for bug fixes / features) 5 | - [ ] Docs have been added / updated (for bug fixes / features) 6 | 7 | 8 | ### What kind of change does this PR introduce? 9 | (Bug fix, feature, docs update, ...) 10 | 11 | 12 | ### What is the current behavior? 13 | (You can also link to an open issue here) 14 | 15 | 16 | ### What is the new behavior? 17 | (Define and describe any new functionality. Clarify if this is a feature change) 18 | 19 | 20 | ### Does this PR introduce a breaking change? 21 | (What changes might users need to make in their application due to this PR?) 22 | 23 | 24 | 25 | ### Any Other information: 26 | -------------------------------------------------------------------------------- /contracts/storage/modules/STO/STOStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Storage layout for the STO contract 5 | */ 6 | 7 | contract STOStorage { 8 | bytes32 internal constant INVESTORFLAGS = "INVESTORFLAGS"; 9 | 10 | mapping (uint8 => bool) public fundRaiseTypes; 11 | mapping (uint8 => uint256) public fundsRaised; 12 | 13 | // Start time of the STO 14 | uint256 public startTime; 15 | // End time of the STO 16 | uint256 public endTime; 17 | // Time STO was paused 18 | uint256 public pausedTime; 19 | // Number of individual investors 20 | uint256 public investorCount; 21 | // Address where ETH & POLY funds are delivered 22 | address payable public wallet; 23 | // Final amount of tokens sold 24 | uint256 public totalTokensSold; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /contracts/ReclaimTokens.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; 4 | import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; 5 | 6 | /** 7 | * @title Utility contract to allow owner to retreive any ERC20 sent to the contract 8 | */ 9 | contract ReclaimTokens is Ownable { 10 | /** 11 | * @notice Reclaim all ERC20Basic compatible tokens 12 | * @param _tokenContract The address of the token contract 13 | */ 14 | function reclaimERC20(address _tokenContract) external onlyOwner { 15 | require(_tokenContract != address(0), "Invalid address"); 16 | IERC20 token = IERC20(_tokenContract); 17 | uint256 balance = token.balanceOf(address(this)); 18 | require(token.transfer(owner(), balance), "Transfer failed"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /contracts/interfaces/IOwnable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Ownable 5 | * @dev The Ownable contract has an owner address, and provides basic authorization control 6 | * functions, this simplifies the implementation of "user permissions". 7 | */ 8 | interface IOwnable { 9 | /** 10 | * @dev Returns owner 11 | */ 12 | function owner() external view returns(address ownerAddress); 13 | 14 | /** 15 | * @dev Allows the current owner to relinquish control of the contract. 16 | */ 17 | function renounceOwnership() external; 18 | 19 | /** 20 | * @dev Allows the current owner to transfer control of the contract to a newOwner. 21 | * @param _newOwner The address to transfer ownership to. 22 | */ 23 | function transferOwnership(address _newOwner) external; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /docs/api/istostorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-ISTOStorage 3 | title: ISTOStorage 4 | original_id: ISTOStorage 5 | --- 6 | 7 | # Storage layout for the ISTO contract \(ISTOStorage.sol\) 8 | 9 | View Source: [contracts/storage/modules/STO/ISTOStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/storage/modules/STO/ISTOStorage.sol) 10 | 11 | **ISTOStorage** 12 | 13 | ## Contract Members 14 | 15 | **Constants & Variables** 16 | 17 | ```javascript 18 | mapping(uint8 => bool) public fundRaiseTypes; 19 | mapping(uint8 => uint256) public fundsRaised; 20 | uint256 public startTime; 21 | uint256 public endTime; 22 | uint256 public pausedTime; 23 | uint256 public investorCount; 24 | address public wallet; 25 | uint256 public totalTokensSold; 26 | ``` 27 | 28 | ## Functions 29 | 30 | -------------------------------------------------------------------------------- /CLI/data/Transfer/GTM/whitelist_data.csv: -------------------------------------------------------------------------------- 1 | 0xee7ae74d964f2be7d72c1b187b38e2ed3615d4d1,5/5/2018,1/8/2018,10/10/2019,true 2 | 0x2f0fd672bf222413cc69dc1f4f1d7e93ad1763a1,5/5/2018,1/8/2018,10/10/2019,true 3 | 0xac297053173b02b02a737d47f7b4a718e5b170ef,5/5/2018,1/8/2018,10/10/2019,true 4 | 0x49fc0b78238dab644698a90fa351b4c749e123d2,5/5/2018,1/8/2018,10/10/2019,false 5 | 0x10223927009b8add0960359dd90d1449415b7ca9,5/5/2018,1/8/2018,10/10/2019,false 6 | 0x3c65cfe3de848cf38e9d76e9c3e57a2f1140b399,5/5/2018,1/8/2018,10/10/2019,false 7 | 0xabf60de3265b3017db7a1be66fc8b364ec1dbb98,5/5/2018,1/8/2018,10/10/2019,false 8 | 0xb841fe5a89da1bbef2d0805fbd7ffcbbb2fca5e3,5/5/2018,1/8/2018,10/10/2019,false 9 | 0x56be93088141b16ebaa9416122fd1d928da25ecf,5/5/2018,1/8/2018,10/10/2019,false 10 | 0xbb276b6f68f0a41d54b7e0a608fe8eb1ebdee7b0,5/5/2018,1/8/2018,10/10/2019,true -------------------------------------------------------------------------------- /contracts/interfaces/ISTO.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Interface to be implemented by all STO modules 5 | */ 6 | interface ISTO { 7 | 8 | enum FundRaiseType {ETH, POLY, SC} 9 | 10 | // Event 11 | event SetFundRaiseTypes(FundRaiseType[] _fundRaiseTypes); 12 | 13 | /** 14 | * @notice Returns the total no. of tokens sold 15 | */ 16 | function getTokensSold() external view returns(uint256 soldTokens); 17 | 18 | /** 19 | * @notice Returns funds raised by the STO 20 | */ 21 | function getRaised(FundRaiseType _fundRaiseType) external view returns(uint256 raisedAmount); 22 | 23 | /** 24 | * @notice Pause (overridden function) 25 | * @dev Only securityToken owner restriction applied on the super function 26 | */ 27 | function pause() external; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /contracts/external/IMedianizer.sol: -------------------------------------------------------------------------------- 1 | /* solium-disable */ 2 | pragma solidity 0.5.8; 3 | 4 | /** 5 | * @title Interface to MakerDAO Medianizer contract 6 | */ 7 | 8 | interface IMedianizer { 9 | function peek() external view returns(bytes32, bool); 10 | 11 | function read() external view returns(bytes32); 12 | 13 | function set(address wat) external; 14 | 15 | function set(bytes12 pos, address wat) external; 16 | 17 | function setMin(uint96 min_) external; 18 | 19 | function setNext(bytes12 next_) external; 20 | 21 | function unset(bytes12 pos) external; 22 | 23 | function unset(address wat) external; 24 | 25 | function poke() external; 26 | 27 | function poke(bytes32) external; 28 | 29 | function compute() external view returns(bytes32, bool); 30 | 31 | function void() external; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /contracts/interfaces/IFeatureRegistry.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Interface for managing polymath feature switches 5 | */ 6 | interface IFeatureRegistry { 7 | 8 | event ChangeFeatureStatus(string _nameKey, bool _newStatus); 9 | 10 | /** 11 | * @notice change a feature status 12 | * @dev feature status is set to false by default 13 | * @param _nameKey is the key for the feature status mapping 14 | * @param _newStatus is the new feature status 15 | */ 16 | function setFeatureStatus(string calldata _nameKey, bool _newStatus) external; 17 | 18 | /** 19 | * @notice Get the status of a feature 20 | * @param _nameKey is the key for the feature status mapping 21 | * @return bool 22 | */ 23 | function getFeatureStatus(string calldata _nameKey) external view returns(bool hasFeature); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /contracts/mocks/MockSTGetter.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../tokens/STGetter.sol"; 4 | 5 | /** 6 | * @title Security Token contract (mock) 7 | * @notice SecurityToken is an ERC1400 token with added capabilities: 8 | * @notice - Implements the ERC1400 Interface 9 | * @notice - Transfers are restricted 10 | * @notice - Modules can be attached to it to control its behaviour 11 | * @notice - ST should not be deployed directly, but rather the SecurityTokenRegistry should be used 12 | * @notice - ST does not inherit from ISecurityToken due to: 13 | * @notice - https://github.com/ethereum/solidity/issues/4847 14 | */ 15 | contract MockSTGetter is STGetter { 16 | using SafeMath for uint256; 17 | 18 | event UpgradeEvent(uint256 _upgrade); 19 | 20 | function newGetter(uint256 _upgrade) public { 21 | emit UpgradeEvent(_upgrade); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /test/helpers/encodeCall.js: -------------------------------------------------------------------------------- 1 | const abi = require("ethereumjs-abi"); 2 | 3 | export function encodeProxyCall(parametersType, values) { 4 | const methodId = abi.methodID("initialize", parametersType).toString("hex"); 5 | const params = abi.rawEncode(parametersType, values).toString("hex"); 6 | return "0x" + methodId + params; 7 | } 8 | 9 | export function encodeModuleCall(parametersType, values) { 10 | const methodId = abi.methodID("configure", parametersType).toString("hex"); 11 | const params = abi.rawEncode(parametersType, values).toString("hex"); 12 | return "0x" + methodId + params; 13 | } 14 | 15 | export function encodeCall(methodName, parametersType, values) { 16 | const methodId = abi.methodID(methodName, parametersType).toString("hex"); 17 | const params = abi.rawEncode(parametersType, values).toString("hex"); 18 | return "0x" + methodId + params; 19 | } 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | --- 5 | 6 | ## Issue Template 7 | 8 | Please use this template when submitting issues to this repo 9 | 10 | ### Is your feature request related to a problem? Please describe. 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | ### Describe the solution you'd like 14 | A clear and concise description of what you want to happen. 15 | 16 | ### Describe alternatives you've considered 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | ### Possible Implementation 20 | A clear and concise description of how this solution may be implemented within the current project. Please include any tools or libraries which you recommend. 21 | 22 | ### Additional context 23 | Add any other context or screenshots about the feature request here. 24 | -------------------------------------------------------------------------------- /contracts/mocks/MockCountTransferManager.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../modules/TransferManager/CTM/CountTransferManager.sol"; 4 | 5 | /** 6 | * @title Transfer Manager for limiting maximum number of token holders 7 | */ 8 | contract MockCountTransferManager is CountTransferManager { 9 | 10 | event Upgrader(uint256 _someData); 11 | uint256 public someValue; 12 | 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | */ 17 | constructor(address _securityToken, address _polyToken) public CountTransferManager(_securityToken, _polyToken) { 18 | 19 | } 20 | 21 | function initialize(uint256 _someData) public { 22 | require(msg.sender == address(this)); 23 | someValue = _someData; 24 | emit Upgrader(_someData); 25 | } 26 | 27 | function newFunction() external { 28 | emit Upgrader(maxHolderCount); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /docs/api/icheckpoint.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-ICheckpoint 3 | title: ICheckpoint 4 | original_id: ICheckpoint 5 | --- 6 | 7 | # Interface to be implemented by all checkpoint modules \(ICheckpoint.sol\) 8 | 9 | View Source: [contracts/modules/Checkpoint/ICheckpoint.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/Checkpoint/ICheckpoint.sol) 10 | 11 | **↘ Derived Contracts:** [**DividendCheckpoint**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/DividendCheckpoint.md)**,** [**ScheduledCheckpoint**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ScheduledCheckpoint.md)**,** [**VotingCheckpoint**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/VotingCheckpoint.md) 12 | 13 | **ICheckpoint** 14 | 15 | ## Functions 16 | 17 | -------------------------------------------------------------------------------- /contracts/interfaces/token/IERC1644.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | interface IERC1644 { 4 | 5 | // Controller Operation 6 | function isControllable() external view returns (bool); 7 | function controllerTransfer(address _from, address _to, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external; 8 | function controllerRedeem(address _tokenHolder, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external; 9 | 10 | // Controller Events 11 | event ControllerTransfer( 12 | address _controller, 13 | address indexed _from, 14 | address indexed _to, 15 | uint256 _value, 16 | bytes _data, 17 | bytes _operatorData 18 | ); 19 | 20 | event ControllerRedemption( 21 | address _controller, 22 | address indexed _tokenHolder, 23 | uint256 _value, 24 | bytes _data, 25 | bytes _operatorData 26 | ); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /docs/api/iupgradabletokenfactory.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-IUpgradableTokenFactory 3 | title: IUpgradableTokenFactory 4 | original_id: IUpgradableTokenFactory 5 | --- 6 | 7 | # Interface to be implemented by upgradable token factories \(IUpgradableTokenFactory.sol\) 8 | 9 | View Source: [contracts/interfaces/IUpgradableTokenFactory.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/interfaces/IUpgradableTokenFactory.sol) 10 | 11 | **IUpgradableTokenFactory** 12 | 13 | ## Functions 14 | 15 | * [upgradeToken\(uint8 \_maxModuleType\)](iupgradabletokenfactory.md#upgradetoken) 16 | 17 | ### upgradeToken 18 | 19 | Used to upgrade a token 20 | 21 | ```javascript 22 | function upgradeToken(uint8 _maxModuleType) external nonpayable 23 | ``` 24 | 25 | **Arguments** 26 | 27 | | Name | Type | Description | 28 | | :--- | :--- | :--- | 29 | | \_maxModuleType | uint8 | maximum module type enumeration | 30 | 31 | -------------------------------------------------------------------------------- /contracts/interfaces/token/IERC1643.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | // @title IERC1643 Document Management (part of the ERC1400 Security Token Standards) 4 | /// @dev See https://github.com/SecurityTokenStandard/EIP-Spec 5 | 6 | interface IERC1643 { 7 | 8 | // Document Management 9 | //-- Included in interface but commented because getDocuement() & getAllDocuments() body is provided in the STGetter 10 | // function getDocument(bytes32 _name) external view returns (string memory, bytes32, uint256); 11 | // function getAllDocuments() external view returns (bytes32[] memory); 12 | function setDocument(bytes32 _name, string calldata _uri, bytes32 _documentHash) external; 13 | function removeDocument(bytes32 _name) external; 14 | 15 | // Document Events 16 | event DocumentRemoved(bytes32 indexed _name, string _uri, bytes32 _documentHash); 17 | event DocumentUpdated(bytes32 indexed _name, string _uri, bytes32 _documentHash); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /docs/api/address.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-Address 3 | title: Address 4 | original_id: Address 5 | --- 6 | 7 | # Address.sol 8 | 9 | View Source: [openzeppelin-solidity/contracts/utils/Address.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/openzeppelin-solidity/contracts/utils/Address.sol) 10 | 11 | **Address** 12 | 13 | ## Functions 14 | 15 | * [isContract\(address account\)](address.md#iscontract) 16 | 17 | ### isContract 18 | 19 | This function will return false if invoked during the constructor of a contract, as the code is not actually created until after the constructor finishes. 20 | 21 | ```javascript 22 | function isContract(address account) internal view 23 | returns(bool) 24 | ``` 25 | 26 | **Returns** 27 | 28 | whether the target address is a contract 29 | 30 | **Arguments** 31 | 32 | | Name | Type | Description | 33 | | :--- | :--- | :--- | 34 | | account | address | address of the account to check | 35 | 36 | -------------------------------------------------------------------------------- /docs/api/mockstrgetter.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-MockSTRGetter 3 | title: MockSTRGetter 4 | original_id: MockSTRGetter 5 | --- 6 | 7 | # Registry contract for issuers to register their security tokens \(MockSTRGetter.sol\) 8 | 9 | View Source: [contracts/mocks/MockSTRGetter.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/MockSTRGetter.sol) 10 | 11 | **↗ Extends:** [**STRGetter**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/STRGetter.md) 12 | 13 | **MockSTRGetter** 14 | 15 | ## Functions 16 | 17 | * [newFunction\(\)](mockstrgetter.md#newfunction) 18 | 19 | ### newFunction 20 | 21 | It is a dummy function Alert! Alert! Do NOT use it for the mainnet release 22 | 23 | ```javascript 24 | function newFunction() public pure 25 | returns(uint256) 26 | ``` 27 | 28 | **Arguments** 29 | 30 | | Name | Type | Description | 31 | | :--- | :--- | :--- | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/api/presalestostorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-PreSaleSTOStorage 3 | title: PreSaleSTOStorage 4 | original_id: PreSaleSTOStorage 5 | --- 6 | 7 | # Contract used to store layout for the PreSaleSTO storage \(PreSaleSTOStorage.sol\) 8 | 9 | View Source: [contracts/modules/STO/PreSale/PreSaleSTOStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/STO/PreSale/PreSaleSTOStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**PreSaleSTO**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PreSaleSTO.md)**,** [**PreSaleSTOProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PreSaleSTOProxy.md) 12 | 13 | **PreSaleSTOStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | mapping(address => uint256) public investors; 21 | ``` 22 | 23 | ## Functions 24 | 25 | -------------------------------------------------------------------------------- /scripts/patch.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const request = require("request"); 3 | const regex = /node ..\/n(.)*,/gim; 4 | const regex2 = /truffle test(.)*,/gim; 5 | 6 | request("https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js").pipe( 7 | fs.createWriteStream("node_modules\\solidity-coverage\\lib\\app.js") 8 | ); 9 | 10 | fs.readFile(".solcover.js", "utf8", function(err, data) { 11 | if (err) { 12 | return console.log(err); 13 | } 14 | 15 | let testCommand = "truffle test --network coverage"; 16 | fs.readdirSync("./test").forEach(file => { 17 | if (file != "a_poly_oracle.js") testCommand = testCommand + " test\\\\" + file; 18 | }); 19 | testCommand = testCommand + "',"; 20 | let result = data.replace(regex2, testCommand); 21 | result = result.replace(regex, testCommand); 22 | 23 | fs.writeFile(".solcover.js", result, "utf8", function(err) { 24 | if (err) return console.log(err); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '8' 4 | cache: 5 | directories: 6 | - node_modules 7 | jobs: 8 | include: 9 | - stage: Test 10 | install: 11 | - yarn install 12 | before_script: 13 | - truffle version 14 | script: npm run test 15 | notifications: 16 | slack: 17 | secure: W4FZSabLrzF74f317hutolEHnlq2GBlQxU6b85L5XymrjgLEhlgE16c5Qz7Emoyt6le6PXL+sfG2ujJc3XYys/6hppgrHSAasuJnKCdQNpmMZ9BNyMs6WGkmB3enIf3K/FLXb26AQdwpQdIXuOeJUTf879u+YoiZV0eZH8d3+fsIOyovq9N6X5pKOpDM9iT8gGB4t7fie7xf51s+iUaHxyO9G7jDginZ4rBXHcU7mxCub9z+Z1H8+kCTnPWaF+KKVEXx4Z0nI3+urboD7E4OIP02LwrThQls2CppA3X0EoesTcdvj/HLErY/JvsXIFiFEEHZzB1Wi+k2TiOeLcYwEuHIVij+HPxxlJNX/j8uy01Uk8s4rd+0EhvfdKHJqUKqxH4YN2npcKfHEss7bU3y7dUinXQfYShW5ZewHdvc7pnnxBTfhvmdi64HdNrXAPq+s1rhciH7MmnU+tsm4lhrpr+FBuHzUMA9fOCr7b0SQytZEgWpiUls88gdbh3yG8TjyZxmZJGx09cwEP0q7VoH0UwFh7mIu5XmYdd5tWUhavTiO7YV8cUPn7MvwMsTltB3YBpF/fB26L7ka8zBhCsjm9prW6SVYU/dyO3m91VeZtO/zJFHRDA6Q58JGVW2rgzO39z193qC1EGRXqTie96VwAAtNg8+hRb+bI/CWDVzSPc= 18 | -------------------------------------------------------------------------------- /contracts/datastore/DataStoreStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../interfaces/ISecurityToken.sol"; 4 | 5 | contract DataStoreStorage { 6 | // Address of the current implementation 7 | address internal __implementation; 8 | 9 | ISecurityToken public securityToken; 10 | 11 | mapping (bytes32 => uint256) internal uintData; 12 | mapping (bytes32 => bytes32) internal bytes32Data; 13 | mapping (bytes32 => address) internal addressData; 14 | mapping (bytes32 => string) internal stringData; 15 | mapping (bytes32 => bytes) internal bytesData; 16 | mapping (bytes32 => bool) internal boolData; 17 | mapping (bytes32 => uint256[]) internal uintArrayData; 18 | mapping (bytes32 => bytes32[]) internal bytes32ArrayData; 19 | mapping (bytes32 => address[]) internal addressArrayData; 20 | mapping (bytes32 => bool[]) internal boolArrayData; 21 | 22 | uint8 internal constant DATA_KEY = 6; 23 | bytes32 internal constant MANAGEDATA = "MANAGEDATA"; 24 | } 25 | -------------------------------------------------------------------------------- /truffle-ci.js: -------------------------------------------------------------------------------- 1 | require('babel-register'); 2 | require('babel-polyfill'); 3 | 4 | module.exports = { 5 | networks: { 6 | development: { 7 | host: 'localhost', 8 | port: 8545, 9 | network_id: '*', // Match any network id 10 | gas: 7900000, 11 | }, 12 | coverage: { 13 | host: "localhost", 14 | network_id: "*", 15 | port: 8545, // <-- If you change this, also set the port option in .solcover.js. 16 | gas: 0xfffffffffff, // <-- Use this high gas value 17 | gasPrice: 0x01 // <-- Use this low gas price 18 | } 19 | }, 20 | compilers: { 21 | solc: { 22 | version: "native", 23 | settings: { 24 | optimizer: { 25 | enabled: true, 26 | runs: 200 27 | } 28 | } 29 | } 30 | }, 31 | mocha: { 32 | enableTimeouts: false, 33 | reporter: "mocha-junit-reporter", 34 | reporterOptions: { 35 | mochaFile: './test-results/mocha/results.xml' 36 | } 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /contracts/libraries/DecimalMath.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "openzeppelin-solidity/contracts/math/SafeMath.sol"; 4 | 5 | library DecimalMath { 6 | using SafeMath for uint256; 7 | 8 | uint256 internal constant e18 = uint256(10) ** uint256(18); 9 | 10 | /** 11 | * @notice This function multiplies two decimals represented as (decimal * 10**DECIMALS) 12 | * @return uint256 Result of multiplication represented as (decimal * 10**DECIMALS) 13 | */ 14 | function mul(uint256 x, uint256 y) internal pure returns(uint256 z) { 15 | z = SafeMath.add(SafeMath.mul(x, y), (e18) / 2) / (e18); 16 | } 17 | 18 | /** 19 | * @notice This function divides two decimals represented as (decimal * 10**DECIMALS) 20 | * @return uint256 Result of division represented as (decimal * 10**DECIMALS) 21 | */ 22 | function div(uint256 x, uint256 y) internal pure returns(uint256 z) { 23 | z = SafeMath.add(SafeMath.mul(x, (e18)), y / 2) / y; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /contracts/mocks/MockWrongTypeFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./MockBurnFactory.sol"; 4 | import "../modules/ModuleFactory.sol"; 5 | import "../libraries/Util.sol"; 6 | 7 | /** 8 | * @title Mock Contract Not fit for production environment 9 | */ 10 | 11 | contract MockWrongTypeFactory is MockBurnFactory { 12 | /** 13 | * @notice Constructor 14 | * @param _setupCost Setup cost of the module 15 | * @param _polymathRegistry Address of the Polymath Registry 16 | */ 17 | constructor( 18 | uint256 _setupCost, 19 | address _polymathRegistry, 20 | bool _isFeeInPoly 21 | ) 22 | public 23 | MockBurnFactory(_setupCost, _polymathRegistry, _isFeeInPoly) 24 | { 25 | 26 | } 27 | 28 | /** 29 | * @notice Type of the Module factory 30 | */ 31 | function getTypes() external view returns(uint8[] memory) { 32 | uint8[] memory res = new uint8[](1); 33 | res[0] = 4; 34 | return res; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Contract used to store layout for the ManualApprovalTransferManager storage 5 | */ 6 | contract ManualApprovalTransferManagerStorage { 7 | 8 | //Manual approval is an allowance (that has been approved) with an expiry time 9 | struct ManualApproval { 10 | address from; 11 | address to; 12 | uint256 initialAllowance; 13 | uint256 allowance; 14 | uint256 expiryTime; 15 | bytes32 description; 16 | } 17 | 18 | mapping (address => mapping (address => uint256)) public approvalIndex; 19 | 20 | // An array to track all approvals. It is an unbounded array but it's not a problem as 21 | // it is never looped through in an onchain call. It is defined as an Array instead of mapping 22 | // just to make it easier for users to fetch list of all approvals through constant functions. 23 | ManualApproval[] public approvals; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /docs/api/dummystostorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-DummySTOStorage 3 | title: DummySTOStorage 4 | original_id: DummySTOStorage 5 | --- 6 | 7 | # Contract used to store layout for the DummySTO storage \(DummySTOStorage.sol\) 8 | 9 | View Source: [contracts/mocks/Dummy/DummySTOStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/Dummy/DummySTOStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**DummySTO**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/DummySTO.md)**,** [**DummySTOProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/DummySTOProxy.md) 12 | 13 | **DummySTOStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | uint256 public investorCount; 21 | uint256 public cap; 22 | string public someString; 23 | mapping(address => uint256) public investors; 24 | ``` 25 | 26 | ## Functions 27 | 28 | -------------------------------------------------------------------------------- /contracts/tokens/OZStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /* 4 | * @dev It is the contract that contains the storage items related to the ERC20 contract implementaiton 5 | * of the openzeppelin-solidity. Used to allow the storage declaration of ERC20 to the STGetter contract 6 | */ 7 | 8 | contract OZStorage { 9 | 10 | mapping (address => uint256) private _balances; 11 | 12 | mapping (address => mapping (address => uint256)) private _allowed; 13 | 14 | uint256 private _totalSupply; 15 | 16 | /// @dev counter to allow mutex lock with only one SSTORE operation 17 | uint256 private _guardCounter; 18 | 19 | function totalSupply() internal view returns (uint256) { 20 | return _totalSupply; 21 | } 22 | 23 | function balanceOf(address _investor) internal view returns(uint256) { 24 | return _balances[_investor]; 25 | } 26 | 27 | function _allowance(address owner, address spender) internal view returns(uint256) { 28 | return _allowed[owner][spender]; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /docs/api/statuscodes.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-StatusCodes 3 | title: StatusCodes 4 | original_id: StatusCodes 5 | --- 6 | 7 | # StatusCodes.sol 8 | 9 | View Source: [contracts/libraries/StatusCodes.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/libraries/StatusCodes.sol) 10 | 11 | **StatusCodes** 12 | 13 | **Enums** 14 | 15 | ### Status 16 | 17 | ```javascript 18 | enum Status { 19 | TransferFailure, 20 | TransferSuccess, 21 | InsufficientBalance, 22 | InsufficientAllowance, 23 | TransfersHalted, 24 | FundsLocked, 25 | InvalidSender, 26 | InvalidReceiver, 27 | InvalidOperator 28 | } 29 | ``` 30 | 31 | ## Functions 32 | 33 | * [code\(enum StatusCodes.Status \_status\)](statuscodes.md#code) 34 | 35 | ### code 36 | 37 | ```javascript 38 | function code(enum StatusCodes.Status _status) internal pure 39 | returns(bytes1) 40 | ``` 41 | 42 | **Arguments** 43 | 44 | | Name | Type | Description | 45 | | :--- | :--- | :--- | 46 | | \_status | enum StatusCodes.Status | | 47 | 48 | -------------------------------------------------------------------------------- /docs/api/cappedstostorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-CappedSTOStorage 3 | title: CappedSTOStorage 4 | original_id: CappedSTOStorage 5 | --- 6 | 7 | # Contract used to store layout for the CappedSTO storage \(CappedSTOStorage.sol\) 8 | 9 | View Source: [contracts/modules/STO/Capped/CappedSTOStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/STO/Capped/CappedSTOStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**CappedSTO**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/CappedSTO.md)**,** [**CappedSTOProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/CappedSTOProxy.md) 12 | 13 | **CappedSTOStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | bool public allowBeneficialInvestments; 21 | uint256 public rate; 22 | uint256 public cap; 23 | mapping(address => uint256) public investors; 24 | ``` 25 | 26 | ## Functions 27 | 28 | -------------------------------------------------------------------------------- /docs/api/mockstgetter.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-MockSTGetter 3 | title: MockSTGetter 4 | original_id: MockSTGetter 5 | --- 6 | 7 | # Security Token contract \(mock\) \(MockSTGetter.sol\) 8 | 9 | View Source: [contracts/mocks/MockSTGetter.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/MockSTGetter.sol) 10 | 11 | **↗ Extends:** [**STGetter**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/STGetter.md) 12 | 13 | **MockSTGetter** 14 | 15 | SecurityToken is an ERC1400 token with added capabilities: 16 | 17 | **Events** 18 | 19 | ```javascript 20 | event UpgradeEvent(uint256 _upgrade); 21 | ``` 22 | 23 | ## Functions 24 | 25 | * [newGetter\(uint256 \_upgrade\)](mockstgetter.md#newgetter) 26 | 27 | ### newGetter 28 | 29 | ```javascript 30 | function newGetter(uint256 _upgrade) public nonpayable 31 | ``` 32 | 33 | **Arguments** 34 | 35 | | Name | Type | Description | 36 | | :--- | :--- | :--- | 37 | | \_upgrade | uint256 | | 38 | 39 | -------------------------------------------------------------------------------- /docs/api/moduleregistryproxy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-ModuleRegistryProxy 3 | title: ModuleRegistryProxy 4 | original_id: ModuleRegistryProxy 5 | --- 6 | 7 | # ModuleRegistryProxy \(ModuleRegistryProxy.sol\) 8 | 9 | View Source: [contracts/proxy/ModuleRegistryProxy.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/proxy/ModuleRegistryProxy.sol) 10 | 11 | **↗ Extends:** [**EternalStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/EternalStorage.md)**,** [**OwnedUpgradeabilityProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/OwnedUpgradeabilityProxy.md) 12 | 13 | **ModuleRegistryProxy** 14 | 15 | This proxy holds the storage of the ModuleRegistry contract and delegates every call to the current implementation set. Besides, it allows upgrading the contract's behaviour towards further implementations, and provides basic authorization control functionalities 16 | 17 | ## Functions 18 | 19 | -------------------------------------------------------------------------------- /contracts/interfaces/IPoly.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title ERC20 interface 5 | * @dev see https://github.com/ethereum/EIPs/issues/20 6 | */ 7 | interface IPoly { 8 | function decimals() external view returns(uint8); 9 | function totalSupply() external view returns(uint256); 10 | function balanceOf(address _owner) external view returns(uint256); 11 | function allowance(address _owner, address _spender) external view returns(uint256); 12 | function transfer(address _to, uint256 _value) external returns(bool); 13 | function transferFrom(address _from, address _to, uint256 _value) external returns(bool); 14 | function approve(address _spender, uint256 _value) external returns(bool); 15 | function decreaseApproval(address _spender, uint _subtractedValue) external returns(bool); 16 | function increaseApproval(address _spender, uint _addedValue) external returns(bool); 17 | event Transfer(address indexed from, address indexed to, uint256 value); 18 | event Approval(address indexed owner, address indexed spender, uint256 value); 19 | } 20 | -------------------------------------------------------------------------------- /contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | contract WeightedVoteCheckpointStorage { 4 | 5 | struct Ballot { 6 | uint256 checkpointId; // Checkpoint At which ballot created 7 | uint256 quorum; // Should be a multiple of 10 ** 16 8 | uint64 startTime; // Timestamp at which ballot will come into effect 9 | uint64 endTime; // Timestamp at which ballot will no more into effect 10 | uint64 totalProposals; // Count of proposals allowed for a given ballot 11 | uint56 totalVoters; // Count of voters who vote for the given ballot 12 | bool isActive; // flag used to turn off/on the ballot 13 | mapping(uint256 => uint256) proposalToVotes; // Mapping for proposal to total weight collected by the proposal 14 | mapping(address => uint256) investorToProposal; // mapping for storing vote details of a voter 15 | mapping(address => bool) exemptedVoters; // Mapping for blacklist voters 16 | } 17 | 18 | Ballot[] ballots; 19 | } 20 | -------------------------------------------------------------------------------- /contracts/datastore/DataStoreProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../proxy/Proxy.sol"; 4 | import "./DataStoreStorage.sol"; 5 | 6 | /** 7 | * @title DataStoreProxy Proxy 8 | */ 9 | contract DataStoreProxy is DataStoreStorage, Proxy { 10 | 11 | /** 12 | * @notice Constructor 13 | * @param _securityToken Address of the security token 14 | * @param _implementation representing the address of the new implementation to be set 15 | */ 16 | constructor( 17 | address _securityToken, 18 | address _implementation 19 | ) 20 | public 21 | { 22 | require(_implementation != address(0) && _securityToken != address(0), 23 | "Address should not be 0x" 24 | ); 25 | securityToken = ISecurityToken(_securityToken); 26 | __implementation = _implementation; 27 | } 28 | 29 | /** 30 | * @notice Internal function to provide the address of the implementation contract 31 | */ 32 | function _implementation() internal view returns(address) { 33 | return __implementation; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /docs/api/counttransfermanagerstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-CountTransferManagerStorage 3 | title: CountTransferManagerStorage 4 | original_id: CountTransferManagerStorage 5 | --- 6 | 7 | # Contract used to store layout for the CountTransferManager storage \(CountTransferManagerStorage.sol\) 8 | 9 | View Source: [contracts/modules/TransferManager/CTM/CountTransferManagerStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/TransferManager/CTM/CountTransferManagerStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**CountTransferManager**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/CountTransferManager.md)**,** [**CountTransferManagerProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/CountTransferManagerProxy.md) 12 | 13 | **CountTransferManagerStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | uint256 public maxHolderCount; 21 | ``` 22 | 23 | ## Functions 24 | 25 | -------------------------------------------------------------------------------- /docs/api/icheckpermission.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-ICheckPermission 3 | title: ICheckPermission 4 | original_id: ICheckPermission 5 | --- 6 | 7 | # ICheckPermission.sol 8 | 9 | View Source: [contracts/interfaces/ICheckPermission.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/interfaces/ICheckPermission.sol) 10 | 11 | **ICheckPermission** 12 | 13 | ## Functions 14 | 15 | * [checkPermission\(address \_delegate, address \_module, bytes32 \_perm\)](icheckpermission.md#checkpermission) 16 | 17 | ### checkPermission 18 | 19 | Validate permissions with PermissionManager if it exists, If no Permission return false 20 | 21 | ```javascript 22 | function checkPermission(address _delegate, address _module, bytes32 _perm) external view 23 | returns(hasPerm bool) 24 | ``` 25 | 26 | **Returns** 27 | 28 | success 29 | 30 | **Arguments** 31 | 32 | | Name | Type | Description | 33 | | :--- | :--- | :--- | 34 | | \_delegate | address | address of delegate | 35 | | \_module | address | address of PermissionManager module | 36 | | \_perm | bytes32 | the permissions | 37 | 38 | -------------------------------------------------------------------------------- /contracts/modules/Wallet/VestingEscrowWalletProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./VestingEscrowWalletStorage.sol"; 5 | import "../../Pausable.sol"; 6 | import "../../storage/modules/ModuleStorage.sol"; 7 | /** 8 | * @title Escrow wallet module for vesting functionality 9 | */ 10 | contract VestingEscrowWalletProxy is VestingEscrowWalletStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 11 | /** 12 | * @notice Constructor 13 | * @param _securityToken Address of the security token 14 | * @param _polyAddress Address of the polytoken 15 | * @param _implementation representing the address of the new implementation to be set 16 | */ 17 | constructor (string memory _version, address _securityToken, address _polyAddress, address _implementation) 18 | public 19 | ModuleStorage(_securityToken, _polyAddress) 20 | { 21 | require( 22 | _implementation != address(0), 23 | "Implementation address should not be 0x" 24 | ); 25 | _upgradeTo(_version, _implementation); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /contracts/libraries/Encoder.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | library Encoder { 4 | function getKey(string memory _key) internal pure returns(bytes32) { 5 | return bytes32(keccak256(abi.encodePacked(_key))); 6 | } 7 | 8 | function getKey(string memory _key1, address _key2) internal pure returns(bytes32) { 9 | return bytes32(keccak256(abi.encodePacked(_key1, _key2))); 10 | } 11 | 12 | function getKey(string memory _key1, string memory _key2) internal pure returns(bytes32) { 13 | return bytes32(keccak256(abi.encodePacked(_key1, _key2))); 14 | } 15 | 16 | function getKey(string memory _key1, uint256 _key2) internal pure returns(bytes32) { 17 | return bytes32(keccak256(abi.encodePacked(_key1, _key2))); 18 | } 19 | 20 | function getKey(string memory _key1, bytes32 _key2) internal pure returns(bytes32) { 21 | return bytes32(keccak256(abi.encodePacked(_key1, _key2))); 22 | } 23 | 24 | function getKey(string memory _key1, bool _key2) internal pure returns(bytes32) { 25 | return bytes32(keccak256(abi.encodePacked(_key1, _key2))); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /docs/api/securitytokenmock.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-SecurityTokenMock 3 | title: SecurityTokenMock 4 | original_id: SecurityTokenMock 5 | --- 6 | 7 | # SecurityTokenMock.sol 8 | 9 | View Source: [contracts/mocks/SecurityTokenMock.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/SecurityTokenMock.sol) 10 | 11 | **↗ Extends:** [**SecurityToken**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/SecurityToken.md) 12 | 13 | **SecurityTokenMock** 14 | 15 | ## Functions 16 | 17 | * [initialize\(address \_getterDelegate\)](securitytokenmock.md#initialize) 18 | 19 | ### initialize 20 | 21 | ⤾ overrides [SecurityToken.initialize](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/SecurityToken.md#initialize) 22 | 23 | Initialization function 24 | 25 | ```javascript 26 | function initialize(address _getterDelegate) public nonpayable 27 | ``` 28 | 29 | **Arguments** 30 | 31 | | Name | Type | Description | 32 | | :--- | :--- | :--- | 33 | | \_getterDelegate | address | | 34 | 35 | -------------------------------------------------------------------------------- /contracts/storage/modules/ModuleStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; 4 | import "../../interfaces/ISecurityToken.sol"; 5 | /** 6 | * @title Storage for Module contract 7 | * @notice Contract is abstract 8 | */ 9 | contract ModuleStorage { 10 | address public factory; 11 | 12 | ISecurityToken public securityToken; 13 | 14 | // Permission flag 15 | bytes32 public constant ADMIN = "ADMIN"; 16 | bytes32 public constant OPERATOR = "OPERATOR"; 17 | 18 | bytes32 internal constant TREASURY = 0xaae8817359f3dcb67d050f44f3e49f982e0359d90ca4b5f18569926304aaece6; // keccak256(abi.encodePacked("TREASURY_WALLET")) 19 | 20 | IERC20 public polyToken; 21 | 22 | /** 23 | * @notice Constructor 24 | * @param _securityToken Address of the security token 25 | * @param _polyAddress Address of the polytoken 26 | */ 27 | constructor(address _securityToken, address _polyAddress) public { 28 | securityToken = ISecurityToken(_securityToken); 29 | factory = msg.sender; 30 | polyToken = IERC20(_polyAddress); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /docs/api/securitytokenregistryproxy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-SecurityTokenRegistryProxy 3 | title: SecurityTokenRegistryProxy 4 | original_id: SecurityTokenRegistryProxy 5 | --- 6 | 7 | # SecurityTokenRegistryProxy \(SecurityTokenRegistryProxy.sol\) 8 | 9 | View Source: [contracts/proxy/SecurityTokenRegistryProxy.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/proxy/SecurityTokenRegistryProxy.sol) 10 | 11 | **↗ Extends:** [**EternalStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/EternalStorage.md)**,** [**OwnedUpgradeabilityProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/OwnedUpgradeabilityProxy.md) 12 | 13 | **SecurityTokenRegistryProxy** 14 | 15 | This proxy holds the storage of the SecurityTokenRegistry contract and delegates every call to the current implementation set. Besides, it allows to upgrade the SecurityTokenRegistry's behaviour towards further implementations, and provides basic authorization control functionalities 16 | 17 | ## Functions 18 | 19 | -------------------------------------------------------------------------------- /docs/api/erc20dividendcheckpointstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-ERC20DividendCheckpointStorage 3 | title: ERC20DividendCheckpointStorage 4 | original_id: ERC20DividendCheckpointStorage 5 | --- 6 | 7 | # It holds the storage variables related to ERC20DividendCheckpoint module \(ERC20DividendCheckpointSto 8 | 9 | View Source: [contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**ERC20DividendCheckpoint**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ERC20DividendCheckpoint.md)**,** [**ERC20DividendCheckpointProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ERC20DividendCheckpointProxy.md) 12 | 13 | **ERC20DividendCheckpointStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | mapping(uint256 => address) public dividendTokens; 21 | ``` 22 | 23 | ## Functions 24 | 25 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/BTM/BlacklistTransferManagerStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Contract used to store layout for the CountTransferManager storage 5 | */ 6 | contract BlacklistTransferManagerStorage { 7 | 8 | struct BlacklistsDetails { 9 | uint256 startTime; 10 | uint256 endTime; 11 | uint256 repeatPeriodTime; 12 | } 13 | 14 | //hold the different blacklist details corresponds to its name 15 | mapping(bytes32 => BlacklistsDetails) public blacklists; 16 | 17 | //hold the different name of blacklist corresponds to a investor 18 | mapping(address => bytes32[]) investorToBlacklist; 19 | 20 | //get list of the addresses for a particular blacklist 21 | mapping(bytes32 => address[]) blacklistToInvestor; 22 | 23 | //mapping use to store the indexes for different blacklist types for a investor 24 | mapping(address => mapping(bytes32 => uint256)) investorToIndex; 25 | 26 | //mapping use to store the indexes for different investor for a blacklist type 27 | mapping(bytes32 => mapping(address => uint256)) blacklistToIndex; 28 | 29 | bytes32[] allBlacklists; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/PTM/PercentageTransferManagerProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./PercentageTransferManagerStorage.sol"; 5 | import "../../../Pausable.sol"; 6 | import "../../../storage/modules/ModuleStorage.sol"; 7 | 8 | /** 9 | * @title PercentageTransferManager module Proxy 10 | */ 11 | contract PercentageTransferManagerProxy is PercentageTransferManagerStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 12 | 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | * @param _polyAddress Address of the polytoken 17 | * @param _implementation representing the address of the new implementation to be set 18 | */ 19 | constructor (string memory _version, address _securityToken, address _polyAddress, address _implementation) 20 | public 21 | ModuleStorage(_securityToken, _polyAddress) 22 | { 23 | require( 24 | _implementation != address(0), 25 | "Implementation address should not be 0x" 26 | ); 27 | _upgradeTo(_version, _implementation); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/VRTM/VolumeRestrictionTMProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./VolumeRestrictionTMStorage.sol"; 5 | import "../../../Pausable.sol"; 6 | import "../../../storage/modules/ModuleStorage.sol"; 7 | 8 | /** 9 | * @title Transfer Manager module for core transfer validation functionality 10 | */ 11 | contract VolumeRestrictionTMProxy is VolumeRestrictionTMStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 12 | 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | * @param _polyAddress Address of the polytoken 17 | * @param _implementation representing the address of the new implementation to be set 18 | */ 19 | constructor (string memory _version, address _securityToken, address _polyAddress, address _implementation) 20 | public 21 | ModuleStorage(_securityToken, _polyAddress) 22 | { 23 | require( 24 | _implementation != address(0), 25 | "Implementation address should not be 0x" 26 | ); 27 | _upgradeTo(_version, _implementation); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /contracts/modules/STO/USDTiered/USDTieredSTOProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./USDTieredSTOStorage.sol"; 5 | import "../../../Pausable.sol"; 6 | import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; 7 | import "../../../storage/modules/STO/STOStorage.sol"; 8 | import "../../../storage/modules/ModuleStorage.sol"; 9 | 10 | /** 11 | * @title USDTiered STO module Proxy 12 | */ 13 | contract USDTieredSTOProxy is USDTieredSTOStorage, STOStorage, ModuleStorage, Pausable, ReentrancyGuard, OwnedUpgradeabilityProxy { 14 | /** 15 | * @notice Constructor 16 | * @param _securityToken Address of the security token 17 | * @param _polyAddress Address of the polytoken 18 | * @param _implementation representing the address of the new implementation to be set 19 | */ 20 | constructor (string memory _version, address _securityToken, address _polyAddress, address _implementation) public ModuleStorage(_securityToken, _polyAddress) { 21 | require(_implementation != address(0), "Implementation address should not be 0x"); 22 | _upgradeTo(_version, _implementation); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /docs/api/mockmoduleregistry.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-MockModuleRegistry 3 | title: MockModuleRegistry 4 | original_id: MockModuleRegistry 5 | --- 6 | 7 | # Registry contract for issuers to register their security tokens \(MockModuleRegistry.sol\) 8 | 9 | View Source: [contracts/mocks/MockModuleRegistry.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/MockModuleRegistry.sol) 10 | 11 | **↗ Extends:** [**ModuleRegistry**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ModuleRegistry.md) 12 | 13 | **MockModuleRegistry** 14 | 15 | ## Functions 16 | 17 | * [addMoreReputation\(address \_moduleFactory, address\[\] \_tokens\)](mockmoduleregistry.md#addmorereputation) 18 | 19 | ### addMoreReputation 20 | 21 | It is dummy functionality Alert! Alert! Do not use it for the mainnet release 22 | 23 | ```javascript 24 | function addMoreReputation(address _moduleFactory, address[] _tokens) public nonpayable onlyOwner 25 | ``` 26 | 27 | **Arguments** 28 | 29 | | Name | Type | Description | 30 | | :--- | :--- | :--- | 31 | | \_moduleFactory | address | | 32 | | \_tokens | address\[\] | | 33 | 34 | -------------------------------------------------------------------------------- /CLI/commands/helpers/csv.js: -------------------------------------------------------------------------------- 1 | const csvParse = require('csv-parse/lib/sync'); 2 | const fs = require('fs'); 3 | const web3Utils = require('web3-utils'); 4 | 5 | function _cast(obj) { 6 | if (/^(\-|\+)?([1-9]+[0-9]*)$/.test(obj)) { // Int 7 | obj = parseInt(obj); 8 | } 9 | else if (/^[+-]?([0-9]*[.])?[0-9]+$/.test(obj)) { // Float 10 | obj = parseFloat(obj); 11 | } 12 | else if (/^(\d{1,2})[-\/](\d{1,2})[-\/](\d{4})$/.test(obj)) { // Datetime 13 | var matches = /^(\d{1,2})[-\/](\d{1,2})[-\/](\d{4})$/.exec(obj); 14 | var composedDate = new Date(matches[3], matches[1] - 1, matches[2]); 15 | var timestampDate = composedDate.getTime(); 16 | obj = timestampDate / 1000; 17 | } 18 | else if (obj.toLowerCase() === "true" || obj.toLowerCase() === "false") { // Boolean 19 | obj = JSON.parse(obj.toLowerCase()); 20 | } else if (web3Utils.isAddress(obj)) { 21 | obj = web3Utils.toChecksumAddress(obj); 22 | } 23 | return obj; 24 | } 25 | 26 | function parse(_csvFilePath, _batchSize) { 27 | // Read file 28 | let input = fs.readFileSync(_csvFilePath); 29 | // Parse csv 30 | let data = csvParse(input, { cast: _cast }); 31 | 32 | return data; 33 | } 34 | 35 | module.exports = parse; -------------------------------------------------------------------------------- /contracts/modules/TransferManager/CTM/CountTransferManagerProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./CountTransferManagerStorage.sol"; 5 | import "../../../Pausable.sol"; 6 | import "../../../storage/modules/ModuleStorage.sol"; 7 | 8 | /** 9 | * @title CountTransferManager module Proxy 10 | */ 11 | contract CountTransferManagerProxy is CountTransferManagerStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 12 | 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | * @param _polyAddress Address of the polytoken 17 | * @param _implementation representing the address of the new implementation to be set 18 | */ 19 | constructor ( 20 | string memory _version, 21 | address _securityToken, 22 | address _polyAddress, 23 | address _implementation 24 | ) 25 | public 26 | ModuleStorage(_securityToken, _polyAddress) 27 | { 28 | require( 29 | _implementation != address(0), 30 | "Implementation address should not be 0x" 31 | ); 32 | _upgradeTo(_version, _implementation); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /docs/api/datastorefactory.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-DataStoreFactory 3 | title: DataStoreFactory 4 | original_id: DataStoreFactory 5 | --- 6 | 7 | # DataStoreFactory.sol 8 | 9 | View Source: [contracts/datastore/DataStoreFactory.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/datastore/DataStoreFactory.sol) 10 | 11 | **DataStoreFactory** 12 | 13 | ## Contract Members 14 | 15 | **Constants & Variables** 16 | 17 | ```javascript 18 | address public implementation; 19 | ``` 20 | 21 | ## Functions 22 | 23 | * [\(address \_implementation\)](datastorefactory.md) 24 | * [generateDataStore\(address \_securityToken\)](datastorefactory.md#generatedatastore) 25 | 26 | ```javascript 27 | function (address _implementation) public nonpayable 28 | ``` 29 | 30 | **Arguments** 31 | 32 | | Name | Type | Description | 33 | | :--- | :--- | :--- | 34 | | \_implementation | address | | 35 | 36 | ### generateDataStore 37 | 38 | ```javascript 39 | function generateDataStore(address _securityToken) public nonpayable 40 | returns(address) 41 | ``` 42 | 43 | **Arguments** 44 | 45 | | Name | Type | Description | 46 | | :--- | :--- | :--- | 47 | | \_securityToken | address | | 48 | 49 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/LTM/LockUpTransferManagerProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./LockUpTransferManagerStorage.sol"; 4 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 5 | import "../../../Pausable.sol"; 6 | import "../../../storage/modules/ModuleStorage.sol"; 7 | 8 | /** 9 | * @title CountTransferManager module Proxy 10 | */ 11 | contract LockUpTransferManagerProxy is LockUpTransferManagerStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 12 | 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | * @param _polyAddress Address of the polytoken 17 | * @param _implementation representing the address of the new implementation to be set 18 | */ 19 | constructor ( 20 | string memory _version, 21 | address _securityToken, 22 | address _polyAddress, 23 | address _implementation 24 | ) 25 | public 26 | ModuleStorage(_securityToken, _polyAddress) 27 | { 28 | require( 29 | _implementation != address(0), 30 | "Implementation address should not be 0x" 31 | ); 32 | _upgradeTo(_version, _implementation); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/BTM/BlacklistTransferManagerProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./BlacklistTransferManagerStorage.sol"; 5 | import "../../../Pausable.sol"; 6 | import "../../../storage/modules/ModuleStorage.sol"; 7 | 8 | /** 9 | * @title CountTransferManager module Proxy 10 | */ 11 | contract BlacklistTransferManagerProxy is BlacklistTransferManagerStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 12 | 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | * @param _polyAddress Address of the polytoken 17 | * @param _implementation representing the address of the new implementation to be set 18 | */ 19 | constructor ( 20 | string memory _version, 21 | address _securityToken, 22 | address _polyAddress, 23 | address _implementation 24 | ) 25 | public 26 | ModuleStorage(_securityToken, _polyAddress) 27 | { 28 | require( 29 | _implementation != address(0), 30 | "Implementation address should not be 0x" 31 | ); 32 | _upgradeTo(_version, _implementation); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /docs/api/percentagetransfermanagerstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-PercentageTransferManagerStorage 3 | title: PercentageTransferManagerStorage 4 | original_id: PercentageTransferManagerStorage 5 | --- 6 | 7 | # Contract used to store layout for the PercentageTransferManager storage \(PercentageTransferManagerSt 8 | 9 | View Source: [contracts/modules/TransferManager/PTM/PercentageTransferManagerStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/TransferManager/PTM/PercentageTransferManagerStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**PercentageTransferManager**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PercentageTransferManager.md)**,** [**PercentageTransferManagerProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PercentageTransferManagerProxy.md) 12 | 13 | **PercentageTransferManagerStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | uint256 public maxHolderPercentage; 21 | bool public allowPrimaryIssuance; 22 | mapping(address => bool) public whitelist; 23 | ``` 24 | 25 | ## Functions 26 | 27 | -------------------------------------------------------------------------------- /docs/api/votingcheckpointstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-VotingCheckpointStorage 3 | title: VotingCheckpointStorage 4 | original_id: VotingCheckpointStorage 5 | --- 6 | 7 | # VotingCheckpointStorage.sol 8 | 9 | View Source: [contracts/storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**PLCRVotingCheckpointProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PLCRVotingCheckpointProxy.md)**,** [**VotingCheckpoint**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/VotingCheckpoint.md)**,** [**WeightedVoteCheckpointProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/WeightedVoteCheckpointProxy.md) 12 | 13 | **VotingCheckpointStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | mapping(address => uint256) internal defaultExemptIndex; 21 | address[] internal defaultExemptedVoters; 22 | ``` 23 | 24 | ## Functions 25 | 26 | -------------------------------------------------------------------------------- /contracts/modules/STO/PreSale/PreSaleSTOProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "../../../Pausable.sol"; 5 | import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; 6 | import "../../../storage/modules/STO/STOStorage.sol"; 7 | import "../../../storage/modules/ModuleStorage.sol"; 8 | import "./PreSaleSTOStorage.sol"; 9 | 10 | /** 11 | * @title PreSaleSTO module Proxy 12 | */ 13 | contract PreSaleSTOProxy is PreSaleSTOStorage, STOStorage, ModuleStorage, Pausable, ReentrancyGuard, OwnedUpgradeabilityProxy { 14 | 15 | /** 16 | * @notice Constructor 17 | * @param _securityToken Address of the security token 18 | * @param _polyAddress Address of the polytoken 19 | * @param _implementation representing the address of the new implementation to be set 20 | */ 21 | constructor (string memory _version, address _securityToken, address _polyAddress, address _implementation) 22 | public 23 | ModuleStorage(_securityToken, _polyAddress) 24 | { 25 | require( 26 | _implementation != address(0), 27 | "Implementation address should not be 0x" 28 | ); 29 | _upgradeTo(_version, _implementation); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpointProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "../../../../storage/modules/Checkpoint/Dividend/DividendCheckpointStorage.sol"; 5 | import "../../../../Pausable.sol"; 6 | import "../../../../storage/modules/ModuleStorage.sol"; 7 | 8 | /** 9 | * @title Transfer Manager module for core transfer validation functionality 10 | */ 11 | contract EtherDividendCheckpointProxy is DividendCheckpointStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 12 | /** 13 | * @notice Constructor 14 | * @param _securityToken Address of the security token 15 | * @param _polyAddress Address of the polytoken 16 | * @param _implementation representing the address of the new implementation to be set 17 | */ 18 | constructor ( 19 | string memory _version, 20 | address _securityToken, 21 | address _polyAddress, 22 | address _implementation 23 | ) 24 | public 25 | ModuleStorage(_securityToken, _polyAddress) 26 | { 27 | require(_implementation != address(0), "Implementation address should not be 0x"); 28 | _upgradeTo(_version, _implementation); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./ManualApprovalTransferManagerStorage.sol"; 5 | import "../../../Pausable.sol"; 6 | import "../../../storage/modules/ModuleStorage.sol"; 7 | 8 | /** 9 | @title ManualApprovalTransferManager module Proxy 10 | */ 11 | contract ManualApprovalTransferManagerProxy is ManualApprovalTransferManagerStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 12 | 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | * @param _polyAddress Address of the polytoken 17 | * @param _implementation representing the address of the new implementation to be set 18 | */ 19 | constructor ( 20 | string memory _version, 21 | address _securityToken, 22 | address _polyAddress, 23 | address _implementation 24 | ) 25 | public 26 | ModuleStorage(_securityToken, _polyAddress) 27 | { 28 | require( 29 | _implementation != address(0), 30 | "Implementation address should not be 0x" 31 | ); 32 | _upgradeTo(_version, _implementation); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /docs/api/generalpermissionmanagerstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-GeneralPermissionManagerStorage 3 | title: GeneralPermissionManagerStorage 4 | original_id: GeneralPermissionManagerStorage 5 | --- 6 | 7 | # Contract used to store layout for the GeneralPermissionManager storage \(GeneralPermissionManagerStor 8 | 9 | View Source: [contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**GeneralPermissionManager**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/GeneralPermissionManager.md)**,** [**GeneralPermissionManagerProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/GeneralPermissionManagerProxy.md) 12 | 13 | **GeneralPermissionManagerStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | mapping(address => mapping(address => mapping(bytes32 => bool))) public perms; 21 | mapping(address => bytes32) public delegateDetails; 22 | address[] public allDelegates; 23 | ``` 24 | 25 | ## Functions 26 | 27 | -------------------------------------------------------------------------------- /contracts/PolymathRegistry.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./ReclaimTokens.sol"; 4 | import "./interfaces/IPolymathRegistry.sol"; 5 | 6 | /** 7 | * @title Core functionality for registry upgradability 8 | */ 9 | contract PolymathRegistry is ReclaimTokens, IPolymathRegistry { 10 | mapping(bytes32 => address) public storedAddresses; 11 | 12 | /** 13 | * @notice Gets the contract address 14 | * @param _nameKey is the key for the contract address mapping 15 | * @return address 16 | */ 17 | function getAddress(string calldata _nameKey) external view returns(address) { 18 | bytes32 key = keccak256(bytes(_nameKey)); 19 | require(storedAddresses[key] != address(0), "Invalid key"); 20 | return storedAddresses[key]; 21 | } 22 | 23 | /** 24 | * @notice Changes the contract address 25 | * @param _nameKey is the key for the contract address mapping 26 | * @param _newAddress is the new contract address 27 | */ 28 | function changeAddress(string calldata _nameKey, address _newAddress) external onlyOwner { 29 | bytes32 key = keccak256(bytes(_nameKey)); 30 | emit ChangeAddress(_nameKey, storedAddresses[key], _newAddress); 31 | storedAddresses[key] = _newAddress; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../../Pausable.sol"; 4 | import "./PLCRVotingCheckpointStorage.sol"; 5 | import "../../../../storage/modules/ModuleStorage.sol"; 6 | import "../../../../proxy/OwnedUpgradeabilityProxy.sol"; 7 | import "../../../../storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol"; 8 | 9 | /** 10 | * @title Voting module for governance 11 | */ 12 | contract PLCRVotingCheckpointProxy is PLCRVotingCheckpointStorage, VotingCheckpointStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | * @param _polyAddress Address of the polytoken 17 | * @param _implementation representing the address of the new implementation to be set 18 | */ 19 | constructor( 20 | string memory _version, 21 | address _securityToken, 22 | address _polyAddress, 23 | address _implementation 24 | ) 25 | public 26 | ModuleStorage(_securityToken, _polyAddress) 27 | { 28 | require(_implementation != address(0), "Implementation address should not be 0x"); 29 | _upgradeTo(_version, _implementation); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /contracts/mocks/Dummy/DummySTOProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "../../Pausable.sol"; 5 | import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; 6 | import "../../storage/modules/STO/STOStorage.sol"; 7 | import "../../storage/modules/ModuleStorage.sol"; 8 | import "./DummySTOStorage.sol"; 9 | 10 | /** 11 | * @title DummySTO module Proxy 12 | */ 13 | contract DummySTOProxy is DummySTOStorage, STOStorage, ModuleStorage, Pausable, ReentrancyGuard, OwnedUpgradeabilityProxy { 14 | 15 | /** 16 | * @notice Constructor 17 | * @param _securityToken Address of the security token 18 | * @param _polyAddress Address of the polytoken 19 | * @param _implementation representing the address of the new implementation to be set 20 | */ 21 | constructor ( 22 | string memory _version, 23 | address _securityToken, 24 | address _polyAddress, 25 | address _implementation 26 | ) 27 | public 28 | ModuleStorage(_securityToken, _polyAddress) 29 | { 30 | require( 31 | _implementation != address(0), 32 | "Implementation address should not be 0x" 33 | ); 34 | _upgradeTo(_version, _implementation); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /docs/misc/ethereum_status_codes.md: -------------------------------------------------------------------------------- 1 | # ethereum\_status\_codes 2 | 3 | ## For ERC1400 4 | 5 | | Code | Reason | 6 | | :--- | :--- | 7 | | `0x50` | transfer failure | 8 | | `0x51` | transfer success | 9 | | `0x52` | insufficient balance | 10 | | `0x53` | insufficient allowance | 11 | | `0x54` | transfers halted \(contract paused\) | 12 | | `0x55` | funds locked \(lockup period\) | 13 | | `0x56` | invalid sender | 14 | | `0x57` | invalid receiver | 15 | | `0x58` | invalid operator \(transfer agent\) | 16 | | `0x59` | | 17 | | `0x5a` | | 18 | | `0x5b` | | 19 | | `0x5a` | | 20 | | `0x5b` | | 21 | | `0x5c` | | 22 | | `0x5d` | | 23 | | `0x5e` | | 24 | | `0x5f` | token meta or info | 25 | 26 | ## For Application specific \(Polymath\) 27 | 28 | | Code | Reason | 29 | | :--- | :--- | 30 | | `0xA0` | Not affected | 31 | | `0xA1` | Success | 32 | | `0xA2` | Max holders reach | 33 | | `0xA3` | Manual Approval Expired | 34 | | `0xA4` | funds limit reached | 35 | | `0xA5` | Tx Volume limit reached | 36 | | `0xA6` | Blacklisted tx | 37 | | `0xA7` | funds locked \(lockup period\) | 38 | | `0xA8` | Invalid granularity | 39 | | `0xA9` | | 40 | | `0xAa` | | 41 | | `0xAb` | | 42 | | `0xAa` | | 43 | | `0xAb` | | 44 | | `0xAc` | | 45 | | `0xAd` | | 46 | | `0xAe` | | 47 | | `0xAf` | token meta or info | 48 | 49 | -------------------------------------------------------------------------------- /contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../../Pausable.sol"; 4 | import "./WeightedVoteCheckpointStorage.sol"; 5 | import "../../../../storage/modules/ModuleStorage.sol"; 6 | import "../../../../proxy/OwnedUpgradeabilityProxy.sol"; 7 | import "../../../../storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol"; 8 | 9 | /** 10 | * @title Voting module for governance 11 | */ 12 | contract WeightedVoteCheckpointProxy is WeightedVoteCheckpointStorage, VotingCheckpointStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | * @param _polyAddress Address of the polytoken 17 | * @param _implementation representing the address of the new implementation to be set 18 | */ 19 | constructor( 20 | string memory _version, 21 | address _securityToken, 22 | address _polyAddress, 23 | address _implementation 24 | ) 25 | public 26 | ModuleStorage(_securityToken, _polyAddress) 27 | { 28 | require(_implementation != address(0), "Implementation address should not be 0x"); 29 | _upgradeTo(_version, _implementation); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/TransferManager.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../Module.sol"; 4 | import "../../interfaces/ITransferManager.sol"; 5 | 6 | /** 7 | * @title Base abstract contract to be implemented by all Transfer Manager modules 8 | */ 9 | contract TransferManager is ITransferManager, Module { 10 | 11 | bytes32 public constant LOCKED = "LOCKED"; 12 | bytes32 public constant UNLOCKED = "UNLOCKED"; 13 | 14 | modifier onlySecurityToken() { 15 | require(msg.sender == address(securityToken), "Sender is not owner"); 16 | _; 17 | } 18 | 19 | // Provide default versions of ERC1410 functions that can be overriden 20 | 21 | /** 22 | * @notice return the amount of tokens for a given user as per the partition 23 | * @dev returning the balance of token holder against the UNLOCKED partition. 24 | * This condition is valid only when the base contract doesn't implement the 25 | * `getTokensByPartition()` function. 26 | */ 27 | function getTokensByPartition(bytes32 _partition, address _tokenHolder, uint256 /*_additionalBalance*/) external view returns(uint256) { 28 | if (_partition == UNLOCKED) 29 | return securityToken.balanceOf(_tokenHolder); 30 | return uint256(0); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /contracts/FeatureRegistry.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./ReclaimTokens.sol"; 4 | import "./interfaces/IFeatureRegistry.sol"; 5 | 6 | /** 7 | * @title Registry for managing polymath feature switches 8 | */ 9 | contract FeatureRegistry is IFeatureRegistry, ReclaimTokens { 10 | mapping(bytes32 => bool) public featureStatus; 11 | 12 | /** 13 | * @notice Get the status of a feature 14 | * @param _nameKey is the key for the feature status mapping 15 | * @return bool 16 | */ 17 | function getFeatureStatus(string calldata _nameKey) external view returns(bool) { 18 | bytes32 key = keccak256(bytes(_nameKey)); 19 | return featureStatus[key]; 20 | } 21 | 22 | /** 23 | * @notice change a feature status 24 | * @dev feature status is set to false by default 25 | * @param _nameKey is the key for the feature status mapping 26 | * @param _newStatus is the new feature status 27 | */ 28 | function setFeatureStatus(string calldata _nameKey, bool _newStatus) external onlyOwner { 29 | bytes32 key = keccak256(bytes(_nameKey)); 30 | require(featureStatus[key] != _newStatus, "Status unchanged"); 31 | emit ChangeFeatureStatus(_nameKey, _newStatus); 32 | featureStatus[key] = _newStatus; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /contracts/mocks/MockBurnFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./MockRedemptionManager.sol"; 4 | import "../modules/Experimental/Burn/TrackedRedemptionFactory.sol"; 5 | 6 | /** 7 | * @title Mock Contract Not fit for production environment 8 | */ 9 | 10 | contract MockBurnFactory is TrackedRedemptionFactory { 11 | 12 | /** 13 | * @notice Constructor 14 | * @param _setupCost Setup cost of the module 15 | * @param _polymathRegistry Address of the Polymath Registry 16 | */ 17 | constructor( 18 | uint256 _setupCost, 19 | address _polymathRegistry, 20 | bool _isFeeInPoly 21 | ) 22 | public 23 | TrackedRedemptionFactory(_setupCost, _polymathRegistry, _isFeeInPoly) 24 | { 25 | 26 | } 27 | 28 | /** 29 | * @notice Used to launch the Module with the help of factory 30 | * @return Address Contract address of the Module 31 | */ 32 | function deploy( 33 | bytes calldata _data 34 | ) 35 | external 36 | returns(address) 37 | { 38 | address mockRedemptionManager = address(new MockRedemptionManager(msg.sender, polymathRegistry.getAddress("PolyToken"))); 39 | _initializeModule(mockRedemptionManager, _data); 40 | return mockRedemptionManager; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | contract PLCRVotingCheckpointStorage { 4 | 5 | enum Stage { PREP, COMMIT, REVEAL, RESOLVED } 6 | 7 | struct Ballot { 8 | uint256 checkpointId; // Checkpoint At which ballot created 9 | uint256 quorum; // Should be a multiple of 10 ** 16 10 | uint64 commitDuration; // no. of seconds the commit stage will live 11 | uint64 revealDuration; // no. of seconds the reveal stage will live 12 | uint64 startTime; // Timestamp at which ballot will come into effect 13 | uint24 totalProposals; // Count of proposals allowed for a given ballot 14 | uint32 totalVoters; // Count of voters who vote for the given ballot 15 | bool isActive; // flag used to turn off/on the ballot 16 | mapping(uint256 => uint256) proposalToVotes; // Mapping for proposal to total weight collected by the proposal 17 | mapping(address => Vote) investorToProposal; // mapping for storing vote details of a voter 18 | mapping(address => bool) exemptedVoters; // Mapping for blacklist voters 19 | } 20 | 21 | struct Vote { 22 | uint256 voteOption; 23 | bytes32 secretVote; 24 | } 25 | 26 | Ballot[] ballots; 27 | } 28 | -------------------------------------------------------------------------------- /contracts/modules/STO/Capped/CappedSTOProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "../../../Pausable.sol"; 5 | import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; 6 | import "../../../storage/modules/STO/STOStorage.sol"; 7 | import "../../../storage/modules/ModuleStorage.sol"; 8 | import "./CappedSTOStorage.sol"; 9 | 10 | /** 11 | * @title CappedSTO module Proxy 12 | */ 13 | contract CappedSTOProxy is CappedSTOStorage, STOStorage, ModuleStorage, Pausable, ReentrancyGuard, OwnedUpgradeabilityProxy { 14 | 15 | /** 16 | * @notice Constructor 17 | * @param _securityToken Address of the security token 18 | * @param _polyAddress Address of the polytoken 19 | * @param _implementation representing the address of the new implementation to be set 20 | */ 21 | constructor( 22 | string memory _version, 23 | address _securityToken, 24 | address _polyAddress, 25 | address _implementation 26 | ) 27 | public 28 | ModuleStorage(_securityToken, _polyAddress) 29 | { 30 | require( 31 | _implementation != address(0), 32 | "Implementation address should not be 0x" 33 | ); 34 | _upgradeTo(_version, _implementation); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /contracts/modules/PermissionManager/GeneralPermissionManagerProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "../../Pausable.sol"; 5 | import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; 6 | import "../../storage/modules/ModuleStorage.sol"; 7 | import "./GeneralPermissionManagerStorage.sol"; 8 | 9 | /** 10 | * @title GeneralPermissionManager module Proxy 11 | */ 12 | contract GeneralPermissionManagerProxy is GeneralPermissionManagerStorage, ModuleStorage, Pausable, ReentrancyGuard, OwnedUpgradeabilityProxy { 13 | 14 | /** 15 | * @notice Constructor 16 | * @param _securityToken Address of the security token 17 | * @param _polyAddress Address of the polytoken 18 | * @param _implementation representing the address of the new implementation to be set 19 | */ 20 | constructor ( 21 | string memory _version, 22 | address _securityToken, 23 | address _polyAddress, 24 | address _implementation 25 | ) 26 | public 27 | ModuleStorage(_securityToken, _polyAddress) 28 | { 29 | require( 30 | _implementation != address(0), 31 | "Implementation address should not be 0x" 32 | ); 33 | _upgradeTo(_version, _implementation); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./ERC20DividendCheckpointStorage.sol"; 5 | import "../../../../storage/modules/Checkpoint/Dividend/DividendCheckpointStorage.sol"; 6 | import "../../../../Pausable.sol"; 7 | import "../../../../storage/modules/ModuleStorage.sol"; 8 | 9 | /** 10 | * @title Transfer Manager module for core transfer validation functionality 11 | */ 12 | contract ERC20DividendCheckpointProxy is ERC20DividendCheckpointStorage, DividendCheckpointStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 13 | /** 14 | * @notice Constructor 15 | * @param _securityToken Address of the security token 16 | * @param _polyAddress Address of the polytoken 17 | * @param _implementation representing the address of the new implementation to be set 18 | */ 19 | constructor( 20 | string memory _version, 21 | address _securityToken, 22 | address _polyAddress, 23 | address _implementation 24 | ) 25 | public 26 | ModuleStorage(_securityToken, _polyAddress) 27 | { 28 | require(_implementation != address(0), "Implementation address should not be 0x"); 29 | _upgradeTo(_version, _implementation); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /contracts/interfaces/token/IERC1594.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Standard Interface of ERC1594 5 | */ 6 | interface IERC1594 { 7 | 8 | // Transfers 9 | function transferWithData(address _to, uint256 _value, bytes calldata _data) external; 10 | function transferFromWithData(address _from, address _to, uint256 _value, bytes calldata _data) external; 11 | 12 | // Token Issuance 13 | // Present in the STGetter.sol 14 | //function isIssuable() external view returns (bool); 15 | function issue(address _tokenHolder, uint256 _value, bytes calldata _data) external; 16 | 17 | // Token Redemption 18 | function redeem(uint256 _value, bytes calldata _data) external; 19 | function redeemFrom(address _tokenHolder, uint256 _value, bytes calldata _data) external; 20 | 21 | // Transfer Validity 22 | function canTransfer(address _to, uint256 _value, bytes calldata _data) external view returns (byte, bytes32); 23 | function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (byte, bytes32); 24 | 25 | // Issuance / Redemption Events 26 | event Issued(address indexed _operator, address indexed _to, uint256 _value, bytes _data); 27 | event Redeemed(address indexed _operator, address indexed _from, uint256 _value, bytes _data); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /contracts/Pausable.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Utility contract to allow pausing and unpausing of certain functions 5 | */ 6 | contract Pausable { 7 | event Pause(address account); 8 | event Unpause(address account); 9 | 10 | bool public paused = false; 11 | 12 | /** 13 | * @notice Modifier to make a function callable only when the contract is not paused. 14 | */ 15 | modifier whenNotPaused() { 16 | require(!paused, "Contract is paused"); 17 | _; 18 | } 19 | 20 | /** 21 | * @notice Modifier to make a function callable only when the contract is paused. 22 | */ 23 | modifier whenPaused() { 24 | require(paused, "Contract is not paused"); 25 | _; 26 | } 27 | 28 | /** 29 | * @notice Called by the owner to pause, triggers stopped state 30 | */ 31 | function _pause() internal whenNotPaused { 32 | paused = true; 33 | /*solium-disable-next-line security/no-block-members*/ 34 | emit Pause(msg.sender); 35 | } 36 | 37 | /** 38 | * @notice Called by the owner to unpause, returns to normal state 39 | */ 40 | function _unpause() internal whenPaused { 41 | paused = false; 42 | /*solium-disable-next-line security/no-block-members*/ 43 | emit Unpause(msg.sender); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /docs/api/reclaimtokens.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-ReclaimTokens 3 | title: ReclaimTokens 4 | original_id: ReclaimTokens 5 | --- 6 | 7 | # Utility contract to allow owner to retreive any ERC20 sent to the contract \(ReclaimTokens.sol\) 8 | 9 | View Source: [contracts/ReclaimTokens.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/ReclaimTokens.sol) 10 | 11 | **↗ Extends:** [**Ownable**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/Ownable.md) **↘ Derived Contracts:** [**FeatureRegistry**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/FeatureRegistry.md)**,** [**PolymathRegistry**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PolymathRegistry.md) 12 | 13 | **ReclaimTokens** 14 | 15 | ## Functions 16 | 17 | * [reclaimERC20\(address \_tokenContract\)](reclaimtokens.md#reclaimerc20) 18 | 19 | ### reclaimERC20 20 | 21 | Reclaim all ERC20Basic compatible tokens 22 | 23 | ```javascript 24 | function reclaimERC20(address _tokenContract) external nonpayable onlyOwner 25 | ``` 26 | 27 | **Arguments** 28 | 29 | | Name | Type | Description | 30 | | :--- | :--- | :--- | 31 | | \_tokenContract | address | The address of the token contract | 32 | 33 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/LTM/LockUpTransferManagerStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Wallet for core vesting escrow functionality 5 | */ 6 | contract LockUpTransferManagerStorage { 7 | 8 | // a per-user lockup 9 | struct LockUp { 10 | uint256 lockupAmount; // Amount to be locked 11 | uint256 startTime; // when this lockup starts (seconds) 12 | uint256 lockUpPeriodSeconds; // total period of lockup (seconds) 13 | uint256 releaseFrequencySeconds; // how often to release a tranche of tokens (seconds) 14 | } 15 | 16 | // mapping use to store the lockup details corresponds to lockup name 17 | mapping (bytes32 => LockUp) public lockups; 18 | // mapping user addresses to an array of lockups name for that user 19 | mapping (address => bytes32[]) internal userToLockups; 20 | // get list of the addresses for a particular lockupName 21 | mapping (bytes32 => address[]) internal lockupToUsers; 22 | // holds lockup index corresponds to user address. userAddress => lockupName => lockupIndex 23 | mapping (address => mapping(bytes32 => uint256)) internal userToLockupIndex; 24 | // holds the user address index corresponds to the lockup. lockupName => userAddress => userIndex 25 | mapping (bytes32 => mapping(address => uint256)) internal lockupToUserIndex; 26 | 27 | bytes32[] lockupArray; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /contracts/mocks/MockFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./Dummy/DummySTOFactory.sol"; 4 | 5 | /** 6 | * @title Mock Contract Not fit for production environment 7 | */ 8 | 9 | contract MockFactory is DummySTOFactory { 10 | bool public typesSwitch = false; 11 | 12 | /** 13 | * @notice Constructor 14 | * @param _setupCost Setup cost of the module 15 | * @param _logicContract Contract address that contains the logic related to `description` 16 | * @param _polymathRegistry Address of the Polymath Registry 17 | */ 18 | constructor( 19 | uint256 _setupCost, 20 | address _logicContract, 21 | address _polymathRegistry, 22 | bool _isFeeInPoly 23 | ) 24 | public 25 | DummySTOFactory(_setupCost, _logicContract, _polymathRegistry, _isFeeInPoly) 26 | { 27 | } 28 | 29 | /** 30 | * @notice Type of the Module factory 31 | */ 32 | function getTypes() external view returns(uint8[] memory) { 33 | if (!typesSwitch) { 34 | uint8[] memory res = new uint8[](0); 35 | return res; 36 | } else { 37 | uint8[] memory res = new uint8[](2); 38 | res[0] = 1; 39 | res[1] = 1; 40 | return res; 41 | } 42 | 43 | } 44 | 45 | function switchTypes() external onlyOwner { 46 | typesSwitch = !typesSwitch; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /docs/wiki/transfer-ownership.md: -------------------------------------------------------------------------------- 1 | # Transfer-Ownership 2 | 3 | ## Summary 4 | 5 | * This CLI feature allows Transfers of Ownership of an own contract to another account 6 | 7 | ## How it works 8 | 9 | This feature command takes in two inputs: 1. The contract address of your security token 2. The ETH address you want to transfer ownership to 10 | 11 | Ownership is then transferred once the command has been entered. 12 | 13 | ## How to Use this CLI Feature \(Instructions\): 14 | 15 | Run the following command with your specific inputs: 16 | 17 | `$ node CLI/polymath-cli transfer_ownership ` 18 | 19 | **Example output** 20 | 21 | ```text 22 | $ node CLI/polymath-cli transfer_ownership 0x4f48d6a0c822aeee6d33bd7ec4bcbf6904759647 0xb80ebb264e15d1e4c03040e1497881fc4fff2652 23 | ---- Transaction executed: transferOwnership - Gas limit provided: 36686 ---- 24 | 25 | Your transaction is being processed. Please wait... 26 | TxHash: 0x305523a011e62e86d2abff80b3648b745a845af2011dacc9033f29acec4ee413 27 | 28 | Congratulations! The transaction was successfully completed. 29 | Gas used: 30572 - Gas spent: 0.0015286 Ether 30 | Review it on Etherscan. 31 | TxHash: 0x305523a011e62e86d2abff80b3648b745a845af2011dacc9033f29acec4ee413 32 | 33 | Ownership transferred successfully. New owner is 0xb80ebb264e15d1E4c03040e1497881FC4fff2652 34 | ``` 35 | 36 | ## Troubleshooting / FAQs 37 | 38 | * n/a 39 | 40 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/GTM/GeneralTransferManagerStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Transfer Manager module for core transfer validation functionality 5 | */ 6 | contract GeneralTransferManagerStorage { 7 | 8 | bytes32 public constant WHITELIST = "WHITELIST"; 9 | bytes32 public constant INVESTORSKEY = 0xdf3a8dd24acdd05addfc6aeffef7574d2de3f844535ec91e8e0f3e45dba96731; //keccak256(abi.encodePacked("INVESTORS")) 10 | bytes32 public constant INVESTORFLAGS = "INVESTORFLAGS"; 11 | uint256 internal constant ONE = uint256(1); 12 | 13 | enum TransferType { GENERAL, ISSUANCE, REDEMPTION } 14 | 15 | //Address from which issuances come 16 | address public issuanceAddress; 17 | 18 | // Allows all TimeRestrictions to be offset 19 | struct Defaults { 20 | uint64 canSendAfter; 21 | uint64 canReceiveAfter; 22 | } 23 | 24 | // Offset to be applied to all timings (except KYC expiry) 25 | Defaults public defaults; 26 | 27 | // Map of used nonces by customer 28 | mapping(address => mapping(uint256 => bool)) public nonceMap; 29 | 30 | struct TransferRequirements { 31 | bool fromValidKYC; 32 | bool toValidKYC; 33 | bool fromRestricted; 34 | bool toRestricted; 35 | } 36 | 37 | mapping(uint8 => TransferRequirements) public transferRequirements; 38 | // General = 0, Issuance = 1, Redemption = 2 39 | } 40 | -------------------------------------------------------------------------------- /contracts/mocks/TestSTOFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./Dummy/DummySTOFactory.sol"; 4 | 5 | contract TestSTOFactory is DummySTOFactory { 6 | /** 7 | * @notice Constructor 8 | * @param _setupCost Setup cost of the module 9 | * @param _logicContract Contract address that contains the logic related to `description` 10 | * @param _polymathRegistry Address of the Polymath Registry 11 | */ 12 | constructor( 13 | uint256 _setupCost, 14 | address _logicContract, 15 | address _polymathRegistry, 16 | bool _isFeeInPoly 17 | ) 18 | public 19 | DummySTOFactory(_setupCost, _logicContract, _polymathRegistry, _isFeeInPoly) 20 | { 21 | name = "TestSTO"; 22 | title = "Test STO"; 23 | description = "Test STO"; 24 | compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0)); 25 | compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0)); 26 | } 27 | 28 | /** 29 | * @notice Gets the tags related to the module factory 30 | */ 31 | function getTags() external view returns(bytes32[] memory) { 32 | bytes32[] memory availableTags = new bytes32[](4); 33 | availableTags[0] = "Test"; 34 | availableTags[1] = "Non-refundable"; 35 | availableTags[2] = "ETH"; 36 | return availableTags; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /scripts/wincov.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | @SET accounts=--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,1000000000000000000000000" ^ 4 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501201,1000000000000000000000000" ^ 5 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501202,1000000000000000000000000" ^ 6 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501203,1000000000000000000000000" ^ 7 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501204,1000000000000000000000000" ^ 8 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501205,1000000000000000000000000" ^ 9 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501206,1000000000000000000000000" ^ 10 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501207,1000000000000000000000000" ^ 11 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501208,1000000000000000000000000" ^ 12 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501209,1000000000000000000000000" 13 | @START /b node_modules\.bin\testrpc-sc.cmd --gasLimit 0xfffffffffff --defaultBalanceEther 1000000000 --gasPrice 1 --port 8545 %accounts%> %temp%\nul 14 | 15 | @COPY .solcover.js .solcover.js.bk 16 | node scripts\patch.js 17 | node_modules\.bin\solidity-coverage.cmd 18 | @MOVE /y .solcover.js.bk .solcover.js 19 | -------------------------------------------------------------------------------- /scripts/wintest.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | @SET accounts=--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,1000000000000000000000000" ^ 4 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501201,1000000000000000000000000" ^ 5 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501202,1000000000000000000000000" ^ 6 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501203,1000000000000000000000000" ^ 7 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501204,1000000000000000000000000" ^ 8 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501205,1000000000000000000000000" ^ 9 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501206,1000000000000000000000000" ^ 10 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501207,1000000000000000000000000" ^ 11 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501208,1000000000000000000000000" ^ 12 | --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501209,1000000000000000000000000" 13 | @START /b node_modules\.bin\ganache-cli.cmd --gasLimit 8000000 --defaultBalanceEther 1000000000 --gasPrice 1 %accounts%> %temp%\nul 14 | @SET var=truffle test 15 | 16 | for %%i in (test\*.js) do call :PushTest %%i 17 | %var% 18 | 19 | :PushTest 20 | if NOT "%1" == "test\a_poly_oracle.js" ( 21 | set var=%var% %1 22 | ) 23 | -------------------------------------------------------------------------------- /contracts/interfaces/ITransferManager.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Interface to be implemented by all Transfer Manager modules 5 | */ 6 | interface ITransferManager { 7 | // If verifyTransfer returns: 8 | // FORCE_VALID, the transaction will always be valid, regardless of other TM results 9 | // INVALID, then the transfer should not be allowed regardless of other TM results 10 | // VALID, then the transfer is valid for this TM 11 | // NA, then the result from this TM is ignored 12 | enum Result {INVALID, NA, VALID, FORCE_VALID} 13 | 14 | /** 15 | * @notice Determines if the transfer between these two accounts can happen 16 | */ 17 | function executeTransfer(address _from, address _to, uint256 _amount, bytes calldata _data) external returns(Result result); 18 | 19 | function verifyTransfer(address _from, address _to, uint256 _amount, bytes calldata _data) external view returns(Result result, bytes32 partition); 20 | 21 | /** 22 | * @notice return the amount of tokens for a given user as per the partition 23 | * @param _partition Identifier 24 | * @param _tokenHolder Whom token amount need to query 25 | * @param _additionalBalance It is the `_value` that transfer during transfer/transferFrom function call 26 | */ 27 | function getTokensByPartition(bytes32 _partition, address _tokenHolder, uint256 _additionalBalance) external view returns(uint256 amount); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /contracts/tokens/SecurityTokenProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./OZStorage.sol"; 5 | import "./SecurityTokenStorage.sol"; 6 | 7 | /** 8 | * @title USDTiered STO module Proxy 9 | */ 10 | contract SecurityTokenProxy is OZStorage, SecurityTokenStorage, OwnedUpgradeabilityProxy { 11 | 12 | /** 13 | * @notice constructor 14 | * @param _name Name of the SecurityToken 15 | * @param _symbol Symbol of the Token 16 | * @param _decimals Decimals for the securityToken 17 | * @param _granularity granular level of the token 18 | * @param _tokenDetails Details of the token that are stored off-chain 19 | * @param _polymathRegistry Contract address of the polymath registry 20 | */ 21 | constructor( 22 | string memory _name, 23 | string memory _symbol, 24 | uint8 _decimals, 25 | uint256 _granularity, 26 | string memory _tokenDetails, 27 | address _polymathRegistry 28 | ) 29 | public 30 | { 31 | //Set storage variables - NB implementation not yet set 32 | require(_polymathRegistry != address(0), "Invalid Address"); 33 | name = _name; 34 | symbol = _symbol; 35 | decimals = _decimals; 36 | polymathRegistry = IPolymathRegistry(_polymathRegistry); 37 | tokenDetails = _tokenDetails; 38 | granularity = _granularity; 39 | _owner = msg.sender; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /docs/wiki/time-travel-contract-testing.md: -------------------------------------------------------------------------------- 1 | # Time-Travel-\(Contract-Testing\) 2 | 3 | ## Summary 4 | 5 | * This CLI feature is for testing purposes only \(using ganache\)and works by allowing the tester to travel to the future and test out the Polymath contracts. 6 | 7 | ## How it works 8 | 9 | Options Command `$ node CLI/polymath-cli time_travel -h` 10 | 11 | ```text 12 | Usage: time_travel|tt [options] 13 | 14 | Increases time on EVM according to given value. 15 | 16 | Options: 17 | -p, --period Period of time in seconds to increase 18 | -d, --toDate Human readable date ("MM/DD/YY [HH:mm:ss]") to travel to 19 | -e, --toEpochTime Unix Epoch time to travel to 20 | -h, --help output usage information 21 | ``` 22 | 23 | ## How to Use this CLI Feature \(Instructions\): 24 | 25 | **Period of time in seconds to increase** 26 | 27 | ```text 28 | $ node CLI/polymath-cli time_travel -p 100 29 | 30 | Current datetime is 1547057116 or 01/09/2019 13:05:16 31 | ``` 32 | 33 | **Human readable date \("MM/DD/YY \[HH:mm:ss\]"\) to travel to** 34 | 35 | ```text 36 | $ node CLI/polymath-cli time_travel -d 03/01/23 37 | Current datetime is 1677646800 or 03/01/2023 00:00:00 38 | ``` 39 | 40 | **Unix Epoch time to travel to** 41 | 42 | ```text 43 | $ node CLI/polymath-cli time_travel -e 1551476197 44 | 45 | Current datetime is 1551476197 or 03/01/2019 16:36:37 46 | ``` 47 | 48 | ## Troubleshooting / FAQs 49 | 50 | n/a 51 | 52 | -------------------------------------------------------------------------------- /contracts/mocks/MockOracle.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../interfaces/IOracle.sol"; 4 | 5 | contract MockOracle is IOracle { 6 | address public currency; 7 | bytes32 public currencySymbol; 8 | bytes32 public denominatedCurrency; 9 | uint256 public price; 10 | 11 | constructor(address _currency, bytes32 _currencySymbol, bytes32 _denominatedCurrency, uint256 _price) public { 12 | currency = _currency; 13 | currencySymbol = _currencySymbol; 14 | denominatedCurrency = _denominatedCurrency; 15 | price = _price; 16 | } 17 | 18 | function changePrice(uint256 _price) external { 19 | price = _price; 20 | } 21 | 22 | /** 23 | * @notice Returns address of oracle currency (0x0 for ETH) 24 | */ 25 | function getCurrencyAddress() external view returns(address) { 26 | return currency; 27 | } 28 | 29 | /** 30 | * @notice Returns symbol of oracle currency (0x0 for ETH) 31 | */ 32 | function getCurrencySymbol() external view returns(bytes32) { 33 | return currencySymbol; 34 | } 35 | 36 | /** 37 | * @notice Returns denomination of price 38 | */ 39 | function getCurrencyDenominated() external view returns(bytes32) { 40 | return denominatedCurrency; 41 | } 42 | 43 | /** 44 | * @notice Returns price - should throw if not valid 45 | */ 46 | function getPrice() external returns(uint256) { 47 | return price; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /docs/wiki/cli-commands-for-polymath-core.md: -------------------------------------------------------------------------------- 1 | # CLI for Polymath-core 2 | 3 | ## Options: 4 | 5 | * -V, --version \(Outputs the version number\) 6 | * -r, --remote-node \(Connecting to a remote node\) 7 | * -h, --help \(Output usage information\) 8 | 9 | ## Commands: 10 | 11 | 1. st20generator\|st \[options\] \(Wizard-like script that will guide technical users in the creation and deployment of an ST-20 token\) 12 | 2. sto\_manager\|sto \[options\] \(Wizard-like script that will guide technical users in the creation of an STO\) 13 | 3. faucet\|f \[beneficiary\] \[amount\] \(Poly faucet for local private netwtorks\) 14 | 4. investor\_portal\|i \[investor\] \[privateKey\] \[symbol\] \[currency\] \[amount\] \(Participate in any STO you have been whitelisted for\) 15 | 5. token\_manager\|stm \[options\] \(Manage your Security Tokens, mint tokens, add modules and change configurations\) 16 | 6. transfer\|t \(Transfer ST tokens to another account\) 17 | 7. transfer\_ownership\|to \(Transfer Ownership of an own contract to another account\) 18 | 8. dividends\_manager\|dm \[dividendsType\] \(Runs dividends\_manager\) 19 | 9. transfer\_manager\|tm \[options\] \(Runs transfer\_manager\) 20 | 10. contract\_manager\|cm \(Runs contract\_manager\) 21 | 11. strMigrator\|str \[options\] \[toStrAddress\] \[fromTrAddress\] \[fromStrAddress\] \(Runs STR Migrator\) 22 | 12. permission\_manager\|pm \(Runs permission\_manager\) 23 | 13. time\_travel\|tt \[options\] \(Increases time on EVM according to given value\) 24 | 25 | -------------------------------------------------------------------------------- /docs/api/securitytokenregistrymock.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-SecurityTokenRegistryMock 3 | title: SecurityTokenRegistryMock 4 | original_id: SecurityTokenRegistryMock 5 | --- 6 | 7 | # Registry contract for issuers to register their security tokens \(SecurityTokenRegistryMock.sol\) 8 | 9 | View Source: [contracts/mocks/SecurityTokenRegistryMock.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/SecurityTokenRegistryMock.sol) 10 | 11 | **↗ Extends:** [**SecurityTokenRegistry**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/SecurityTokenRegistry.md) 12 | 13 | **SecurityTokenRegistryMock** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | uint256 public someValue; 21 | ``` 22 | 23 | ## Functions 24 | 25 | * [changeTheFee\(uint256 \_newFee\)](securitytokenregistrymock.md#changethefee) 26 | * [configure\(uint256 \_someValue\)](securitytokenregistrymock.md#configure) 27 | 28 | ### changeTheFee 29 | 30 | ```javascript 31 | function changeTheFee(uint256 _newFee) public nonpayable 32 | ``` 33 | 34 | **Arguments** 35 | 36 | | Name | Type | Description | 37 | | :--- | :--- | :--- | 38 | | \_newFee | uint256 | | 39 | 40 | ### configure 41 | 42 | ```javascript 43 | function configure(uint256 _someValue) public nonpayable 44 | ``` 45 | 46 | **Arguments** 47 | 48 | | Name | Type | Description | 49 | | :--- | :--- | :--- | 50 | | \_someValue | uint256 | | 51 | 52 | -------------------------------------------------------------------------------- /docs/api/weightedvotecheckpointstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-WeightedVoteCheckpointStorage 3 | title: WeightedVoteCheckpointStorage 4 | original_id: WeightedVoteCheckpointStorage 5 | --- 6 | 7 | # WeightedVoteCheckpointStorage.sol 8 | 9 | View Source: [contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**WeightedVoteCheckpoint**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/WeightedVoteCheckpoint.md)**,** [**WeightedVoteCheckpointProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/WeightedVoteCheckpointProxy.md) 12 | 13 | **WeightedVoteCheckpointStorage** 14 | 15 | ## Structs 16 | 17 | ### Ballot 18 | 19 | ```javascript 20 | struct Ballot { 21 | uint256 checkpointId, 22 | uint256 quorum, 23 | uint64 startTime, 24 | uint64 endTime, 25 | uint64 totalProposals, 26 | uint56 totalVoters, 27 | bool isActive, 28 | mapping(uint256 => uint256) proposalToVotes, 29 | mapping(address => uint256) investorToProposal, 30 | mapping(address => bool) exemptedVoters 31 | } 32 | ``` 33 | 34 | ## Contract Members 35 | 36 | **Constants & Variables** 37 | 38 | ```javascript 39 | struct WeightedVoteCheckpointStorage.Ballot[] internal ballots; 40 | ``` 41 | 42 | ## Functions 43 | 44 | -------------------------------------------------------------------------------- /contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./KYCTransferManager.sol"; 4 | import "./../../ModuleFactory.sol"; 5 | 6 | 7 | contract KYCTransferManagerFactory is ModuleFactory { 8 | 9 | /** 10 | * @notice Constructor 11 | */ 12 | constructor( 13 | uint256 _setupCost, 14 | address _polymathRegistry, 15 | bool _isCostInPoly 16 | ) 17 | public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly) 18 | { 19 | initialVersion = "3.0.0"; 20 | name = "KYCTransferManager"; 21 | title = "KYC Transfer Manager"; 22 | description = "Manages KYC"; 23 | typesData.push(2); 24 | typesData.push(6); 25 | tagsData.push("KYC"); 26 | tagsData.push("Transfer Restriction"); 27 | compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 28 | compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 29 | } 30 | 31 | 32 | /** 33 | * @notice Used to launch the Module with the help of factory 34 | * @return address Contract address of the Module 35 | */ 36 | function deploy(bytes calldata _data) external returns(address) { 37 | address kycTransferManager = address(new KYCTransferManager(msg.sender, polymathRegistry.getAddress("PolyToken"))); 38 | _initializeModule(kycTransferManager, _data); 39 | return kycTransferManager; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /contracts/modules/TransferManager/GTM/GeneralTransferManagerProxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../../proxy/OwnedUpgradeabilityProxy.sol"; 4 | import "./GeneralTransferManagerStorage.sol"; 5 | import "../../../Pausable.sol"; 6 | import "../../../storage/modules/ModuleStorage.sol"; 7 | 8 | /** 9 | * @title Transfer Manager module for core transfer validation functionality 10 | */ 11 | contract GeneralTransferManagerProxy is GeneralTransferManagerStorage, ModuleStorage, Pausable, OwnedUpgradeabilityProxy { 12 | /** 13 | * @notice Constructor 14 | * @param _securityToken Address of the security token 15 | * @param _polyAddress Address of the polytoken 16 | * @param _implementation representing the address of the new implementation to be set 17 | */ 18 | constructor( 19 | string memory _version, 20 | address _securityToken, 21 | address _polyAddress, 22 | address _implementation 23 | ) 24 | public 25 | ModuleStorage(_securityToken, _polyAddress) 26 | { 27 | require(_implementation != address(0), "Implementation address should not be 0x"); 28 | _upgradeTo(_version, _implementation); 29 | transferRequirements[uint8(TransferType.GENERAL)] = TransferRequirements(true, true, true, true); 30 | transferRequirements[uint8(TransferType.ISSUANCE)] = TransferRequirements(false, true, false, false); 31 | transferRequirements[uint8(TransferType.REDEMPTION)] = TransferRequirements(true, false, false, false); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /scripts/calculateSize.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const exec = require('child_process').execSync; 4 | const chalk = require('chalk'); 5 | const { table } = require("table"); 6 | 7 | async function readFiles() { 8 | if (fs.existsSync("./build/contracts/")) { 9 | return fs.readdirSync("./build/contracts/"); 10 | } else { 11 | console.log('Compiling contracts. This may take a while, please wait.'); 12 | exec('./node_modules/.bin/truffle compile'); 13 | return fs.readdirSync("./build/contracts/"); 14 | } 15 | } 16 | 17 | async function printSize() { 18 | let files = await readFiles(); 19 | console.log(`NOTE- Maximum size of contracts allowed to deloyed on the Ethereum mainnet is 24 KB(EIP170)`); 20 | console.log(`---- Size of the contracts ----`); 21 | let dataTable = [['Contracts', 'Size in KB']]; 22 | files.forEach(item => { 23 | let content = JSON.parse(fs.readFileSync(`./build/contracts/${item}`).toString()).deployedBytecode; 24 | let sizeInKB = content.toString().length / 2 / 1024; 25 | if (sizeInKB > 24) 26 | dataTable.push([chalk.red(path.basename(item, ".json")),chalk.red(sizeInKB)]); 27 | else if (sizeInKB > 20) 28 | dataTable.push([chalk.yellow(path.basename(item, ".json")),chalk.yellow(sizeInKB)]); 29 | else 30 | dataTable.push([chalk.green(path.basename(item, ".json")),chalk.green(sizeInKB)]); 31 | }); 32 | console.log(table(dataTable)); 33 | } 34 | 35 | printSize(); 36 | -------------------------------------------------------------------------------- /docs/api/decimalmath.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-DecimalMath 3 | title: DecimalMath 4 | original_id: DecimalMath 5 | --- 6 | 7 | # DecimalMath.sol 8 | 9 | View Source: [contracts/libraries/DecimalMath.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/libraries/DecimalMath.sol) 10 | 11 | **DecimalMath** 12 | 13 | ## Contract Members 14 | 15 | **Constants & Variables** 16 | 17 | ```javascript 18 | uint256 internal constant e18; 19 | ``` 20 | 21 | ## Functions 22 | 23 | * [mul\(uint256 x, uint256 y\)](decimalmath.md#mul) 24 | * [div\(uint256 x, uint256 y\)](decimalmath.md#div) 25 | 26 | ### mul 27 | 28 | This function multiplies two decimals represented as \(decimal _10\*_DECIMALS\) 29 | 30 | ```javascript 31 | function mul(uint256 x, uint256 y) internal pure 32 | returns(z uint256) 33 | ``` 34 | 35 | **Returns** 36 | 37 | uint256 Result of multiplication represented as \(decimal _10\*_DECIMALS\) 38 | 39 | **Arguments** 40 | 41 | | Name | Type | Description | 42 | | :--- | :--- | :--- | 43 | | x | uint256 | | 44 | | y | uint256 | | 45 | 46 | ### div 47 | 48 | This function divides two decimals represented as \(decimal _10\*_DECIMALS\) 49 | 50 | ```javascript 51 | function div(uint256 x, uint256 y) internal pure 52 | returns(z uint256) 53 | ``` 54 | 55 | **Returns** 56 | 57 | uint256 Result of division represented as \(decimal _10\*_DECIMALS\) 58 | 59 | **Arguments** 60 | 61 | | Name | Type | Description | 62 | | :--- | :--- | :--- | 63 | | x | uint256 | | 64 | | y | uint256 | | 65 | 66 | -------------------------------------------------------------------------------- /CLI/commands/common/constants.js: -------------------------------------------------------------------------------- 1 | module.exports = Object.freeze({ 2 | MODULES_TYPES: { 3 | PERMISSION: 1, 4 | TRANSFER: 2, 5 | STO: 3, 6 | DIVIDENDS: 4, 7 | BURN: 5, 8 | WALLET: 7 9 | }, 10 | DURATION: { 11 | seconds: function (val) { 12 | return val 13 | }, 14 | minutes: function (val) { 15 | return val * this.seconds(60) 16 | }, 17 | hours: function (val) { 18 | return val * this.minutes(60) 19 | }, 20 | days: function (val) { 21 | return val * this.hours(24) 22 | }, 23 | weeks: function (val) { 24 | return val * this.days(7) 25 | }, 26 | years: function (val) { 27 | return val * this.days(365) 28 | } 29 | }, 30 | FUND_RAISE_TYPES: { 31 | ETH: 0, 32 | POLY: 1, 33 | STABLE: 2 34 | }, 35 | DEFAULT_BATCH_SIZE: 75, 36 | ADDRESS_ZERO: '0x0000000000000000000000000000000000000000', 37 | TRASFER_RESULT: { 38 | INVALID: '0', 39 | NA: '1', 40 | VALID: '2', 41 | FORCE_VALID: '3' 42 | }, 43 | TRANSFER_STATUS_CODES: { 44 | TransferFailure: '0x50', 45 | TransferSuccess: '0x51', 46 | InsufficientBalance: '0x52', 47 | InsufficientAllowance: '0x53', 48 | TransfersHalted: '0x54', 49 | FundsLocked: '0x55', 50 | InvalidSender: '0x56', 51 | InvalidReceiver: '0x57', 52 | InvalidOperator: '0x58' 53 | } 54 | }); 55 | -------------------------------------------------------------------------------- /docs/api/manualapprovaltransfermanagerstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-ManualApprovalTransferManagerStorage 3 | title: ManualApprovalTransferManagerStorage 4 | original_id: ManualApprovalTransferManagerStorage 5 | --- 6 | 7 | # Contract used to store layout for the ManualApprovalTransferManager storage \(ManualApprovalTransferM 8 | 9 | View Source: [contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**ManualApprovalTransferManager**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ManualApprovalTransferManager.md)**,** [**ManualApprovalTransferManagerProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ManualApprovalTransferManagerProxy.md) 12 | 13 | **ManualApprovalTransferManagerStorage** 14 | 15 | ## Structs 16 | 17 | ### ManualApproval 18 | 19 | ```javascript 20 | struct ManualApproval { 21 | address from, 22 | address to, 23 | uint256 initialAllowance, 24 | uint256 allowance, 25 | uint256 expiryTime, 26 | bytes32 description 27 | } 28 | ``` 29 | 30 | ## Contract Members 31 | 32 | **Constants & Variables** 33 | 34 | ```javascript 35 | mapping(address => mapping(address => uint256)) public approvalIndex; 36 | struct ManualApprovalTransferManagerStorage.ManualApproval[] public approvals; 37 | ``` 38 | 39 | ## Functions 40 | 41 | -------------------------------------------------------------------------------- /test/helpers/utils.js: -------------------------------------------------------------------------------- 1 | /* global assert */ 2 | 3 | var _ = require("lodash"); 4 | 5 | function isException(error) { 6 | let strError = error.toString(); 7 | return strError.includes("invalid opcode") || strError.includes("invalid JUMP") || strError.includes("revert"); 8 | } 9 | 10 | function ensureException(error) { 11 | assert(isException(error), error.toString()); 12 | } 13 | 14 | async function timeDifference(timestamp1, timestamp2) { 15 | var difference = timestamp1 - timestamp2; 16 | return difference; 17 | } 18 | 19 | function convertHex(hexx) { 20 | var hex = hexx.toString(); //force conversion 21 | var str = ""; 22 | for (var i = 0; i < hex.length; i += 2) { 23 | let char = String.fromCharCode(parseInt(hex.substr(i, 2), 16)); 24 | if (char != "\u0000") str += char; 25 | } 26 | return str; 27 | } 28 | 29 | export { ensureException, timeDifference, convertHex }; 30 | 31 | export const duration = { 32 | seconds: function(val) { 33 | return val; 34 | }, 35 | minutes: function(val) { 36 | return val * this.seconds(60); 37 | }, 38 | hours: function(val) { 39 | return val * this.minutes(60); 40 | }, 41 | days: function(val) { 42 | return val * this.hours(24); 43 | }, 44 | weeks: function(val) { 45 | return val * this.days(7); 46 | }, 47 | years: function(val) { 48 | return val * this.days(365); 49 | } 50 | }; 51 | 52 | export async function latestBlock() { 53 | let block = await web3.eth.getBlock("latest"); 54 | return block.number; 55 | } 56 | -------------------------------------------------------------------------------- /docs/api/datastorestorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-DataStoreStorage 3 | title: DataStoreStorage 4 | original_id: DataStoreStorage 5 | --- 6 | 7 | # DataStoreStorage.sol 8 | 9 | View Source: [contracts/datastore/DataStoreStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/datastore/DataStoreStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**DataStore**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/DataStore.md)**,** [**DataStoreProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/DataStoreProxy.md) 12 | 13 | **DataStoreStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | //internal members 21 | address internal __implementation; 22 | mapping(bytes32 => uint256) internal uintData; 23 | mapping(bytes32 => bytes32) internal bytes32Data; 24 | mapping(bytes32 => address) internal addressData; 25 | mapping(bytes32 => string) internal stringData; 26 | mapping(bytes32 => bytes) internal bytesData; 27 | mapping(bytes32 => bool) internal boolData; 28 | mapping(bytes32 => uint256[]) internal uintArrayData; 29 | mapping(bytes32 => bytes32[]) internal bytes32ArrayData; 30 | mapping(bytes32 => address[]) internal addressArrayData; 31 | mapping(bytes32 => bool[]) internal boolArrayData; 32 | uint8 internal constant DATA_KEY; 33 | bytes32 internal constant MANAGEDATA; 34 | 35 | //public members 36 | contract ISecurityToken public securityToken; 37 | ``` 38 | 39 | ## Functions 40 | 41 | -------------------------------------------------------------------------------- /scripts/encoders/encode_CappedSTO.js: -------------------------------------------------------------------------------- 1 | const Web3 = require("web3"); 2 | 3 | if (typeof web3 !== "undefined") { 4 | web3 = new Web3(web3.currentProvider); 5 | } else { 6 | // set the provider you want from Web3.providers 7 | web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); 8 | } 9 | 10 | let startTime = process.argv.slice(2)[0]; 11 | let endTime = process.argv.slice(2)[1]; 12 | let cap = process.argv.slice(2)[2]; 13 | let rate = process.argv.slice(2)[3]; 14 | let wallet = process.argv.slice(2)[4]; 15 | 16 | let bytesSTO = web3.eth.abi.encodeFunctionCall( 17 | { 18 | name: "configure", 19 | type: "function", 20 | inputs: [ 21 | { 22 | type: "uint256", 23 | name: "_startTime" 24 | }, 25 | { 26 | type: "uint256", 27 | name: "_endTime" 28 | }, 29 | { 30 | type: "uint256", 31 | name: "_cap" 32 | }, 33 | { 34 | type: "uint256", 35 | name: "_rate" 36 | }, 37 | { 38 | type: "uint8", 39 | name: "_fundRaiseType" 40 | }, 41 | { 42 | type: "address", 43 | name: "_polyToken" 44 | }, 45 | { 46 | type: "address", 47 | name: "_fundsReceiver" 48 | } 49 | ] 50 | }, 51 | [startTime, endTime, web3.utils.toWei(cap, "ether"), rate, 0, 0, wallet] 52 | ); 53 | 54 | console.log(bytesSTO); 55 | -------------------------------------------------------------------------------- /docs/api/math.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-Math 3 | title: Math 4 | original_id: Math 5 | --- 6 | 7 | # Math \(Math.sol\) 8 | 9 | View Source: [openzeppelin-solidity/contracts/math/Math.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/openzeppelin-solidity/contracts/math/Math.sol) 10 | 11 | **Math** 12 | 13 | Assorted math operations 14 | 15 | ## Functions 16 | 17 | * [max\(uint256 a, uint256 b\)](math.md#max) 18 | * [min\(uint256 a, uint256 b\)](math.md#min) 19 | * [average\(uint256 a, uint256 b\)](math.md#average) 20 | 21 | ### max 22 | 23 | Returns the largest of two numbers. 24 | 25 | ```javascript 26 | function max(uint256 a, uint256 b) internal pure 27 | returns(uint256) 28 | ``` 29 | 30 | **Arguments** 31 | 32 | | Name | Type | Description | 33 | | :--- | :--- | :--- | 34 | | a | uint256 | | 35 | | b | uint256 | | 36 | 37 | ### min 38 | 39 | Returns the smallest of two numbers. 40 | 41 | ```javascript 42 | function min(uint256 a, uint256 b) internal pure 43 | returns(uint256) 44 | ``` 45 | 46 | **Arguments** 47 | 48 | | Name | Type | Description | 49 | | :--- | :--- | :--- | 50 | | a | uint256 | | 51 | | b | uint256 | | 52 | 53 | ### average 54 | 55 | Calculates the average of two numbers. Since these are integers, averages of an even and odd number cannot be represented, and will be rounded down. 56 | 57 | ```javascript 58 | function average(uint256 a, uint256 b) internal pure 59 | returns(uint256) 60 | ``` 61 | 62 | **Arguments** 63 | 64 | | Name | Type | Description | 65 | | :--- | :--- | :--- | 66 | | a | uint256 | | 67 | | b | uint256 | | 68 | 69 | -------------------------------------------------------------------------------- /docs/api/iownable.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-IOwnable 3 | title: IOwnable 4 | original_id: IOwnable 5 | --- 6 | 7 | # Ownable \(IOwnable.sol\) 8 | 9 | View Source: [contracts/interfaces/IOwnable.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/interfaces/IOwnable.sol) 10 | 11 | **IOwnable** 12 | 13 | The Ownable contract has an owner address, and provides basic authorization control functions, this simplifies the implementation of "user permissions". 14 | 15 | ## Functions 16 | 17 | * [owner\(\)](iownable.md#owner) 18 | * [renounceOwnership\(\)](iownable.md#renounceownership) 19 | * [transferOwnership\(address \_newOwner\)](iownable.md#transferownership) 20 | 21 | ### owner 22 | 23 | Returns owner 24 | 25 | ```javascript 26 | function owner() external view 27 | returns(ownerAddress address) 28 | ``` 29 | 30 | **Arguments** 31 | 32 | | Name | Type | Description | 33 | | :--- | :--- | :--- | 34 | 35 | 36 | ### renounceOwnership 37 | 38 | Allows the current owner to relinquish control of the contract. 39 | 40 | ```javascript 41 | function renounceOwnership() external nonpayable 42 | ``` 43 | 44 | **Arguments** 45 | 46 | | Name | Type | Description | 47 | | :--- | :--- | :--- | 48 | 49 | 50 | ### transferOwnership 51 | 52 | Allows the current owner to transfer control of the contract to a newOwner. 53 | 54 | ```javascript 55 | function transferOwnership(address _newOwner) external nonpayable 56 | ``` 57 | 58 | **Arguments** 59 | 60 | | Name | Type | Description | 61 | | :--- | :--- | :--- | 62 | | \_newOwner | address | The address to transfer ownership to. | 63 | 64 | -------------------------------------------------------------------------------- /docs/api/migrations.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-Migrations 3 | title: Migrations 4 | original_id: Migrations 5 | --- 6 | 7 | # Migrations.sol 8 | 9 | View Source: [contracts/Migrations.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/Migrations.sol) 10 | 11 | **Migrations** 12 | 13 | ## Contract Members 14 | 15 | **Constants & Variables** 16 | 17 | ```javascript 18 | address public owner; 19 | uint256 public lastCompletedMigration; 20 | ``` 21 | 22 | ## Modifiers 23 | 24 | * [restricted](migrations.md#restricted) 25 | 26 | ### restricted 27 | 28 | ```javascript 29 | modifier restricted() internal 30 | ``` 31 | 32 | **Arguments** 33 | 34 | | Name | Type | Description | 35 | | :--- | :--- | :--- | 36 | 37 | 38 | ## Functions 39 | 40 | * [\(\)](migrations.md) 41 | * [setCompleted\(uint256 \_completed\)](migrations.md#setcompleted) 42 | * [upgrade\(address \_newAddress\)](migrations.md#upgrade) 43 | 44 | ```javascript 45 | function () public nonpayable 46 | ``` 47 | 48 | **Arguments** 49 | 50 | | Name | Type | Description | 51 | | :--- | :--- | :--- | 52 | 53 | 54 | ### setCompleted 55 | 56 | ```javascript 57 | function setCompleted(uint256 _completed) public nonpayable restricted 58 | ``` 59 | 60 | **Arguments** 61 | 62 | | Name | Type | Description | 63 | | :--- | :--- | :--- | 64 | | \_completed | uint256 | | 65 | 66 | ### upgrade 67 | 68 | ```javascript 69 | function upgrade(address _newAddress) public nonpayable restricted 70 | ``` 71 | 72 | **Arguments** 73 | 74 | | Name | Type | Description | 75 | | :--- | :--- | :--- | 76 | | \_newAddress | address | | 77 | 78 | -------------------------------------------------------------------------------- /contracts/modules/Experimental/TransferManager/SignedTransferManagerFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./SignedTransferManager.sol"; 4 | import "../../ModuleFactory.sol"; 5 | 6 | /** 7 | * @title Factory for deploying SignedTransferManager module 8 | */ 9 | contract SignedTransferManagerFactory is ModuleFactory { 10 | 11 | /** 12 | * @notice Constructor 13 | */ 14 | constructor( 15 | uint256 _setupCost, 16 | address _polymathRegistry, 17 | bool _isCostInPoly 18 | ) 19 | public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly) 20 | { 21 | initialVersion = "3.0.0"; 22 | name = "SignedTransferManager"; 23 | title = "Signed Transfer Manager"; 24 | description = "Manage transfers using a signature"; 25 | typesData.push(2); 26 | typesData.push(6); 27 | tagsData.push("Signed"); 28 | tagsData.push("Transfer Restriction"); 29 | compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 30 | compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 31 | } 32 | 33 | 34 | /** 35 | * @notice used to launch the Module with the help of factory 36 | * @return address Contract address of the Module 37 | */ 38 | function deploy(bytes calldata _data) external returns(address) { 39 | address signedTransferManager = address(new SignedTransferManager(msg.sender, polymathRegistry.getAddress("PolyToken"))); 40 | _initializeModule(signedTransferManager, _data); 41 | return signedTransferManager; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /docs/api/stostorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-STOStorage 3 | title: STOStorage 4 | original_id: STOStorage 5 | --- 6 | 7 | # Storage layout for the STO contract \(STOStorage.sol\) 8 | 9 | View Source: [contracts/storage/modules/STO/STOStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/storage/modules/STO/STOStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**CappedSTOProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/CappedSTOProxy.md)**,** [**DummySTOProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/DummySTOProxy.md)**,** [**PreSaleSTOProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PreSaleSTOProxy.md)**,** [**STO**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/STO.md)**,** [**USDTieredSTOProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/USDTieredSTOProxy.md) 12 | 13 | **STOStorage** 14 | 15 | ## Contract Members 16 | 17 | **Constants & Variables** 18 | 19 | ```javascript 20 | //internal members 21 | bytes32 internal constant INVESTORFLAGS; 22 | 23 | //public members 24 | mapping(uint8 => bool) public fundRaiseTypes; 25 | mapping(uint8 => uint256) public fundsRaised; 26 | uint256 public startTime; 27 | uint256 public endTime; 28 | uint256 public pausedTime; 29 | uint256 public investorCount; 30 | address payable public wallet; 31 | uint256 public totalTokensSold; 32 | ``` 33 | 34 | ## Functions 35 | 36 | -------------------------------------------------------------------------------- /docs/api/mockwrongtypefactory.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-MockWrongTypeFactory 3 | title: MockWrongTypeFactory 4 | original_id: MockWrongTypeFactory 5 | --- 6 | 7 | # Mock Contract Not fit for production environment \(MockWrongTypeFactory.sol\) 8 | 9 | View Source: [contracts/mocks/MockWrongTypeFactory.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/MockWrongTypeFactory.sol) 10 | 11 | **↗ Extends:** [**MockBurnFactory**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/MockBurnFactory.md) 12 | 13 | **MockWrongTypeFactory** 14 | 15 | ## Functions 16 | 17 | * [\(uint256 \_setupCost, address \_polymathRegistry, bool \_isFeeInPoly\)](mockwrongtypefactory.md) 18 | * [getTypes\(\)](mockwrongtypefactory.md#gettypes) 19 | 20 | Constructor 21 | 22 | ```javascript 23 | function (uint256 _setupCost, address _polymathRegistry, bool _isFeeInPoly) public nonpayable MockBurnFactory 24 | ``` 25 | 26 | **Arguments** 27 | 28 | | Name | Type | Description | 29 | | :--- | :--- | :--- | 30 | | \_setupCost | uint256 | Setup cost of the module | 31 | | \_polymathRegistry | address | Address of the Polymath Registry | 32 | | \_isFeeInPoly | bool | | 33 | 34 | ### getTypes 35 | 36 | ⤾ overrides [ModuleFactory.getTypes](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ModuleFactory.md#gettypes) 37 | 38 | Type of the Module factory 39 | 40 | ```javascript 41 | function getTypes() external view 42 | returns(uint8[]) 43 | ``` 44 | 45 | **Arguments** 46 | 47 | | Name | Type | Description | 48 | | :--- | :--- | :--- | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/api/lockuptransfermanagerstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-LockUpTransferManagerStorage 3 | title: LockUpTransferManagerStorage 4 | original_id: LockUpTransferManagerStorage 5 | --- 6 | 7 | # Wallet for core vesting escrow functionality \(LockUpTransferManagerStorage.sol\) 8 | 9 | View Source: [contracts/modules/TransferManager/LTM/LockUpTransferManagerStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/TransferManager/LTM/LockUpTransferManagerStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**LockUpTransferManager**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/LockUpTransferManager.md)**,** [**LockUpTransferManagerProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/LockUpTransferManagerProxy.md) 12 | 13 | **LockUpTransferManagerStorage** 14 | 15 | ## Structs 16 | 17 | ### LockUp 18 | 19 | ```javascript 20 | struct LockUp { 21 | uint256 lockupAmount, 22 | uint256 startTime, 23 | uint256 lockUpPeriodSeconds, 24 | uint256 releaseFrequencySeconds 25 | } 26 | ``` 27 | 28 | ## Contract Members 29 | 30 | **Constants & Variables** 31 | 32 | ```javascript 33 | //public members 34 | mapping(bytes32 => struct LockUpTransferManagerStorage.LockUp) public lockups; 35 | 36 | //internal members 37 | mapping(address => bytes32[]) internal userToLockups; 38 | mapping(bytes32 => address[]) internal lockupToUsers; 39 | mapping(address => mapping(bytes32 => uint256)) internal userToLockupIndex; 40 | mapping(bytes32 => mapping(address => uint256)) internal lockupToUserIndex; 41 | bytes32[] internal lockupArray; 42 | ``` 43 | 44 | ## Functions 45 | 46 | -------------------------------------------------------------------------------- /docs/api/teststofactory.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-TestSTOFactory 3 | title: TestSTOFactory 4 | original_id: TestSTOFactory 5 | --- 6 | 7 | # TestSTOFactory.sol 8 | 9 | View Source: [contracts/mocks/TestSTOFactory.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/mocks/TestSTOFactory.sol) 10 | 11 | **↗ Extends:** [**DummySTOFactory**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/DummySTOFactory.md) 12 | 13 | **TestSTOFactory** 14 | 15 | ## Functions 16 | 17 | * [\(uint256 \_setupCost, address \_logicContract, address \_polymathRegistry, bool \_isFeeInPoly\)](teststofactory.md) 18 | * [getTags\(\)](teststofactory.md#gettags) 19 | 20 | Constructor 21 | 22 | ```javascript 23 | function (uint256 _setupCost, address _logicContract, address _polymathRegistry, bool _isFeeInPoly) public nonpayable DummySTOFactory 24 | ``` 25 | 26 | **Arguments** 27 | 28 | | Name | Type | Description | 29 | | :--- | :--- | :--- | 30 | | \_setupCost | uint256 | Setup cost of the module | 31 | | \_logicContract | address | Contract address that contains the logic related to `description` | 32 | | \_polymathRegistry | address | Address of the Polymath Registry | 33 | | \_isFeeInPoly | bool | | 34 | 35 | ### getTags 36 | 37 | ⤾ overrides [ModuleFactory.getTags](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ModuleFactory.md#gettags) 38 | 39 | Gets the tags related to the module factory 40 | 41 | ```javascript 42 | function getTags() external view 43 | returns(bytes32[]) 44 | ``` 45 | 46 | **Arguments** 47 | 48 | | Name | Type | Description | 49 | | :--- | :--- | :--- | 50 | 51 | 52 | -------------------------------------------------------------------------------- /CLI/commands/IO/output.js: -------------------------------------------------------------------------------- 1 | function logBalance(address, symbol, balance) { 2 | console.log(`Balance of ${address}: ${balance} ${symbol}`); 3 | } 4 | 5 | function logUnlockedBalance() { 6 | if (balanceUnlocked !== totalBalance) { 7 | console.log(`Balance of ${address}: ${balanceUnlocked} ${tokenSymbol} unlocked (${totalBalance} ${tokenSymbol} total)`); 8 | } else { 9 | console.log(`Balance of ${address}: ${totalBalance} ${tokenSymbol}`); 10 | } 11 | } 12 | 13 | function logUnlockedBalanceWithPercentage(address, tokenSymbol, balanceUnlocked, totalBalance, totalSupply) { 14 | let percentage = totalSupply !== '0' ? ` - ${parseFloat(totalBalance) / parseFloat(totalSupply) * 100}% of total supply` : ''; 15 | if (balanceUnlocked !== totalBalance) { 16 | console.log(`Balance of ${address}: ${balanceUnlocked} ${tokenSymbol} unlocked (${totalBalance} ${tokenSymbol} total${percentage})`); 17 | } else { 18 | console.log(`Balance of ${address}: ${totalBalance} ${tokenSymbol}${percentage}`); 19 | } 20 | } 21 | 22 | function logBalanceAtCheckpoint(address, tokenSymbol, checkpoint, balance) { 23 | console.log(`Balance of ${address} at checkpoint ${checkpoint}: ${balance} ${tokenSymbol}`); 24 | } 25 | 26 | function logTotalSupply(tokenSymbol, totalSupply) { 27 | console.log(`Total supply is: ${totalSupply} ${tokenSymbol}`); 28 | } 29 | 30 | function logTotalSupplyAtCheckpoint(tokenSymbol, checkpoint, totalSupply) { 31 | console.log(`TotalSupply at checkpoint ${checkpoint} is: ${totalSupply} ${tokenSymbol}`); 32 | } 33 | 34 | module.exports = { 35 | logBalance, 36 | logUnlockedBalance, 37 | logBalanceAtCheckpoint, 38 | logUnlockedBalanceWithPercentage, 39 | logTotalSupply, 40 | logTotalSupplyAtCheckpoint 41 | } 42 | -------------------------------------------------------------------------------- /CLI/commands/transfer_ownership.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk'); 2 | var common = require('./common/common_functions'); 3 | 4 | /////////////////////////////ARTIFACTS////////////////////////////////////////// 5 | var abis = require('./helpers/contract_abis') 6 | 7 | let contract; 8 | //////////////////////////////////////////ENTRY INTO SCRIPT////////////////////////////////////////// 9 | 10 | async function startScript(contractAddress, transferTo) { 11 | 12 | if (!web3.utils.isAddress(contractAddress) || !web3.utils.isAddress(transferTo)) { 13 | console.log(chlak.red(`Please enter valid addresses`)); 14 | } else { 15 | let ownableABI = abis.ownable(); 16 | contract = new web3.eth.Contract(ownableABI, contractAddress); 17 | contract.setProvider(web3.currentProvider); 18 | transferOwnership(transferTo); 19 | } 20 | } 21 | 22 | async function transferOwnership(transferTo) { 23 | // Check if Issuer is the current owner 24 | let currentOwner = await contract.methods.owner().call(); 25 | if (currentOwner != Issuer.address) { 26 | console.log(chalk.red(`You are not the current owner ot this contract. Current owner is ${currentOwner}.`)); 27 | } else { 28 | let transferOwnershipAction = contract.methods.transferOwnership(transferTo); 29 | let receipt = await common.sendTransaction(transferOwnershipAction); 30 | let event = common.getEventFromLogs(contract._jsonInterface, receipt.logs, 'OwnershipTransferred'); 31 | console.log(chalk.green(`Ownership transferred successfully. New owner is ${event.newOwner}`)); 32 | } 33 | }; 34 | 35 | module.exports = { 36 | executeApp: async function(contractAddress, transferTo) { 37 | return startScript(contractAddress, transferTo); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /contracts/modules/Experimental/Burn/TrackedRedemption.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "../../Burn/IBurn.sol"; 4 | import "../../Module.sol"; 5 | import "openzeppelin-solidity/contracts/math/SafeMath.sol"; 6 | 7 | /** 8 | * @title Burn module for burning tokens and keeping track of burnt amounts 9 | */ 10 | contract TrackedRedemption is IBurn, Module { 11 | using SafeMath for uint256; 12 | 13 | mapping(address => uint256) redeemedTokens; 14 | 15 | event Redeemed(address _investor, uint256 _value); 16 | 17 | /** 18 | * @notice Constructor 19 | * @param _securityToken Address of the security token 20 | */ 21 | constructor(address _securityToken, address _polyToken) public Module(_securityToken, _polyToken) { 22 | 23 | } 24 | 25 | /** 26 | * @notice This function returns the signature of configure function 27 | */ 28 | function getInitFunction() public pure returns(bytes4) { 29 | return bytes4(0); 30 | } 31 | 32 | /** 33 | * @notice To redeem tokens and track redemptions 34 | * @param _value The number of tokens to redeem 35 | */ 36 | function redeemTokens(uint256 _value) public { 37 | securityToken.redeemFrom(msg.sender, _value, ""); 38 | redeemedTokens[msg.sender] = redeemedTokens[msg.sender].add(_value); 39 | /*solium-disable-next-line security/no-block-members*/ 40 | emit Redeemed(msg.sender, _value); 41 | } 42 | 43 | /** 44 | * @notice Returns the permissions flag that are associated with CountTransferManager 45 | */ 46 | function getPermissions() public view returns(bytes32[] memory) { 47 | bytes32[] memory allPermissions = new bytes32[](0); 48 | return allPermissions; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /docs/api/datastoreproxy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-DataStoreProxy 3 | title: DataStoreProxy 4 | original_id: DataStoreProxy 5 | --- 6 | 7 | # DataStoreProxy Proxy \(DataStoreProxy.sol\) 8 | 9 | View Source: [contracts/datastore/DataStoreProxy.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/datastore/DataStoreProxy.sol) 10 | 11 | **↗ Extends:** [**DataStoreStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/DataStoreStorage.md)**,** [**Proxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/Proxy.md) 12 | 13 | **DataStoreProxy** 14 | 15 | ## Functions 16 | 17 | * [\(address \_securityToken, address \_implementation\)](datastoreproxy.md) 18 | * [\_implementation\(\)](datastoreproxy.md#_implementation) 19 | 20 | Constructor 21 | 22 | ```javascript 23 | function (address _securityToken, address _implementation) public nonpayable 24 | ``` 25 | 26 | **Arguments** 27 | 28 | | Name | Type | Description | 29 | | :--- | :--- | :--- | 30 | | \_securityToken | address | Address of the security token | 31 | | \_implementation | address | representing the address of the new implementation to be set | 32 | 33 | ### \_implementation 34 | 35 | ⤾ overrides [Proxy.\_implementation](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/Proxy.md#_implementation) 36 | 37 | Internal function to provide the address of the implementation contract 38 | 39 | ```javascript 40 | function _implementation() internal view 41 | returns(address) 42 | ``` 43 | 44 | **Arguments** 45 | 46 | | Name | Type | Description | 47 | | :--- | :--- | :--- | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/api/ecdsa.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-ECDSA 3 | title: ECDSA 4 | original_id: ECDSA 5 | --- 6 | 7 | # Elliptic curve signature operations \(ECDSA.sol\) 8 | 9 | View Source: [openzeppelin-solidity/contracts/cryptography/ECDSA.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/openzeppelin-solidity/contracts/cryptography/ECDSA.sol) 10 | 11 | **ECDSA** 12 | 13 | Based on [https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d](https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d) TODO Remove this library once solidity supports passing a signature to ecrecover. See [https://github.com/ethereum/solidity/issues/864](https://github.com/ethereum/solidity/issues/864) 14 | 15 | ## Functions 16 | 17 | * [recover\(bytes32 hash, bytes signature\)](ecdsa.md#recover) 18 | * [toEthSignedMessageHash\(bytes32 hash\)](ecdsa.md#toethsignedmessagehash) 19 | 20 | ### recover 21 | 22 | Recover signer address from a message by using their signature 23 | 24 | ```javascript 25 | function recover(bytes32 hash, bytes signature) internal pure 26 | returns(address) 27 | ``` 28 | 29 | **Arguments** 30 | 31 | | Name | Type | Description | 32 | | :--- | :--- | :--- | 33 | | hash | bytes32 | bytes32 message, the hash is the signed message. What is recovered is the signer address. | 34 | | signature | bytes | bytes signature, the signature is generated using web3.eth.sign\(\) | 35 | 36 | ### toEthSignedMessageHash 37 | 38 | prefix a bytes32 value with "\x19Ethereum Signed Message:" and hash the result 39 | 40 | ```javascript 41 | function toEthSignedMessageHash(bytes32 hash) internal pure 42 | returns(bytes32) 43 | ``` 44 | 45 | **Arguments** 46 | 47 | | Name | Type | Description | 48 | | :--- | :--- | :--- | 49 | | hash | bytes32 | | 50 | 51 | -------------------------------------------------------------------------------- /docs/api/blacklisttransfermanagerstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-BlacklistTransferManagerStorage 3 | title: BlacklistTransferManagerStorage 4 | original_id: BlacklistTransferManagerStorage 5 | --- 6 | 7 | # Contract used to store layout for the CountTransferManager storage \(BlacklistTransferManagerStorage. 8 | 9 | View Source: [contracts/modules/TransferManager/BTM/BlacklistTransferManagerStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/TransferManager/BTM/BlacklistTransferManagerStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**BlacklistTransferManager**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/BlacklistTransferManager.md)**,** [**BlacklistTransferManagerProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/BlacklistTransferManagerProxy.md) 12 | 13 | **BlacklistTransferManagerStorage** 14 | 15 | ## Structs 16 | 17 | ### BlacklistsDetails 18 | 19 | ```javascript 20 | struct BlacklistsDetails { 21 | uint256 startTime, 22 | uint256 endTime, 23 | uint256 repeatPeriodTime 24 | } 25 | ``` 26 | 27 | ## Contract Members 28 | 29 | **Constants & Variables** 30 | 31 | ```javascript 32 | //public members 33 | mapping(bytes32 => struct BlacklistTransferManagerStorage.BlacklistsDetails) public blacklists; 34 | 35 | //internal members 36 | mapping(address => bytes32[]) internal investorToBlacklist; 37 | mapping(bytes32 => address[]) internal blacklistToInvestor; 38 | mapping(address => mapping(bytes32 => uint256)) internal investorToIndex; 39 | mapping(bytes32 => mapping(address => uint256)) internal blacklistToIndex; 40 | bytes32[] internal allBlacklists; 41 | ``` 42 | 43 | ## Functions 44 | 45 | -------------------------------------------------------------------------------- /docs/api/securitytokenproxy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-SecurityTokenProxy 3 | title: SecurityTokenProxy 4 | original_id: SecurityTokenProxy 5 | --- 6 | 7 | # USDTiered STO module Proxy \(SecurityTokenProxy.sol\) 8 | 9 | View Source: [contracts/tokens/SecurityTokenProxy.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/tokens/SecurityTokenProxy.sol) 10 | 11 | **↗ Extends:** [**OZStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/OZStorage.md)**,** [**SecurityTokenStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/SecurityTokenStorage.md)**,** [**OwnedUpgradeabilityProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/OwnedUpgradeabilityProxy.md) 12 | 13 | **SecurityTokenProxy** 14 | 15 | ## Functions 16 | 17 | * [\(string \_name, string \_symbol, uint8 \_decimals, uint256 \_granularity, string \_tokenDetails, address \_polymathRegistry\)](securitytokenproxy.md) 18 | 19 | constructor 20 | 21 | ```javascript 22 | function (string _name, string _symbol, uint8 _decimals, uint256 _granularity, string _tokenDetails, address _polymathRegistry) public nonpayable 23 | ``` 24 | 25 | **Arguments** 26 | 27 | | Name | Type | Description | 28 | | :--- | :--- | :--- | 29 | | \_name | string | Name of the SecurityToken | 30 | | \_symbol | string | Symbol of the Token | 31 | | \_decimals | uint8 | Decimals for the securityToken | 32 | | \_granularity | uint256 | granular level of the token | 33 | | \_tokenDetails | string | Details of the token that are stored off-chain | 34 | | \_polymathRegistry | address | Contract address of the polymath registry | 35 | 36 | -------------------------------------------------------------------------------- /contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./TrackedRedemption.sol"; 4 | import "../../ModuleFactory.sol"; 5 | 6 | /** 7 | * @title Factory for deploying GeneralTransferManager module 8 | */ 9 | contract TrackedRedemptionFactory is ModuleFactory { 10 | /** 11 | * @notice Constructor 12 | * @param _setupCost Setup cost of module 13 | * @param _polymathRegistry Address of the Polymath registry 14 | * @param _isCostInPoly true = cost in Poly, false = USD 15 | */ 16 | constructor( 17 | uint256 _setupCost, 18 | address _polymathRegistry, 19 | bool _isCostInPoly 20 | ) 21 | public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly) 22 | { 23 | initialVersion = "3.0.0"; 24 | name = "TrackedRedemption"; 25 | title = "Tracked Redemption"; 26 | description = "Track token redemptions"; 27 | typesData.push(5); 28 | tagsData.push("Tracked"); 29 | tagsData.push("Redemption"); 30 | compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 31 | compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 32 | } 33 | 34 | /** 35 | * @notice Used to launch the Module with the help of factory 36 | * @return Address Contract address of the Module 37 | */ 38 | function deploy( 39 | bytes calldata _data 40 | ) 41 | external 42 | returns(address) 43 | { 44 | address trackedRedemption = address(new TrackedRedemption(msg.sender, polymathRegistry.getAddress("PolyToken"))); 45 | _initializeModule(trackedRedemption, _data); 46 | return trackedRedemption; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /docs/api/kyctransfermanagerfactory.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-KYCTransferManagerFactory 3 | title: KYCTransferManagerFactory 4 | original_id: KYCTransferManagerFactory 5 | --- 6 | 7 | # KYCTransferManagerFactory.sol 8 | 9 | View Source: [contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol) 10 | 11 | **↗ Extends:** [**ModuleFactory**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ModuleFactory.md) 12 | 13 | **KYCTransferManagerFactory** 14 | 15 | ## Functions 16 | 17 | * [\(uint256 \_setupCost, address \_polymathRegistry, bool \_isCostInPoly\)](kyctransfermanagerfactory.md) 18 | * [deploy\(bytes \_data\)](kyctransfermanagerfactory.md#deploy) 19 | 20 | Constructor 21 | 22 | ```javascript 23 | function (uint256 _setupCost, address _polymathRegistry, bool _isCostInPoly) public nonpayable ModuleFactory 24 | ``` 25 | 26 | **Arguments** 27 | 28 | | Name | Type | Description | 29 | | :--- | :--- | :--- | 30 | | \_setupCost | uint256 | | 31 | | \_polymathRegistry | address | | 32 | | \_isCostInPoly | bool | | 33 | 34 | ### deploy 35 | 36 | ⤾ overrides [IModuleFactory.deploy](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/IModuleFactory.md#deploy) 37 | 38 | Used to launch the Module with the help of factory 39 | 40 | ```javascript 41 | function deploy(bytes _data) external nonpayable 42 | returns(address) 43 | ``` 44 | 45 | **Returns** 46 | 47 | address Contract address of the Module 48 | 49 | **Arguments** 50 | 51 | | Name | Type | Description | 52 | | :--- | :--- | :--- | 53 | | \_data | bytes | | 54 | 55 | -------------------------------------------------------------------------------- /docs/api/upgradeabilityproxy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-UpgradeabilityProxy 3 | title: UpgradeabilityProxy 4 | original_id: UpgradeabilityProxy 5 | --- 6 | 7 | # UpgradeabilityProxy \(UpgradeabilityProxy.sol\) 8 | 9 | View Source: [contracts/proxy/UpgradeabilityProxy.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/proxy/UpgradeabilityProxy.sol) 10 | 11 | **↗ Extends:** [**Proxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/Proxy.md) **↘ Derived Contracts:** [**OwnedUpgradeabilityProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/OwnedUpgradeabilityProxy.md) 12 | 13 | **UpgradeabilityProxy** 14 | 15 | This contract represents a proxy where the implementation address to which it will delegate can be upgraded 16 | 17 | ## Contract Members 18 | 19 | **Constants & Variables** 20 | 21 | ```javascript 22 | string internal __version; 23 | address internal __implementation; 24 | ``` 25 | 26 | **Events** 27 | 28 | ```javascript 29 | event Upgraded(string _newVersion, address indexed _newImplementation); 30 | ``` 31 | 32 | ## Functions 33 | 34 | * [\_upgradeTo\(string \_newVersion, address \_newImplementation\)](upgradeabilityproxy.md#_upgradeto) 35 | 36 | ### \_upgradeTo 37 | 38 | Upgrades the implementation address 39 | 40 | ```javascript 41 | function _upgradeTo(string _newVersion, address _newImplementation) internal nonpayable 42 | ``` 43 | 44 | **Arguments** 45 | 46 | | Name | Type | Description | 47 | | :--- | :--- | :--- | 48 | | \_newVersion | string | representing the version name of the new implementation to be set | 49 | | \_newImplementation | address | representing the address of the new implementation to be set | 50 | 51 | -------------------------------------------------------------------------------- /docs/api/plcrvotingcheckpointstorage.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-PLCRVotingCheckpointStorage 3 | title: PLCRVotingCheckpointStorage 4 | original_id: PLCRVotingCheckpointStorage 5 | --- 6 | 7 | # PLCRVotingCheckpointStorage.sol 8 | 9 | View Source: [contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointStorage.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointStorage.sol) 10 | 11 | **↘ Derived Contracts:** [**PLCRVotingCheckpoint**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PLCRVotingCheckpoint.md)**,** [**PLCRVotingCheckpointProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/PLCRVotingCheckpointProxy.md) 12 | 13 | **PLCRVotingCheckpointStorage** 14 | 15 | **Enums** 16 | 17 | ### Stage 18 | 19 | ```javascript 20 | enum Stage { 21 | PREP, 22 | COMMIT, 23 | REVEAL, 24 | RESOLVED 25 | } 26 | ``` 27 | 28 | ## Structs 29 | 30 | ### Ballot 31 | 32 | ```javascript 33 | struct Ballot { 34 | uint256 checkpointId, 35 | uint256 quorum, 36 | uint64 commitDuration, 37 | uint64 revealDuration, 38 | uint64 startTime, 39 | uint24 totalProposals, 40 | uint32 totalVoters, 41 | bool isActive, 42 | mapping(uint256 => uint256) proposalToVotes, 43 | mapping(address => struct PLCRVotingCheckpointStorage.Vote) investorToProposal, 44 | mapping(address => bool) exemptedVoters 45 | } 46 | ``` 47 | 48 | ### Vote 49 | 50 | ```javascript 51 | struct Vote { 52 | uint256 voteOption, 53 | bytes32 secretVote 54 | } 55 | ``` 56 | 57 | ## Contract Members 58 | 59 | **Constants & Variables** 60 | 61 | ```javascript 62 | struct PLCRVotingCheckpointStorage.Ballot[] internal ballots; 63 | ``` 64 | 65 | ## Functions 66 | 67 | -------------------------------------------------------------------------------- /CLI/data/STO/usd_tiered_sto_data.yml: -------------------------------------------------------------------------------- 1 | # type -> 'CappedSTO' for cappedSTO, 'USDTieredSTO' for USDTieredSTO 2 | type: 'USDTieredSTO' 3 | 4 | funding: 5 | # fundigType -> Types of currency used to collect the funds, 0 for ETH, 1 for POLY, 2 for DAI, any combination of them for more than one (i.e. [0, 1, 2] for all of them) 6 | raiseType: [0, 1] 7 | 8 | addresses: 9 | # wallet -> Ethereum account address to hold the funds. 10 | wallet: '0x0a519b4b6501f92e8f516230b97aca83257b0c01' 11 | # reserveWallet -> Ethereum account address to receive unsold tokens. 12 | reserveWallet: '0x0a519b4b6501f92e8f516230b97aca83257b0c01' 13 | # usdToken -> Contract address of the stable coin. 14 | usdToken: '0x0000000000000000000000000000000000000000' 15 | 16 | 17 | tiers: 18 | # tokensPerTiers -> Total tokens for each tier 19 | tokensPerTier: !!seq [ 190000000, 100000000, 200000000 ] 20 | # ratePerTiers -> Rate for each tier (in USD) 21 | ratePerTier: !!seq [ 0.05, 0.10, 0.15 ] 22 | # discountedTokensPerTiers -> Tokens for discounted rate for POLY investments. 0 for no discounted tokens 23 | tokensPerTierDiscountPoly: !!seq [ 0, 0, 100000000 ] 24 | # discountedRatePerTiers -> Discounted rate for POLY investments for each tier. 0 for no discounted rate 25 | ratePerTierDiscountPoly: !!seq [ 0, 0, 0.075 ] 26 | 27 | limits: 28 | # minimumInvestmentUSD -> Minimun investment in USD. 29 | minimumInvestmentUSD: 5 30 | # nonAccreditedLimitUSD -> Limit in USD for non-accredited investors 31 | nonAccreditedLimitUSD: 10000 32 | 33 | times: 34 | # startTime -> Unix timestamp at which offering get started. '' for CLI default (one minute from now) 35 | startTime: '' 36 | # endTime -> Unix timestamp at which offering get ended. '' for CLI default (one month from now) 37 | endTime: '' -------------------------------------------------------------------------------- /docs/api/vestingescrowwalletproxy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-VestingEscrowWalletProxy 3 | title: VestingEscrowWalletProxy 4 | original_id: VestingEscrowWalletProxy 5 | --- 6 | 7 | # Escrow wallet module for vesting functionality \(VestingEscrowWalletProxy.sol\) 8 | 9 | View Source: [contracts/modules/Wallet/VestingEscrowWalletProxy.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/Wallet/VestingEscrowWalletProxy.sol) 10 | 11 | **↗ Extends:** [**VestingEscrowWalletStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/VestingEscrowWalletStorage.md)**,** [**ModuleStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ModuleStorage.md)**,** [**Pausable**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/Pausable.md)**,** [**OwnedUpgradeabilityProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/OwnedUpgradeabilityProxy.md) 12 | 13 | **VestingEscrowWalletProxy** 14 | 15 | ## Functions 16 | 17 | * [\(string \_version, address \_securityToken, address \_polyAddress, address \_implementation\)](vestingescrowwalletproxy.md) 18 | 19 | Constructor 20 | 21 | ```javascript 22 | function (string _version, address _securityToken, address _polyAddress, address _implementation) public nonpayable ModuleStorage 23 | ``` 24 | 25 | **Arguments** 26 | 27 | | Name | Type | Description | 28 | | :--- | :--- | :--- | 29 | | \_version | string | | 30 | | \_securityToken | address | Address of the security token | 31 | | \_polyAddress | address | Address of the polytoken | 32 | | \_implementation | address | representing the address of the new implementation to be set | 33 | 34 | -------------------------------------------------------------------------------- /contracts/modules/Wallet/VestingEscrowWalletFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./VestingEscrowWalletProxy.sol"; 4 | import "../UpgradableModuleFactory.sol"; 5 | 6 | /** 7 | * @title Factory for deploying VestingEscrowWallet module 8 | */ 9 | contract VestingEscrowWalletFactory is UpgradableModuleFactory { 10 | 11 | /** 12 | * @notice Constructor 13 | */ 14 | constructor ( 15 | uint256 _setupCost, 16 | address _logicContract, 17 | address _polymathRegistry, 18 | bool _isCostInPoly 19 | ) 20 | public 21 | UpgradableModuleFactory("3.0.0", _setupCost, _logicContract, _polymathRegistry, _isCostInPoly) 22 | { 23 | name = "VestingEscrowWallet"; 24 | title = "Vesting Escrow Wallet"; 25 | description = "Manage vesting schedules to employees / affiliates"; 26 | typesData.push(7); 27 | tagsData.push("Vesting"); 28 | tagsData.push("Escrow"); 29 | tagsData.push("Transfer Restriction"); 30 | compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 31 | compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 32 | } 33 | 34 | /** 35 | * @notice Used to launch the Module with the help of factory 36 | * _data Data used for the intialization of the module factory variables 37 | * @return address Contract address of the Module 38 | */ 39 | function deploy(bytes calldata _data) external returns(address) { 40 | address vestingEscrowWallet = address(new VestingEscrowWalletProxy(logicContracts[latestUpgrade].version, msg.sender, polymathRegistry.getAddress("PolyToken"), logicContracts[latestUpgrade].logicContract)); 41 | _initializeModule(vestingEscrowWallet, _data); 42 | return vestingEscrowWallet; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /docs/api/counttransfermanagerproxy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-CountTransferManagerProxy 3 | title: CountTransferManagerProxy 4 | original_id: CountTransferManagerProxy 5 | --- 6 | 7 | # CountTransferManager module Proxy \(CountTransferManagerProxy.sol\) 8 | 9 | View Source: [contracts/modules/TransferManager/CTM/CountTransferManagerProxy.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/TransferManager/CTM/CountTransferManagerProxy.sol) 10 | 11 | **↗ Extends:** [**CountTransferManagerStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/CountTransferManagerStorage.md)**,** [**ModuleStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ModuleStorage.md)**,** [**Pausable**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/Pausable.md)**,** [**OwnedUpgradeabilityProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/OwnedUpgradeabilityProxy.md) 12 | 13 | **CountTransferManagerProxy** 14 | 15 | ## Functions 16 | 17 | * [\(string \_version, address \_securityToken, address \_polyAddress, address \_implementation\)](counttransfermanagerproxy.md) 18 | 19 | Constructor 20 | 21 | ```javascript 22 | function (string _version, address _securityToken, address _polyAddress, address _implementation) public nonpayable ModuleStorage 23 | ``` 24 | 25 | **Arguments** 26 | 27 | | Name | Type | Description | 28 | | :--- | :--- | :--- | 29 | | \_version | string | | 30 | | \_securityToken | address | Address of the security token | 31 | | \_polyAddress | address | Address of the polytoken | 32 | | \_implementation | address | representing the address of the new implementation to be set | 33 | 34 | -------------------------------------------------------------------------------- /contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | import "./ScheduledCheckpoint.sol"; 4 | import "../../ModuleFactory.sol"; 5 | 6 | /** 7 | * @title Factory for deploying EtherDividendCheckpoint module 8 | */ 9 | contract ScheduledCheckpointFactory is ModuleFactory { 10 | /** 11 | * @notice Constructor 12 | * @param _setupCost Setup cost of the module 13 | * @param _polymathRegistry Address of the Polymath registry 14 | * @param _isCostInPoly true = cost in Poly, false = USD 15 | */ 16 | constructor( 17 | uint256 _setupCost, 18 | address _polymathRegistry, 19 | bool _isCostInPoly 20 | ) 21 | public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly) 22 | { 23 | initialVersion = "3.0.0"; 24 | name = "ScheduledCheckpoint"; 25 | title = "Schedule Checkpoints"; 26 | description = "Allows you to schedule checkpoints in the future"; 27 | typesData.push(4); 28 | typesData.push(2); 29 | tagsData.push("Scheduled"); 30 | tagsData.push("Checkpoint"); 31 | compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 32 | compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(3), uint8(0), uint8(0)); 33 | } 34 | 35 | /** 36 | * @notice used to launch the Module with the help of factory 37 | * @return address Contract address of the Module 38 | */ 39 | function deploy( 40 | bytes calldata _data 41 | ) 42 | external 43 | returns(address) 44 | { 45 | address scheduledCheckpoint = address(new ScheduledCheckpoint(msg.sender, polymathRegistry.getAddress("PolyToken"))); 46 | _initializeModule(scheduledCheckpoint, _data); 47 | return scheduledCheckpoint; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /docs/api/lockuptransfermanagerproxy.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: version-3.0.0-LockUpTransferManagerProxy 3 | title: LockUpTransferManagerProxy 4 | original_id: LockUpTransferManagerProxy 5 | --- 6 | 7 | # CountTransferManager module Proxy \(LockUpTransferManagerProxy.sol\) 8 | 9 | View Source: [contracts/modules/TransferManager/LTM/LockUpTransferManagerProxy.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/modules/TransferManager/LTM/LockUpTransferManagerProxy.sol) 10 | 11 | **↗ Extends:** [**LockUpTransferManagerStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/LockUpTransferManagerStorage.md)**,** [**ModuleStorage**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/ModuleStorage.md)**,** [**Pausable**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/Pausable.md)**,** [**OwnedUpgradeabilityProxy**](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/docs/api/OwnedUpgradeabilityProxy.md) 12 | 13 | **LockUpTransferManagerProxy** 14 | 15 | ## Functions 16 | 17 | * [\(string \_version, address \_securityToken, address \_polyAddress, address \_implementation\)](lockuptransfermanagerproxy.md) 18 | 19 | Constructor 20 | 21 | ```javascript 22 | function (string _version, address _securityToken, address _polyAddress, address _implementation) public nonpayable ModuleStorage 23 | ``` 24 | 25 | **Arguments** 26 | 27 | | Name | Type | Description | 28 | | :--- | :--- | :--- | 29 | | \_version | string | | 30 | | \_securityToken | address | Address of the security token | 31 | | \_polyAddress | address | Address of the polytoken | 32 | | \_implementation | address | representing the address of the new implementation to be set | 33 | 34 | -------------------------------------------------------------------------------- /contracts/proxy/Proxy.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.8; 2 | 3 | /** 4 | * @title Proxy 5 | * @dev Gives the possibility to delegate any call to a foreign implementation. 6 | */ 7 | contract Proxy { 8 | /** 9 | * @dev Tells the address of the implementation where every call will be delegated. 10 | * @return address of the implementation to which it will be delegated 11 | */ 12 | function _implementation() internal view returns(address); 13 | 14 | /** 15 | * @dev Fallback function. 16 | * Implemented entirely in `_fallback`. 17 | */ 18 | function _fallback() internal { 19 | _delegate(_implementation()); 20 | } 21 | 22 | /** 23 | * @dev Fallback function allowing to perform a delegatecall to the given implementation. 24 | * This function will return whatever the implementation call returns 25 | */ 26 | function _delegate(address implementation) internal { 27 | /*solium-disable-next-line security/no-inline-assembly*/ 28 | assembly { 29 | // Copy msg.data. We take full control of memory in this inline assembly 30 | // block because it will not return to Solidity code. We overwrite the 31 | // Solidity scratch pad at memory position 0. 32 | calldatacopy(0, 0, calldatasize) 33 | // Call the implementation. 34 | // out and outsize are 0 because we don't know the size yet. 35 | let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0) 36 | // Copy the returned data. 37 | returndatacopy(0, 0, returndatasize) 38 | switch result 39 | // delegatecall returns 0 on error. 40 | case 0 { revert(0, returndatasize) } 41 | default { return(0, returndatasize) } 42 | } 43 | } 44 | 45 | function() external payable { 46 | _fallback(); 47 | } 48 | } 49 | --------------------------------------------------------------------------------