From 6aa031940700186a6791906d474f1b4617b6f0d0 Mon Sep 17 00:00:00 2001 From: lash Date: Thu, 8 Jun 2023 14:00:23 +0100 Subject: [PATCH] Add bytecode generator for cic contracts unittests --- python/MANIFEST.in | 2 +- python/README.md | 741 ++++++++++++++++++++++ python/cic_contracts/unittest/__init__.py | 13 + python/cic_contracts/unittest/owned.py | 22 + python/eth_burner/unittest/base.py | 8 +- python/eth_capped/unittest/base.py | 8 +- python/eth_expire/unittest/base.py | 5 +- python/eth_minter/unittest/base.py | 5 +- python/eth_seal/unittest/base.py | 5 +- python/eth_writer/unittest/base.py | 5 +- python/solidity/BurnerTest.bin | 1 - python/solidity/BurnerTest.sol | 50 -- python/solidity/CappedTest.bin | 1 - python/solidity/CappedTest.sol | 29 - python/solidity/ExpireTest.bin | 1 - python/solidity/ExpireTest.sol | 47 -- python/solidity/MinterTest.bin | 1 - python/solidity/MinterTest.sol | 35 - python/solidity/SealTest.bin | 1 - python/solidity/SealTest.sol | 25 - python/solidity/WriterTest.bin | 1 - python/solidity/WriterTest.sol | 33 - 22 files changed, 789 insertions(+), 250 deletions(-) create mode 100644 python/README.md create mode 100644 python/cic_contracts/unittest/__init__.py create mode 100644 python/cic_contracts/unittest/owned.py delete mode 100644 python/solidity/BurnerTest.bin delete mode 100644 python/solidity/BurnerTest.sol delete mode 100644 python/solidity/CappedTest.bin delete mode 100644 python/solidity/CappedTest.sol delete mode 100644 python/solidity/ExpireTest.bin delete mode 100644 python/solidity/ExpireTest.sol delete mode 100644 python/solidity/MinterTest.bin delete mode 100644 python/solidity/MinterTest.sol delete mode 100644 python/solidity/SealTest.bin delete mode 100644 python/solidity/SealTest.sol delete mode 100644 python/solidity/WriterTest.bin delete mode 100644 python/solidity/WriterTest.sol diff --git a/python/MANIFEST.in b/python/MANIFEST.in index 343f4f7..17b5f6a 100644 --- a/python/MANIFEST.in +++ b/python/MANIFEST.in @@ -1 +1 @@ -include *requirements.txt solidity/* LICENSE README* +include *requirements.txt solidity/* LICENSE README* cic_contracts/unittest/solidity/* diff --git a/python/README.md b/python/README.md new file mode 100644 index 0000000..521404b --- /dev/null +++ b/python/README.md @@ -0,0 +1,741 @@ +# Smart contract interfaces + +## Technology + +CIC smart contracts are implemented using the *solidity* programming +language for the (Ethereum Virtual Machine (EVM). + +## Adopted standards + +### Signing + +### ERC - Direct use + +The following well-known solidity interfaces are used directly. + +- [ERC20 - Token Standard](https://eips.ethereum.org/EIPS/eip-20) + +- [ERC165 - Standard Interface + Detection](https://eips.ethereum.org/EIPS/eip-165) + +- [ERC173 - Contract Ownership + Standard](https://eips.ethereum.org/EIPS/eip-173) + +- [ERC191 - Signed Data + Standard](https://eips.ethereum.org/EIPS/eip-191) + +- [ERC712 - Typed structured data hashing and + signing](https://eips.ethereum.org/EIPS/eip-712) + +- [ERC721 - Non-Fungible Token + Standard](https://eips.ethereum.org/EIPS/eip-721) + +- [ERC5007 - Time NFT (EIP-721 Time + Extension)](https://eips.ethereum.org/EIPS/eip-5007) + +- [ERC5192 - Minimal Soulbound + NFTs](https://eips.ethereum.org/EIPS/eip-5192) + +### ERCs Partial use + +The following well-known solidity interfaces are partially implemented +in CIC native interfaces. + +- [ERC5679 - Token Minting and + Burning](https://eips.ethereum.org/EIPS/eip-5679) (See `Minter`, + `Burner`) + +## Native interfaces + +### Accounts Index + +Append-only list of addresses. Typically used for access control lists. + +Addresses may be *added*, *removed*, aswell as *deactivated* and +*activated*. Deactivated accounts still count towards the `entryCount`. + +The `entry` method is used to iterate the account list. The order of +which accounts are returned is not guaranteed. Any returned value +matching `address(0x00)` should be skipped, and not counted towards +`entryCount`. + +May optionally record time when account was added. + +ERC165 Interface identifier +b7bca625 + +Solidity interface definition + interface IAccountsIndex { + // Address added to store, index in array. + event AddressAdded(uint256 indexed _idx, address _account); + + // Return number of entries in index. + function entryCount() external view returns (uint256); + + // Return entry at the spceificed index. + // Will revert if index is beyond array length. + // An entry result of 0 means the entry should be skipped, and not count towards entry count. + function entry(uint256) external view returns (address); + + // Add an entry to the index. Incresases the entry count. + function add(address) external returns (bool); + + // Verify that the entry exists in the index. + function have(address) external view returns (bool); + + // Retrieve the timestamp when account was added. + // If time is not being tracked, a value of 0 should be returned. + function time(address) external view returns (uint256); + } + +Reference implementation + (v0.5.1) + +### Accounts Index Mutable + +Extends the functionality of `Accounts Index` to allow changes to the +address list. + +Addresses may be *added*, *removed*, aswell as *deactivated* and +*activated*. Deactivated accounts still count towards the `entryCount`. + +ERC165 Interface identifier +9479f0ae + +Solidity interface definition + interface IAccountsIndexMutable { + // Active status of address changed, and by whom changed. + event AddressActive(address indexed _account, bool _active); + + // Address removed from store, and by whom removed. + event AddressRemoved(address _account); + + // Remove an entry from the index. Reduces the entry count. + function remove(address) external returns (bool); + + // Deactivate account but keep in index. Does not affect entry count. + function deactivate(address) external returns (bool); + + // Activate previously deactivated account. Does not affect entry count. + function activate(address) external returns (bool); + + // Check if account exists and is active; + function isActive(address) external view returns (bool); + } + +Reference implementation + (v0.5.1) + +### Burner + +Attached to `ERC20` and `ERC721` tokens that may be *burned*. + +Implements the `burn(...)` part of `ERC5679` for interoperability. + +ERC165 Interface identifier +bc4babdd + +Solidity interface definition + interface IBurner { + // Token(s) successfully burned; by who and how much. + event Burn(address indexed _burner, uint256 _burned); + + // Satisfies ERC 5679 + function burn(address _from, uint256 _amount, bytes calldata _data) external; + + // Burn given amount of tokens held by signer. + function burn(uint256 _burn) external returns (bool); + + // Burn all tokens held by signer. + function burn() external returns (bool); + + // Total amount of tokens that have been burned. + function totalBurned() external returns (uint256); + + // Total amount of tokens ever minted. + // If totalSupply() is available (ERC20, ERC721 Enumerable), this equals totalSupply() + totalBurned(). + function totalMinted() external returns (uint256); + } + +Example implementation + + +### Chrono + +Define a creation time for a resource. + +Complements `ERC5007`. + +ERC165 Interface identifier +4db1ccd4 + +Solidity interface definition + interface IChrono { + // Returns the timestamp of when a resource corresponding to _idx was first created. + // int64 chosen as return value for simpler interoperability with ERC5007. + function createTime(uint256 _idx) external returns(int64); + } + +Example implementation + (BadgeToken contract) + +### Declarator + +Permissionless store of signed claims made by an address about other +addresses, or addresses about themselves. + +It is used to declare or respond to certifications of vouchers, NFT, +voucher members. + +Addresses may be Externally Owned Accounts or smart contracts. + +Claims may be made with or without topics. A missing topic is synonymous +with a topic value of `bytes32(0x00)`. + +Any number of claims can be made about an address under any number of +topics. All claims must be stored, and returned in the order which they +were added. + +ERC165 Interface identifier +21b7493b + +Solidity interface definition + interface IDeclarator { + event DeclarationAdded(address indexed _declarator, address indexed _subject, bytes32 indexed _topic, bytes32 _proof); + + // Get all declarations for a subject (without topic) signed by a declarator + function declaration(address _declarator, address _subject) external view returns ( bytes32[] memory ); + + // Get all declarations for a subject for the given topic signed by a declarator + function declaration(address _declarator, address _subject, bytes32 _topic) external view returns ( bytes32[] memory ); + + // Get number of declarations the declarator has ever signed + function declarationCount(address _declarator) external view returns ( uint256 ); + + // Get the subject of a declarator's declarations at the specific index + function declarationAddressAt(address _declarator, uint256 _idx) external view returns ( address ); + + // Add a declaration for the subject + function addDeclaration(address _subject, bytes32 _proof) external returns ( bool ); + + // Add a declaration with topic for the subject + function addDeclaration(address _subject, bytes32 _proof, bytes32 _topic) external returns ( bool ); + + // Get the declarator that signed a declaration at the specificed index for a subject + function declaratorAddressAt(address _subject, uint256 _idx) external view returns ( address ); + + // Get the number of declarators that have signed for a subject + function declaratorCount(address _subject) external view returns ( uint256 ); + } + +Reference implementation + + +### Digest + +Allows encoding of digests according to a specific encoding scheme. + +Primary use-case is the abstraction of self-describing +[Multhash](https://multiformats.io/multihash/) encoding. + +A default encoding *must* always be defined, and the encoding of a valid +digest *must* succeed with the default encoding. + +ERC165 Interface identifier +982ab05d + +Solidity interface definition + interface IDigest { + // Returns the default digest encoding used by the contract instance. + function defaultDigestEncoding() external view returns (uint256 _encoding); + + // Check if the given encoding has been implemented in the contract instance. + function haveDigestEncoding(uint256 _codec) external view returns(bool); + + // Verify and encode the given digest for a specific hashing algorithm. + // Returns a zero-length byte array if digest is invalid. + // Must succeed if called with the defaultDigestEncoding and a valid digest. + function encodeDigest(bytes memory _data, uint256 _encoding) external view returns (bytes memory); + + // Encodes the digest using the default digest encoding. + // Returns a zero-length byte array if digest is invalid. + // Must succeed with a valid digest. + function encodeDigest(bytes memory _data) external view returns (bytes memory); + } + +Example implementation + + +### Expire + +Defines an expiry time after which token balances or supply *cannot +change*. + +A contract defining an expiry *must not* allow changing the expiration +time to a time in the past. + +ERC165 Interface identifier +841a0e94 + +Solidity interface definition + interface IExpire { + // Contract has expired. + event Expired(uint256 _timestamp); + + // Expiry time has changed. + event ExpiryChange(uint256 indexed _oldTimestamp, uint256 _newTimestamp); + + // The current expiration timestamp. + function expires() external returns (uint256); + + // Check expiry and apply expiration if expired. + // Return values must be: + // 0: not yet expired. + // 1: already expired. + // >1: expiry executed. + function applyExpiry() external returns(uint8); + } + +Example implementation + + +### Faucet + +Used for dispensing tokens to any address. + +It can be used for gas tokens and *ERC20* alike. + +The interface is the same whether the faucet is dispensing from existing +balance or minting new tokens. + +The value dispersed *must* be the same for all addresses. + +In general, four criteria are expected to exist in any combination for +limiting access to the faucet: + +Time +A recipient may only use the faucet again after some time has passed. + +Balance threshold +A recipient may only use the faucet after its balance is below a certain +amount. + +Membership +A recipient may only use the faucet if it has been added to an access +control list. + +Capacity +The contract has sufficient token funds to dispense the current defined +amount to dispense. + +The *check(address)* contract call *must* evaluate all four criteria, +and *must* return `false` if any of the criteria are not met. + +ERC165 Interface identifier +1a3ac634 + +Solidity interface definition + interface IFaucet { + // Tokens were given to an address + event Give(address indexed _recipient, address indexed _token, uint256 _value); + + // The amount that the faucet disperses has changed + event FaucetAmountChange(uint256 _value); + + // Address of token the faucet represents + // The faucet will return gas tokens with the zero-address is returned. + function token() external returns (address); + + // Amount of tokens the faucet gives out + function tokenAmount() external returns (uint256); + + // Give tokens to the given recipient. Returns amount of tokens given. + function giveTo(address _recipient) external returns (uint256); + + // Give tokens to yourself. Returns amount of tokens given. + function gimme() external returns (uint256); + + // Check if faucet may be used in the current contract state by _recipient + function check(address _recipient) external view returns (bool); + + // Returns timestamp when faucet may be used again by _recipient + // If 0 is returned, the address has not yet been used. + // A return value of max(uint256) indicates that the faucet may not be used again. + function nextTime(address _recipient) external returns (uint256); + + // Returns the token balance under which faucet may be used again by _recipient + // A return value of max(uint256) indicates that the faucet may be used regardless + // of the token balance of _recipient + function nextBalance(address _recipient) external returns (uint256); + } + +Reference implementations +- + +- + +### Locator + +This interface supports `ERC721 Metadata`, in particular the +`tokenURI(uint256)` call. + +Off-chain resources in the CIC network *must* be defined in terms of +content addressed strings. + +It *must* be possible to refer to all off-chain resources directly by +the content address. + +Furthermore, it *should* be possible to refer to a resource by a +fully-qualified location on the web or an overlay network (e.g. tor). + +ERC165 Interface identifier +ed75b333 + +Solidity interface definition + interface ILocator { + // URI that may or may not point to a specific resource location. + function toURI(bytes memory _data) external view returns (string memory); + + // URL pointing to a specific resource location. + function toURL(bytes memory _data) external view returns(string memory); + } + +Example implementation + + +#### Expressing locators in terms of numetic token id + +Given the numeric token id `1234567890987654321` (`0x112210f4b16c1cb1` +hex), and a base url `https://contentgateway.grassecon.net`, the result +of the methods may be as follows: + +`toURI(toHex(1234567890987654321))` +-\> +`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1` + +`toURL(toHex(1234567890987654321))` +-\> +`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1` + +`tokenURI(1234567890987654321)` +-\> +`https://contentgateway.grassecon.net/000000000000000000000000000000000000000000000000112210f4b16c1cb1` + +#### Expressing locators in terms of a digest + +Given the data `foo`, the digest algorithm `sha256` and a base url +`https://contentgateway.grassecon.net`, the result of the methods may be +as follows: + +`toURI(sha256(foo))` +-\> +`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"` + +`toURL(sha256(foo))` +-\> +`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"` + +`tokenURI(toUint(sha256(foo)))` +-\> +`"https://contentgateway.grassecon.net/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"` + +#### Locator without URL + +Given the data `foo`, the digest algorithm `sha256` and no base url, the +result of the methods may be as follows: + +`toURI(sha256(foo))` +-\> +`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"` + +`toURL(sha256(foo))` +-\> `""` + +`tokenURI(toUint(sha256(foo)))` +-\> +`"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"` + +### Minter + +Attached to `ERC20` and `ERC721` tokens that may be minted. + +Implements the `mint(...)` and `safeMint(...)` parts of `ERC5679` for +interoperability. + +ERC165 Interface identifier +5878bcf4 + +Solidity interface definition + interface IMinter { + // Tokens are successfully minted; by who, to whom and how much + event Mint(address indexed _minter, address indexed _beneficiary, uint256 value); + + // Mint the specified value of tokens to the specified recipient + function mintTo(address _beneficiary, uint256 value) external returns (bool); + + // Satisfies ERC5679 for ERC20 + function mint(address _beneficiary, uint256 value, bytes calldata _data) external; + + // Satisfies ERC5679 for ERC721 + function safeMint(address _beneficiary, uint256 value, bytes calldata _data) external; + } + +Example implementation + + +### Msg + +Enables a reference "message" to describe the contract using an +off-chain resource. + +The reference may or may not be mutable. + +The interface complements `Locator` and `MultiHash` to generate locators +for how to resolve the reference. + +ERC165 Interface identifier +a3002595 + +Solidity interface definition + interface IMsg { + // Emitted when a new message digest has been set + // Should not be emitted if the digest set is identical to the previous + event Msg(bytes _msgDigest); + + // Get the current message content hash + function getMsg() external view returns(bytes memory); + } + +Example implementation + + +### Registry + +The Registry interface is a key-value store resolving well-known +contract identifier names to contract addresses. + +It currently has two distinct uses in the CIC context: + +1. Entry-point to discover all relevant contracts of CIC networks. + +2. Unique (ERC20) token symbol resolver. + +ERC165 Interface identifier +effbf671 + +Solidity interface definition + interface IRegistryClient { + // Address added to store with the given key + event AddressKey(bytes32 indexed _key, address _address); + + // Return the address of the contract identified by the given byte string + function addressOf(bytes32) external view returns (address); + + // Indexed accessor for the full list of registred identifiers + function identifier(uint256) external view returns (bytes32); + + // Number of registered interfaces + function identifierCount() external view returns (uint256); + } + +Contract registry implementation + + +Token index implementation + + +### Seal + +Some smart contract parameters may need to be mutable over part of a +smart contract’s lifetime. + +This interface provides a method to explicitly signal when certain +parameters have been rendered immutable. + +The value of `sealState()` *must not* decrease, and must not exceed +`maxSealState`. + +`maxSealState` is used to define that *all mutable parameters* have been +rendered immutable. The practical implications of this will vary between +contracts. + +The implementer is encouraged to use simple, descriptive names in the +source code to describe the applicable seal states. + +Use cases of sealing include: + +- Whether more tokens can be minted + +- Allow ownership of a contract to be transferred + +- The expiry time of a token (see `Expire`) + +ERC165 Interface identifier +0d7491f8 + +Solidity interface definition + interface ISeal { + // Seal state has changed. + event SealStateChange(bool indexed _final, uint256 _sealState); + + // The current seal state. + function sealState() external view returns(uint256); + + // The numeric seal state in everything sealable has been sealed. + function maxSealState() external view returns(uint256); + } + +Example implementation + + +### TokenVend + +This interface defines the mechanism for which a specific ERC20 token +may be exchanged for a different ERC20 token. + +A typical use-case is generation of voting tokens based on a momentary +voucher balance. This is especially useful if the original ERC20 token +is subject to decay (demurrage). + +The tokens used for exchange **SHOULD** be locked for the full duration +of holding the vended tokens. + +The withdrawal function may or may not allow partial withdrawals. + +ERC165 Interface identifier +8a13249c + +Solidity interface definition + interface ITokenVend { + // A new vended token has been created. + event TokenCreated(uint256 indexed _tokenIdx, uint256 indexed _supply, address _token); + + // Create corresponding vended tokens for the control token balance of the caller. + function getFor(address _token) external returns (uint256); + + // Recover control tokens that were used to retrieve the corresponding vended tokens. + function withdrawFor(address _token) external returns (uint256); + } + +Reference implementations +- + +### TokenVote + +Execute elections with granular ERC20 token votes. + +A proposal submitted for vote may or may not contain multiple options. +If multiple options are available, an ERC20 token holder may distribute +its vote among the options with the granularity of the token balance. + +Voted tokens **SHOULD** be locked until the voting has finalized. + +Finalization of voting should be callable by anyone. + +ERC165 Interface identifier +28091366 + +Solidity interface definition + interface ITokenVote { + + // A new proposal has been created. + event ProposalAdded(uint256 indexed _blockDeadline, uint256 indexed voteTargetPpm, uint256 indexed _proposalIdx); + + // A proposal vote has been completed. + // The proposal is identified by the serial number in _proposalIdx. It is up to the implementer to define how the proposal should be retrieved by index. + // The proposal result may be in one of three states: + // * Ratified (_cancelled == false, _insufficient == false) + // * Cancelled (_cancelled == true, _insufficient == false) + // * Not reached quorum (_cancelled == false, _insufficient == true) + event ProposalCompleted(uint256 indexed _proposalIdx, bool indexed _cancelled, bool indexed _insufficient, uint256 _totalVote); + + // Propose a new vote. + // Voting is active until one of: + // * total cancel vote reach quorum (_targetVotePpm, ppm = parts-per-million). + // * _blockWait blocks from now. + function propose(bytes32 _description, uint256 _blockWait, uint24 _targetVotePpm) external returns (uint256); + + // Same as propose(...), but provide options to vote on. + function proposeMulti(bytes32 _description, bytes32[] memory _options, uint256 _blockWait, uint24 _targetVotePpm) external returns (uint256); + + // Get number of options available for the proposal. + // This decides the boundary of the index that can be used with voteOptions(...) + // If the result is 0, vote(...) can be used aswell. + function optionCount(uint256 _proposalIdx) external view returns(uint256); + + // Get proposal option. Assumes that proposal was created with proposeMulti(...) + function getOption(uint256 _proposalIdx, uint256 _optionIdx) external view returns (bytes32); + + // Get vote count for the given option. + // If proposal has no options, it should be called with _optionIdx = 0 + function voteCount(uint256 _proposalIdx, uint256 _optionIdx) external view returns(uint256); + + // Vote on a proposal without options. + // Assumes that proposal was created with propose(...) and will fail otherwise. + function vote(uint256 _value) external returns (bool); + + // Vote on a proposal option. Assumes that proposal was created with proposeMulti(...). + // Must work with a non-option proposal if _optionIndex is 0. + function voteOption(uint256 _optionIndex, uint256 _value) external returns (bool); + + // Vote to cancel a proposal. + // If cancel has the majority: + // * A vote without options will have rejected the proposal description. + // * A vote with options will have rejected the proposal description as well as all option descriptions. + function voteCancel(uint256 _value) external returns (bool); + + // Finalize the vote for a proposal. + // May be called if deadline has been passed, or if: + // * quorum has been reached with cancel votes. + // * quorum has been reached and proposal has no/only one option. + function finalize() external returns (bool); + } + +Reference implementations +- + +### Writer + +A complement to ERC173, which allows definition of a class of +super-users for a contract. + +A super-user address may perform *more* actions than a "normal" address, +aswell as *some* actions normally limited to the *contract owner*. + +If an *contract owner* is defined, No super-user should be able to +perform actions that *contract owner* cannot perform. + +Typically, only the *contract owner*, if it is defined, can add or +remove a super-user. + +Some use-case examples of super-user actions include: + +- Mint new tokens. + +- Change the amount dispensed by the faucet. + +- Edit access control lists. + +ERC165 Interface identifier +abe1f1f5 + +Solidity interface definition + interface IWriter { + // A writer has been added by _executor + event WriterAdded(address _writer); + + // A writer has been removed by _executor + event WriterDeleted(address _writer); + + // Add a new writer to the contract. + function addWriter(address _writer) external returns (bool); + + // Remove existing writer from the contract. + function deleteWriter(address _writer) external returns (bool); + + // Check whether the given address is a writer. + function isWriter(address _writer) external view returns (bool); + } + +Example implementation + diff --git a/python/cic_contracts/unittest/__init__.py b/python/cic_contracts/unittest/__init__.py new file mode 100644 index 0000000..687044c --- /dev/null +++ b/python/cic_contracts/unittest/__init__.py @@ -0,0 +1,13 @@ +# standard imports +import os + +cic_unittest_dir = os.path.dirname(os.path.realpath(__file__)) +contracts_dir = os.path.join(cic_unittest_dir, 'solidity') + + +def bytecode(v): + fp = os.path.join(contracts_dir, v.capitalize() + 'Test.bin') + f = open(fp, 'r') + r = f.read() + f.close() + return r diff --git a/python/cic_contracts/unittest/owned.py b/python/cic_contracts/unittest/owned.py new file mode 100644 index 0000000..00cc8ed --- /dev/null +++ b/python/cic_contracts/unittest/owned.py @@ -0,0 +1,22 @@ +# external imports +from hexathon import strip_0x +from hexathon import same as same_hex +from chainlib.eth.nonce import RPCNonceOracle +from chainlib.eth.address import to_checksum_address +from eth_owned import Owned + + +class TestInterface: + + def __owned_check(self): + self.owner == to_checksum_address(self.owner) + + + def test_owner(self): + self.__owned_check() + + c = Owned(self.chain_spec) + o = c.owner(self.address, sender_address=self.accounts[0]) + r = self.rpc.do(o) + owner_address = c.parse_owner(r) + self.assertTrue(same_hex(self.owner, owner_address)) diff --git a/python/eth_burner/unittest/base.py b/python/eth_burner/unittest/base.py index 71619e4..191e90d 100644 --- a/python/eth_burner/unittest/base.py +++ b/python/eth_burner/unittest/base.py @@ -12,13 +12,11 @@ from chainlib.eth.tx import TxFactory from chainlib.eth.tx import TxFormat from chainlib.eth.contract import ABIContractEncoder from chainlib.eth.contract import ABIContractType +from cic_contracts.unittest import bytecode # local imports from eth_burner import EthBurner -script_dir = os.path.dirname(os.path.realpath(__file__)) -contract_dir = os.path.join(script_dir, '..', '..', 'solidity') - logg = logging.getLogger(__name__) @@ -30,9 +28,7 @@ class TestEthBurner(EthTesterCase): self.conn = RPCConnection.connect(self.chain_spec, 'default') nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) - f = open(os.path.join(contract_dir, 'BurnerTest.bin')) - code = f.read() - f.close() + code = bytecode('burner') txf = TxFactory(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) tx = txf.template(self.accounts[0], None, use_nonce=True) diff --git a/python/eth_capped/unittest/base.py b/python/eth_capped/unittest/base.py index 2c26b79..199034c 100644 --- a/python/eth_capped/unittest/base.py +++ b/python/eth_capped/unittest/base.py @@ -11,9 +11,7 @@ from chainlib.eth.tx import TxFactory from chainlib.eth.tx import TxFormat from chainlib.eth.contract import ABIContractEncoder from chainlib.eth.contract import ABIContractType - -script_dir = os.path.dirname(os.path.realpath(__file__)) -contract_dir = os.path.join(script_dir, '..', '..', 'solidity') +from cic_contracts.unittest import bytecode logg = logging.getLogger(__name__) @@ -28,9 +26,7 @@ class TestEthCapped(EthTesterCase): self.conn = RPCConnection.connect(self.chain_spec, 'default') nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) - f = open(os.path.join(contract_dir, 'CappedTest.bin')) - code = f.read() - f.close() + code = bytecode('capped') txf = TxFactory(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) tx = txf.template(self.accounts[0], None, use_nonce=True) diff --git a/python/eth_expire/unittest/base.py b/python/eth_expire/unittest/base.py index 23e935a..afa0f3e 100644 --- a/python/eth_expire/unittest/base.py +++ b/python/eth_expire/unittest/base.py @@ -12,6 +12,7 @@ from chainlib.eth.tx import TxFactory from chainlib.eth.tx import TxFormat from chainlib.eth.contract import ABIContractEncoder from chainlib.eth.contract import ABIContractType +from cic_contracts.unittest import bytecode script_dir = os.path.dirname(os.path.realpath(__file__)) contract_dir = os.path.join(script_dir, '..', '..', 'solidity') @@ -27,9 +28,7 @@ class TestEthExpire(EthTesterCase): self.conn = RPCConnection.connect(self.chain_spec, 'default') nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) - f = open(os.path.join(contract_dir, 'ExpireTest.bin')) - code = f.read() - f.close() + code = bytecode('expire') txf = TxFactory(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) tx = txf.template(self.accounts[0], None, use_nonce=True) diff --git a/python/eth_minter/unittest/base.py b/python/eth_minter/unittest/base.py index 559a5a8..6c0537c 100644 --- a/python/eth_minter/unittest/base.py +++ b/python/eth_minter/unittest/base.py @@ -12,6 +12,7 @@ from chainlib.eth.tx import TxFactory from chainlib.eth.tx import TxFormat from chainlib.eth.contract import ABIContractEncoder from chainlib.eth.contract import ABIContractType +from cic_contracts.unittest import bytecode # local imports from eth_minter import EthMinter @@ -30,9 +31,7 @@ class TestEthMinter(EthTesterCase): self.conn = RPCConnection.connect(self.chain_spec, 'default') nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) - f = open(os.path.join(contract_dir, 'MinterTest.bin')) - code = f.read() - f.close() + code = bytecode('minter') txf = TxFactory(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) tx = txf.template(self.accounts[0], None, use_nonce=True) diff --git a/python/eth_seal/unittest/base.py b/python/eth_seal/unittest/base.py index 0fbe55b..708623d 100644 --- a/python/eth_seal/unittest/base.py +++ b/python/eth_seal/unittest/base.py @@ -11,6 +11,7 @@ from chainlib.eth.tx import TxFactory from chainlib.eth.tx import TxFormat from chainlib.eth.contract import ABIContractEncoder from chainlib.eth.contract import ABIContractType +from cic_contracts.unittest import bytecode script_dir = os.path.dirname(os.path.realpath(__file__)) contract_dir = os.path.join(script_dir, '..', '..', 'solidity') @@ -28,9 +29,7 @@ class TestEthSeal(EthTesterCase): self.conn = RPCConnection.connect(self.chain_spec, 'default') nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) - f = open(os.path.join(contract_dir, 'SealTest.bin')) - code = f.read() - f.close() + code = bytecode('seal') txf = TxFactory(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) tx = txf.template(self.accounts[0], None, use_nonce=True) diff --git a/python/eth_writer/unittest/base.py b/python/eth_writer/unittest/base.py index 921b5a2..d3b90b0 100644 --- a/python/eth_writer/unittest/base.py +++ b/python/eth_writer/unittest/base.py @@ -11,6 +11,7 @@ from chainlib.eth.tx import TxFactory from chainlib.eth.tx import TxFormat from chainlib.eth.contract import ABIContractEncoder from chainlib.eth.contract import ABIContractType +from cic_contracts.unittest import bytecode # local imports from eth_writer import EthWriter @@ -31,9 +32,7 @@ class TestEthWriter(EthTesterCase): self.conn = RPCConnection.connect(self.chain_spec, 'default') nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) - f = open(os.path.join(contract_dir, 'WriterTest.bin')) - code = f.read() - f.close() + code = bytecode('writer') txf = TxFactory(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) tx = txf.template(self.accounts[0], None, use_nonce=True) diff --git a/python/solidity/BurnerTest.bin b/python/solidity/BurnerTest.bin deleted file mode 100644 index af1b5e3..0000000 --- a/python/solidity/BurnerTest.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b5060405161070438038061070483398181016040528101906100329190610081565b8060008190555080600281905550506100ae565b600080fd5b6000819050919050565b61005e8161004b565b811461006957600080fd5b50565b60008151905061007b81610055565b92915050565b60006020828403121561009757610096610046565b5b60006100a58482850161006c565b91505092915050565b610647806100bd6000396000f3fe608060405234801561001057600080fd5b506004361061007f576000357c01000000000000000000000000000000000000000000000000000000009004806301ffc9a71461008457806342966c68146100b457806344d17187146100e457806344df8e7014610100578063a2309ff81461011e578063d89135cd1461013c575b600080fd5b61009e60048036038101906100999190610353565b61015a565b6040516100ab919061039b565b60405180910390f35b6100ce60048036038101906100c991906103ec565b61020a565b6040516100db919061039b565b60405180910390f35b6100fe60048036038101906100f991906104dc565b61021f565b005b61010861022f565b604051610115919061055f565b60405180910390f35b610126610241565b604051610133919061055f565b60405180910390f35b610144610247565b604051610151919061055f565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036101ae5760019050610205565b63bc4babdd7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036102005760019050610205565b600090505b919050565b60006102158261024d565b5060019050919050565b6102288361020a565b5050505050565b600061023c60005461024d565b905090565b60005481565b60015481565b6000808260025461025e91906105a9565b101561026957600080fd5b816001600082825461027b91906105dd565b92505081905550816002600082825461029491906105a9565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040516102e1919061055f565b60405180910390a2819050919050565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610330816102fb565b811461033b57600080fd5b50565b60008135905061034d81610327565b92915050565b600060208284031215610369576103686102f1565b5b60006103778482850161033e565b91505092915050565b60008115159050919050565b61039581610380565b82525050565b60006020820190506103b0600083018461038c565b92915050565b6000819050919050565b6103c9816103b6565b81146103d457600080fd5b50565b6000813590506103e6816103c0565b92915050565b600060208284031215610402576104016102f1565b5b6000610410848285016103d7565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061044482610419565b9050919050565b61045481610439565b811461045f57600080fd5b50565b6000813590506104718161044b565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261049c5761049b610477565b5b8235905067ffffffffffffffff8111156104b9576104b861047c565b5b6020830191508360018202830111156104d5576104d4610481565b5b9250929050565b600080600080606085870312156104f6576104f56102f1565b5b600061050487828801610462565b9450506020610515878288016103d7565b935050604085013567ffffffffffffffff811115610536576105356102f6565b5b61054287828801610486565b925092505092959194509250565b610559816103b6565b82525050565b60006020820190506105746000830184610550565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006105b4826103b6565b91506105bf836103b6565b92508282039050818111156105d7576105d661057a565b5b92915050565b60006105e8826103b6565b91506105f3836103b6565b925082820190508082111561060b5761060a61057a565b5b9291505056fea2646970667358221220cf04ca2f9a9ef1aee6a7109799862035ae01e772554ee9c71f0ca5243159197164736f6c63430008130033 \ No newline at end of file diff --git a/python/solidity/BurnerTest.sol b/python/solidity/BurnerTest.sol deleted file mode 100644 index f7143c9..0000000 --- a/python/solidity/BurnerTest.sol +++ /dev/null @@ -1,50 +0,0 @@ -pragma solidity >=0.6.3; - -// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 -// SPDX-License-Identifier: AGPL-3.0-or-later - -contract MinterTest { - uint256 public totalMinted; - uint256 public totalBurned; - uint256 balance; - - event Burn(address indexed _burner, uint256 _burned); - - constructor(uint256 _mintValue) { - totalMinted = _mintValue; - balance = _mintValue; - } - - function burn(address _from, uint256 _value, bytes calldata _data) public { - _from; - _data; - burn(_value); - } - - function burn(uint256 _value) public returns (bool) { - burnCore(_value); - return true; - } - - function burnCore(uint256 _value) internal returns(uint256) { - require(balance - _value >= 0); - totalBurned += _value; - balance -= _value; - emit Burn(msg.sender, _value); - return _value; - } - - function burn() public returns (uint256) { - return burnCore(totalMinted); - } - - function supportsInterface(bytes4 _sum) public pure returns (bool) { - if (_sum == 0x01ffc9a7) { // EIP165 - return true; - } - if (_sum == 0xbc4babdd) { // Burner - return true; - } - return false; - } -} diff --git a/python/solidity/CappedTest.bin b/python/solidity/CappedTest.bin deleted file mode 100644 index 28db2c3..0000000 --- a/python/solidity/CappedTest.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b506040516104003803806104008339818101604052810190610032919061007a565b80600081905550506100a7565b600080fd5b6000819050919050565b61005781610044565b811461006257600080fd5b50565b6000815190506100748161004e565b92915050565b6000602082840312156100905761008f61003f565b5b600061009e84828501610065565b91505092915050565b61034a806100b66000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c01000000000000000000000000000000000000000000000000000000009004806301ffc9a7146100635780636f8b44b014610093578063d5abeb01146100af575b600080fd5b61007d60048036038101906100789190610224565b6100cd565b60405161008a919061026c565b60405180910390f35b6100ad60048036038101906100a891906102bd565b61017d565b005b6100b76101c1565b6040516100c491906102f9565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036101215760019050610178565b63869f75947c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036101735760019050610178565b600090505b919050565b6000547f9722adea12ab7ef86fc45b88f0e0b567639e8dddaae60261e08c03d747fbbfe6826040516101af91906102f9565b60405180910390a28060008190555050565b60005481565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610201816101cc565b811461020c57600080fd5b50565b60008135905061021e816101f8565b92915050565b60006020828403121561023a576102396101c7565b5b60006102488482850161020f565b91505092915050565b60008115159050919050565b61026681610251565b82525050565b6000602082019050610281600083018461025d565b92915050565b6000819050919050565b61029a81610287565b81146102a557600080fd5b50565b6000813590506102b781610291565b92915050565b6000602082840312156102d3576102d26101c7565b5b60006102e1848285016102a8565b91505092915050565b6102f381610287565b82525050565b600060208201905061030e60008301846102ea565b9291505056fea2646970667358221220f6bc26e7c6827142ccee8c0cadc8cb76d33712a68eacd67b69e4f8108aa2b59064736f6c63430008130033 \ No newline at end of file diff --git a/python/solidity/CappedTest.sol b/python/solidity/CappedTest.sol deleted file mode 100644 index e4f7427..0000000 --- a/python/solidity/CappedTest.sol +++ /dev/null @@ -1,29 +0,0 @@ -pragma solidity >=0.6.3; - -// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 -// SPDX-License-Identifier: AGPL-3.0-or-later - -contract CappedTest { - event Cap(uint256 indexed _oldCap, uint256 _newCap); - - uint256 public maxSupply; - - constructor(uint256 _supply) { - maxSupply = _supply; - } - - function setMaxSupply(uint256 _supply) public { - emit Cap(maxSupply, _supply); - maxSupply = _supply; - } - - function supportsInterface(bytes4 _sum) public pure returns (bool) { - if (_sum == 0x01ffc9a7) { // EIP165 - return true; - } - if (_sum == 0x869f7594) { // Capped - return true; - } - return false; - } -} diff --git a/python/solidity/ExpireTest.bin b/python/solidity/ExpireTest.bin deleted file mode 100644 index c0f1501..0000000 --- a/python/solidity/ExpireTest.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b506040516105143803806105148339818101604052810190610032919061007a565b80600081905550506100a7565b600080fd5b6000819050919050565b61005781610044565b811461006257600080fd5b50565b6000815190506100748161004e565b92915050565b6000602082840312156100905761008f61003f565b5b600061009e84828501610065565b91505092915050565b61045e806100b66000396000f3fe608060405234801561001057600080fd5b5060043610610069576000357c01000000000000000000000000000000000000000000000000000000009004806301cceb381461006e57806301ffc9a71461008a5780635f408c04146100ba578063b1cb0db3146100d8575b600080fd5b610088600480360381019061008391906102df565b6100f6565b005b6100a4600480360381019061009f9190610364565b610162565b6040516100b191906103ac565b60405180910390f35b6100c2610212565b6040516100cf91906103e3565b60405180910390f35b6100e061029e565b6040516100ed919061040d565b60405180910390f35b600160009054906101000a900460ff161561011057600080fd5b600054811161011e57600080fd5b6000547ff5bd6cb27a0006b5ea8618058a0d84719695cb6d984f4840bc1a54ca12ae4b7c82604051610150919061040d565b60405180910390a28060008190555050565b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036101b6576001905061020d565b63841a0e947c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610208576001905061020d565b600090505b919050565b6000600160009054906101000a900460ff1615610232576001905061029b565b600054421015610245576000905061029b565b60018060006101000a81548160ff0219169083151502179055507ff80dbaea4785589e52984ca36a31de106adc77759539a5c7d92883bf49692fe94260405161028e919061040d565b60405180910390a1600190505b90565b60005481565b600080fd5b6000819050919050565b6102bc816102a9565b81146102c757600080fd5b50565b6000813590506102d9816102b3565b92915050565b6000602082840312156102f5576102f46102a4565b5b6000610303848285016102ca565b91505092915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6103418161030c565b811461034c57600080fd5b50565b60008135905061035e81610338565b92915050565b60006020828403121561037a576103796102a4565b5b60006103888482850161034f565b91505092915050565b60008115159050919050565b6103a681610391565b82525050565b60006020820190506103c1600083018461039d565b92915050565b600060ff82169050919050565b6103dd816103c7565b82525050565b60006020820190506103f860008301846103d4565b92915050565b610407816102a9565b82525050565b600060208201905061042260008301846103fe565b9291505056fea264697066735822122008d6e0c184036b44d56435108c0e081869b445ea32edbcd7035807691a26a11264736f6c63430008130033 \ No newline at end of file diff --git a/python/solidity/ExpireTest.sol b/python/solidity/ExpireTest.sol deleted file mode 100644 index 8ba6020..0000000 --- a/python/solidity/ExpireTest.sol +++ /dev/null @@ -1,47 +0,0 @@ -pragma solidity >=0.6.3; - -// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 -// SPDX-License-Identifier: AGPL-3.0-or-later - -contract ExpireTest { - - uint256 public expires; - bool expired; - - event Expired(uint256 _timestamp); - event ExpiryChange(uint256 indexed _oldTimestamp, uint256 _newTimestamp); - - constructor(uint256 _timestamp) { - expires = _timestamp; - } - - function setExpiry(uint256 _timestamp) public { - require(!expired); - require(_timestamp > expires); - emit ExpiryChange(expires, _timestamp); - expires = _timestamp; - } - - function applyExpiry() public returns(uint8) { - if (expired) { - return 1; - } - if (block.timestamp < expires) { - return 0; - } - expired = true; - emit Expired(block.timestamp); - return 1; - } - - function supportsInterface(bytes4 _sum) public pure returns (bool) { - if (_sum == 0x01ffc9a7) { // EIP165 - return true; - } - if (_sum == 0x841a0e94) { // Expire - return true; - } - return false; - } -} - diff --git a/python/solidity/MinterTest.bin b/python/solidity/MinterTest.bin deleted file mode 100644 index bacf2cd..0000000 --- a/python/solidity/MinterTest.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b50610653806100206000396000f3fe608060405234801561001057600080fd5b5060043610610074576000357c01000000000000000000000000000000000000000000000000000000009004806301ffc9a714610079578063449a52f8146100a95780638832e6e3146100d957806394d008ef146100f5578063e3d670d714610111575b600080fd5b610093600480360381019061008e9190610353565b610141565b6040516100a0919061039b565b60405180910390f35b6100c360048036038101906100be919061044a565b6101f1565b6040516100d0919061039b565b60405180910390f35b6100f360048036038101906100ee91906104ef565b6102b7565b005b61010f600480360381019061010a91906104ef565b6102c8565b005b61012b60048036038101906101269190610563565b6102d9565b604051610138919061059f565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361019557600190506101ec565b635878bcf47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036101e757600190506101ec565b600090505b919050565b6000816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461024191906105e9565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f8846040516102a5919061059f565b60405180910390a36001905092915050565b6102c184846101f1565b5050505050565b6102d284846101f1565b5050505050565b60006020528060005260406000206000915090505481565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610330816102fb565b811461033b57600080fd5b50565b60008135905061034d81610327565b92915050565b600060208284031215610369576103686102f1565b5b60006103778482850161033e565b91505092915050565b60008115159050919050565b61039581610380565b82525050565b60006020820190506103b0600083018461038c565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103e1826103b6565b9050919050565b6103f1816103d6565b81146103fc57600080fd5b50565b60008135905061040e816103e8565b92915050565b6000819050919050565b61042781610414565b811461043257600080fd5b50565b6000813590506104448161041e565b92915050565b60008060408385031215610461576104606102f1565b5b600061046f858286016103ff565b925050602061048085828601610435565b9150509250929050565b600080fd5b600080fd5b600080fd5b60008083601f8401126104af576104ae61048a565b5b8235905067ffffffffffffffff8111156104cc576104cb61048f565b5b6020830191508360018202830111156104e8576104e7610494565b5b9250929050565b60008060008060608587031215610509576105086102f1565b5b6000610517878288016103ff565b945050602061052887828801610435565b935050604085013567ffffffffffffffff811115610549576105486102f6565b5b61055587828801610499565b925092505092959194509250565b600060208284031215610579576105786102f1565b5b6000610587848285016103ff565b91505092915050565b61059981610414565b82525050565b60006020820190506105b46000830184610590565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006105f482610414565b91506105ff83610414565b9250828201905080821115610617576106166105ba565b5b9291505056fea2646970667358221220a5a810b6de36b1154b4b2d37d08d4e8a5fe442c870cd58cdba0d86a13da3dda964736f6c63430008130033 \ No newline at end of file diff --git a/python/solidity/MinterTest.sol b/python/solidity/MinterTest.sol deleted file mode 100644 index 3ba7d5e..0000000 --- a/python/solidity/MinterTest.sol +++ /dev/null @@ -1,35 +0,0 @@ -pragma solidity >=0.6.3; - -// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 -// SPDX-License-Identifier: AGPL-3.0-or-later - -contract MinterTest { - mapping (address => uint256) public balance; - - event Mint(address indexed _minter, address indexed _beneficiary, uint256 _value); - - function mintTo(address _beneficiary, uint256 _value) public returns (bool) { - balance[_beneficiary] += _value; - emit Mint(msg.sender, _beneficiary, _value); - return true; - } - - function mint(address _beneficiary, uint256 _value, bytes calldata _data) public { - _data; - mintTo(_beneficiary, _value); - } - function safeMint(address _beneficiary, uint256 _value, bytes calldata _data) public { - _data; - mintTo(_beneficiary, _value); - } - - function supportsInterface(bytes4 _sum) public pure returns (bool) { - if (_sum == 0x01ffc9a7) { // EIP165 - return true; - } - if (_sum == 0x5878bcf4) { // Minter - return true; - } - return false; - } -} diff --git a/python/solidity/SealTest.bin b/python/solidity/SealTest.bin deleted file mode 100644 index 45be26d..0000000 --- a/python/solidity/SealTest.bin +++ /dev/null @@ -1 +0,0 @@ -6080604052600760015534801561001557600080fd5b50610355806100256000396000f3fe608060405234801561001057600080fd5b5060043610610069576000357c01000000000000000000000000000000000000000000000000000000009004806301ffc9a71461006e57806318cbbcfc1461009e57806331a5995d146100bc57806386fe212d146100da575b600080fd5b6100886004803603810190610083919061022f565b6100f6565b6040516100959190610277565b60405180910390f35b6100a66101a6565b6040516100b391906102ab565b60405180910390f35b6100c46101ac565b6040516100d191906102ab565b60405180910390f35b6100f460048036038101906100ef91906102f2565b6101b2565b005b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361014a57600190506101a1565b630d7491f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361019c57600190506101a1565b600090505b919050565b60015481565b60005481565b60015481106101c057600080fd5b80600080828254179250508190555050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61020c816101d7565b811461021757600080fd5b50565b60008135905061022981610203565b92915050565b600060208284031215610245576102446101d2565b5b60006102538482850161021a565b91505092915050565b60008115159050919050565b6102718161025c565b82525050565b600060208201905061028c6000830184610268565b92915050565b6000819050919050565b6102a581610292565b82525050565b60006020820190506102c0600083018461029c565b92915050565b6102cf81610292565b81146102da57600080fd5b50565b6000813590506102ec816102c6565b92915050565b600060208284031215610308576103076101d2565b5b6000610316848285016102dd565b9150509291505056fea26469706673582212208356fec8f4fc7719bf58ea1be5e22cf56cadb8367918f5b4e0a90cad23396bb064736f6c63430008130033 \ No newline at end of file diff --git a/python/solidity/SealTest.sol b/python/solidity/SealTest.sol deleted file mode 100644 index 2ac573f..0000000 --- a/python/solidity/SealTest.sol +++ /dev/null @@ -1,25 +0,0 @@ -pragma solidity >=0.6.12; - -// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 -// SPDX-License-Identifier: AGPL-3.0-or-later - -contract SealTest { - event SealStateChange(bool indexed _final, uint256 _sealState); - uint256 public sealState; - uint256 public maxSealState = 7; - - function seal(uint256 _bits) public { - require(_bits < maxSealState); - sealState |= _bits; - } - - function supportsInterface(bytes4 _sum) public pure returns (bool) { - if (_sum == 0x01ffc9a7) { // EIP165 - return true; - } - if (_sum == 0x0d7491f8) { // Capped - return true; - } - return false; - } -} diff --git a/python/solidity/WriterTest.bin b/python/solidity/WriterTest.bin deleted file mode 100644 index d7ce08f..0000000 --- a/python/solidity/WriterTest.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b506104da806100206000396000f3fe608060405234801561001057600080fd5b5060043610610069576000357c01000000000000000000000000000000000000000000000000000000009004806301ffc9a71461006e5780632b29ba231461009e5780635ae06f7e146100ce578063da2824a8146100fe575b600080fd5b6100886004803603810190610083919061038c565b61012e565b60405161009591906103d4565b60405180910390f35b6100b860048036038101906100b3919061044d565b6101de565b6040516100c591906103d4565b60405180910390f35b6100e860048036038101906100e3919061044d565b6101fe565b6040516100f591906103d4565b60405180910390f35b6101186004803603810190610113919061044d565b610296565b60405161012591906103d4565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361018257600190506101d9565b63abe1f1f57c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036101d457600190506101d9565b600090505b919050565b60006020528060005260406000206000915054906101000a900460ff1681565b6000806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f9002f14780245e47491e7a2caae4712e7cea2e298e4e76c6916845145b90a51c826040516102859190610489565b60405180910390a160019050919050565b600060016000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f6ff3aa2ea7b53070f6d9d07a445d338d89e8edef44250ffa8be19f53910d4a2e8260405161031e9190610489565b60405180910390a160019050919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61036981610334565b811461037457600080fd5b50565b60008135905061038681610360565b92915050565b6000602082840312156103a2576103a161032f565b5b60006103b084828501610377565b91505092915050565b60008115159050919050565b6103ce816103b9565b82525050565b60006020820190506103e960008301846103c5565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061041a826103ef565b9050919050565b61042a8161040f565b811461043557600080fd5b50565b60008135905061044781610421565b92915050565b6000602082840312156104635761046261032f565b5b600061047184828501610438565b91505092915050565b6104838161040f565b82525050565b600060208201905061049e600083018461047a565b9291505056fea26469706673582212206bef2d3402160122da272241da7b2729136d4bc1e4399f01ddd8c8a7d3b93cdd64736f6c63430008130033 \ No newline at end of file diff --git a/python/solidity/WriterTest.sol b/python/solidity/WriterTest.sol deleted file mode 100644 index 201ed31..0000000 --- a/python/solidity/WriterTest.sol +++ /dev/null @@ -1,33 +0,0 @@ -pragma solidity >=0.6.3; - -// Author: Louis Holbrook 0826EDA1702D1E87C6E2875121D2E7BB88C2A746 -// SPDX-License-Identifier: AGPL-3.0-or-later - -contract WriterTest { - mapping (address => bool ) public isWriter; - - event WriterAdded(address _writer); - event WriterDeleted(address _writer); - - function addWriter(address _writer) public returns (bool) { - isWriter[_writer] = true; - emit WriterAdded(_writer); - return true; - } - - function deleteWriter(address _writer) public returns (bool) { - isWriter[_writer] = false; - emit WriterDeleted(_writer); - return true; - } - - function supportsInterface(bytes4 _sum) public pure returns (bool) { - if (_sum == 0x01ffc9a7) { // EIP165 - return true; - } - if (_sum == 0xabe1f1f5) { // Writer - return true; - } - return false; - } -}