This repo represents the contracts that were used in the CodeFi-HMLR PoC.
This repo is setup to use Truffle, so you can run standard commands:
truffle test
truffle migrate
truffle compile
Other Commands that are available:
npm run coverage
- Generates the Solidity Test Coverage reportnpm run test
- Runs truffle test suitenpm run hint
- Generates solhint reportnpm run myth
- Recompiles contracts and runs Mythril for Truffle
Environment Variables:
INFURA_PROJECT_ID
- (Legacy) Infura ID for connecting to infura rinkeby nodeMNEMONIC_PHRASE
- mnemonic phrase to give access to the wallet for launching on Rinkeby
This is a copy of the Dai contract that Meridio uses in its test environments to mock interactions with Mainnet Dai.
This is a modified ERC20 that represents the core of the Meridio token ecosystem. It has modules on it to validate transfers and is used to track the tokens for each asset in the Meridio system. It will be launched as a Singleton and each Token in the system will be a proxy that references this implementation. When deploying the singleton, the deployer should ensure that the implementation gets initialized. The ProxyTokenFactory is recommended for launching new individual tokens as that will initialize them in the initial transaction. Key Modifications to ERC20 standard:
- Adding
canSend
checks before allowingtransfer
,transferFrom
,forceTransfer
functions to run - Adding
forceTranfer
function to allow the owner to move tokens from one address to another in compliance with thecanSend
parameters. - Allowing owner to
mint
/burn
to/from any address - Allow owner to
addModule
/removeModule
to control the parameters ofcanSend
Inheritance Chain:
This contract combines an upgradeability proxy with basic authorization control functionalities Source https://github.com/zeppelinos/labs/blob/master/upgradeability_using_unstructured_storage/contracts/OwnedUpgradeabilityProxy.sol Interface Reference: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-897.md Implementation notes:
- constructors will not work, the proxied contract must be initialized after proxying. That is what the upgradeToAndCall function is for.
- if you do not inherit your version n-1 into version n, you will overwrite memory slots with the new contract.
- if you inherit version n-1 into version n, you will preserve memory slots including the _initialized flag.
- Therefore each new contract that needs to be initialized should have its own _initialized flag and function.
- ProxyOwner can change implementation reference and reassign ownership (of the proxy)
Inheritance Chain:
UpgradeabilityProxy
>Proxy
>ERCProxy
This singleton launches a new proxy contract and points it to the implementation it is given. It then assigns ownership of the Token (impl) and the Proxy to the msg.sender
Inheritance Chain:
Note: Imports OwnedUpgradeabilityProxy.sol
as ProxyToken
This TransferValidator contract reverts transfers if the validator is paused.
Permissions:
The owner
of the contract can pause/unpause the contract.
Inheritance Chain:
This TransferValidator contract reverts transfers if the to
address is false
in the whitelist mapping.
Permissions:
The owner
of the contract can add/remove addresses from the whitelist.
Inheritance Chain:
This is a singleton contract that allows anyone to add key/value pairs to any “subject” smart contract address. The keys are meant to be simple identifiers, and the value is a string intended to be a link to HTTP or IPFS accessible data.
Inheritance Chain: