NIS-Oracle-Contract
所属分类:DeFi
开发工具:Solidity
文件大小:78KB
下载次数:0
上传日期:2020-10-16 15:56:22
上 传 者:
sh-1993
说明: 智能合约的去中心化实时审计。
(Decentralized real-time auditing for your smart contracts.)
文件列表:
LICENSE (1074, 2020-10-16)
contracts (0, 2020-10-16)
contracts\CertiKSecurityOracle.sol (3875, 2020-10-16)
contracts\CertiKSecurityOracleProxy.sol (815, 2020-10-16)
contracts\DeFiExample.sol (2177, 2020-10-16)
contracts\Migrations.sol (369, 2020-10-16)
contracts\openzeppelin (0, 2020-10-16)
contracts\openzeppelin\Context.sol (1147, 2020-10-16)
contracts\openzeppelin\Ownable.sol (2433, 2020-10-16)
contracts\openzeppelin\Proxy.sol (2115, 2020-10-16)
migrations (0, 2020-10-16)
migrations\1_initial_migration.js (125, 2020-10-16)
migrations\2_create_security_oracle.js (351, 2020-10-16)
migrations\3_create_defi_example.js (516, 2020-10-16)
migrations\4_create_security_oracle_proxy.js (479, 2020-10-16)
package.json (402, 2020-10-16)
test (0, 2020-10-16)
test\TestProxy.sol (1231, 2020-10-16)
test\TestSecurityOracle.js (1463, 2020-10-16)
test\TestSecurityOracle.sol (4694, 2020-10-16)
truffle-config.js (738, 2020-10-16)
yarn.lock (165575, 2020-10-16)
# CertiK Security Oracle Smart Contracts
Decentralized real-time auditing for your smart contracts.
## Usage
Follow the following example to integrate. For complicated integrations we can check [DeFiExample](https://github.com/nis-protocol/NIS-Oracle-Contract/blob/master/contracts/DeFiExample.sol) for a reference.
```
interface SecurityOracle {
function getSecurityScore(
address contractAddress,
string calldata functionSignature
) external view returns (uint8);
}
contract MinimalExample {
function secureCall() public {
address securityOracleAddress = address(0x97f24e544c19280ec319f29de751e95b1d8c05e2#code);
address targetAddress = address(0xfa308d59067470487C38Eaf4d586EA21F1b0032b);
string functionSignature = "getPrice(string)";
uint8 score = SecurityOracle(securityOracleAddress).getSecurityScore(
targetAddress,
functionSignature
);
// build your own check
require(score > 100, "revert due to high security risk");
...proceed to call targetAddress/function
}
}
```
## Development
### Prerequisite
```
yarn install
```
### Interactive Debugging
```
yarn deploy
yarn console
```
### Test
```
yarn test
```
## Production
```
TRUFFLE_PRIVATE_KEY="" TRUFFLE_RPC="" yarn deploy --network production
```
Note that truffle commands like `truffle migrate`/`truffle deploy`/etc would also require the environment variables.
近期下载者:
相关文件:
收藏者: