@trustline.id/web3sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +22 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json +194 -0
- package/artifacts/build-info/59243712b3c2b7c16f9bd43f3a3a6442.json +1 -0
- package/artifacts/contracts/Trustlined.sol/Trustlined.dbg.json +4 -0
- package/artifacts/contracts/Trustlined.sol/Trustlined.json +24 -0
- package/artifacts/contracts/examples/PaymentFirewall.sol/PaymentFirewall.dbg.json +4 -0
- package/artifacts/contracts/examples/PaymentFirewall.sol/PaymentFirewall.json +71 -0
- package/artifacts/contracts/interfaces/IValidationEngine.sol/IValidationEngine.dbg.json +4 -0
- package/artifacts/contracts/interfaces/IValidationEngine.sol/IValidationEngine.json +125 -0
- package/contracts/Trustlined.sol +50 -0
- package/contracts/examples/PaymentFirewall.sol +40 -0
- package/contracts/interfaces/IValidationEngine.sol +54 -0
- package/dist/bundle.js +35 -0
- package/index.js +5 -0
- package/package.json +44 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "Trustlined",
|
|
4
|
+
"sourceName": "contracts/Trustlined.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [],
|
|
8
|
+
"name": "validationEngine",
|
|
9
|
+
"outputs": [
|
|
10
|
+
{
|
|
11
|
+
"internalType": "contract IValidationEngine",
|
|
12
|
+
"name": "",
|
|
13
|
+
"type": "address"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"stateMutability": "view",
|
|
17
|
+
"type": "function"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"bytecode": "0x",
|
|
21
|
+
"deployedBytecode": "0x",
|
|
22
|
+
"linkReferences": {},
|
|
23
|
+
"deployedLinkReferences": {}
|
|
24
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "PaymentFirewall",
|
|
4
|
+
"sourceName": "contracts/examples/PaymentFirewall.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [
|
|
8
|
+
{
|
|
9
|
+
"internalType": "address",
|
|
10
|
+
"name": "compliance",
|
|
11
|
+
"type": "address"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"stateMutability": "nonpayable",
|
|
15
|
+
"type": "constructor"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"inputs": [
|
|
19
|
+
{
|
|
20
|
+
"internalType": "address payable",
|
|
21
|
+
"name": "destination",
|
|
22
|
+
"type": "address"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"name": "payEthers",
|
|
26
|
+
"outputs": [],
|
|
27
|
+
"stateMutability": "payable",
|
|
28
|
+
"type": "function"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"inputs": [
|
|
32
|
+
{
|
|
33
|
+
"internalType": "address",
|
|
34
|
+
"name": "destination",
|
|
35
|
+
"type": "address"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"internalType": "address",
|
|
39
|
+
"name": "token",
|
|
40
|
+
"type": "address"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"internalType": "uint256",
|
|
44
|
+
"name": "value",
|
|
45
|
+
"type": "uint256"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"name": "payTokens",
|
|
49
|
+
"outputs": [],
|
|
50
|
+
"stateMutability": "nonpayable",
|
|
51
|
+
"type": "function"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"inputs": [],
|
|
55
|
+
"name": "validationEngine",
|
|
56
|
+
"outputs": [
|
|
57
|
+
{
|
|
58
|
+
"internalType": "contract IValidationEngine",
|
|
59
|
+
"name": "",
|
|
60
|
+
"type": "address"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"stateMutability": "view",
|
|
64
|
+
"type": "function"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"bytecode": "0x608060405234801561000f575f5ffd5b5060405161077f38038061077f83398101604081905261002e916100c8565b806100388161003f565b50506100f5565b6100488161004b565b50565b5f546001600160a01b0316156100a75760405162461bcd60e51b815260206004820152601360248201527f416c726561647920696e697469616c697a656400000000000000000000000000604482015260640160405180910390fd5b5f80546001600160a01b0319166001600160a01b0392909216919091179055565b5f602082840312156100d8575f5ffd5b81516001600160a01b03811681146100ee575f5ffd5b9392505050565b61067d806101025f395ff3fe608060405260043610610033575f3560e01c80632be277aa14610037578063666c6f23146100585780637d4f064e1461006b575b5f5ffd5b348015610042575f5ffd5b506100566100513660046104d0565b6100bf565b005b61005661006636600461050e565b610297565b348015610076575f5ffd5b505f546100969073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6040805160028082526060820183525f9260208301908036833701905050905033815f815181106100f2576100f2610530565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050838160018151811061014057610140610530565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061018381610426565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8581166024830152604482018490525f91908516906323b872dd906064016020604051808303815f875af11580156101fe573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610222919061055d565b905080610290576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e61626c6520746f2070617920746f6b656e7300000000000000000000000060448201526064015b60405180910390fd5b5050505050565b6040805160028082526060820183525f9260208301908036833701905050905033815f815181106102ca576102ca610530565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818160018151811061031857610318610530565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061035b81610426565b5f8273ffffffffffffffffffffffffffffffffffffffff16346040515f6040518083038185875af1925050503d805f81146103b1576040519150601f19603f3d011682016040523d82523d5f602084013e6103b6565b606091505b5050905080610421576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e61626c6520746f20706179206574686572730000000000000000000000006044820152606401610287565b505050565b5f80546040517f6cfd0c0900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911691636cfd0c09916104839133913491903690889060040161057c565b5f604051808303815f87803b15801561049a575f5ffd5b505af1158015610290573d5f5f3e3d5ffd5b73ffffffffffffffffffffffffffffffffffffffff811681146104cd575f5ffd5b50565b5f5f5f606084860312156104e2575f5ffd5b83356104ed816104ac565b925060208401356104fd816104ac565b929592945050506040919091013590565b5f6020828403121561051e575f5ffd5b8135610529816104ac565b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f6020828403121561056d575f5ffd5b81518015158114610529575f5ffd5b73ffffffffffffffffffffffffffffffffffffffff8616815284602082015260806040820152826080820152828460a08301375f60a084830181018290527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f86011683018381038201606085015284519181018290526020850191839160c001905b808310156106395773ffffffffffffffffffffffffffffffffffffffff8451168252602082019150602084019350600183019250610600565b50999850505050505050505056fea26469706673582212207bf43939de66cc895afaacb5acc69d3afba60d2e02439c0e400a199c197dabd264736f6c634300081c0033",
|
|
68
|
+
"deployedBytecode": "0x608060405260043610610033575f3560e01c80632be277aa14610037578063666c6f23146100585780637d4f064e1461006b575b5f5ffd5b348015610042575f5ffd5b506100566100513660046104d0565b6100bf565b005b61005661006636600461050e565b610297565b348015610076575f5ffd5b505f546100969073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6040805160028082526060820183525f9260208301908036833701905050905033815f815181106100f2576100f2610530565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050838160018151811061014057610140610530565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061018381610426565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8581166024830152604482018490525f91908516906323b872dd906064016020604051808303815f875af11580156101fe573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610222919061055d565b905080610290576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e61626c6520746f2070617920746f6b656e7300000000000000000000000060448201526064015b60405180910390fd5b5050505050565b6040805160028082526060820183525f9260208301908036833701905050905033815f815181106102ca576102ca610530565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818160018151811061031857610318610530565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061035b81610426565b5f8273ffffffffffffffffffffffffffffffffffffffff16346040515f6040518083038185875af1925050503d805f81146103b1576040519150601f19603f3d011682016040523d82523d5f602084013e6103b6565b606091505b5050905080610421576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e61626c6520746f20706179206574686572730000000000000000000000006044820152606401610287565b505050565b5f80546040517f6cfd0c0900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911691636cfd0c09916104839133913491903690889060040161057c565b5f604051808303815f87803b15801561049a575f5ffd5b505af1158015610290573d5f5f3e3d5ffd5b73ffffffffffffffffffffffffffffffffffffffff811681146104cd575f5ffd5b50565b5f5f5f606084860312156104e2575f5ffd5b83356104ed816104ac565b925060208401356104fd816104ac565b929592945050506040919091013590565b5f6020828403121561051e575f5ffd5b8135610529816104ac565b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f6020828403121561056d575f5ffd5b81518015158114610529575f5ffd5b73ffffffffffffffffffffffffffffffffffffffff8616815284602082015260806040820152826080820152828460a08301375f60a084830181018290527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f86011683018381038201606085015284519181018290526020850191839160c001905b808310156106395773ffffffffffffffffffffffffffffffffffffffff8451168252602082019150602084019350600183019250610600565b50999850505050505050505056fea26469706673582212207bf43939de66cc895afaacb5acc69d3afba60d2e02439c0e400a199c197dabd264736f6c634300081c0033",
|
|
69
|
+
"linkReferences": {},
|
|
70
|
+
"deployedLinkReferences": {}
|
|
71
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "IValidationEngine",
|
|
4
|
+
"sourceName": "contracts/interfaces/IValidationEngine.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [
|
|
8
|
+
{
|
|
9
|
+
"internalType": "address",
|
|
10
|
+
"name": "sender",
|
|
11
|
+
"type": "address"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"internalType": "uint256",
|
|
15
|
+
"name": "value",
|
|
16
|
+
"type": "uint256"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "bytes",
|
|
20
|
+
"name": "data",
|
|
21
|
+
"type": "bytes"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"name": "checkTrustlineStatus",
|
|
25
|
+
"outputs": [
|
|
26
|
+
{
|
|
27
|
+
"internalType": "bool",
|
|
28
|
+
"name": "",
|
|
29
|
+
"type": "bool"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"stateMutability": "view",
|
|
33
|
+
"type": "function"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"inputs": [
|
|
37
|
+
{
|
|
38
|
+
"internalType": "address",
|
|
39
|
+
"name": "sender",
|
|
40
|
+
"type": "address"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"internalType": "uint256",
|
|
44
|
+
"name": "value",
|
|
45
|
+
"type": "uint256"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"internalType": "bytes",
|
|
49
|
+
"name": "data",
|
|
50
|
+
"type": "bytes"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"internalType": "address[]",
|
|
54
|
+
"name": "addresses",
|
|
55
|
+
"type": "address[]"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"name": "checkTrustlineStatus",
|
|
59
|
+
"outputs": [
|
|
60
|
+
{
|
|
61
|
+
"internalType": "bool",
|
|
62
|
+
"name": "",
|
|
63
|
+
"type": "bool"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"stateMutability": "view",
|
|
67
|
+
"type": "function"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"inputs": [
|
|
71
|
+
{
|
|
72
|
+
"internalType": "address",
|
|
73
|
+
"name": "sender",
|
|
74
|
+
"type": "address"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"internalType": "uint256",
|
|
78
|
+
"name": "value",
|
|
79
|
+
"type": "uint256"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"internalType": "bytes",
|
|
83
|
+
"name": "data",
|
|
84
|
+
"type": "bytes"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"name": "requireTrustline",
|
|
88
|
+
"outputs": [],
|
|
89
|
+
"stateMutability": "nonpayable",
|
|
90
|
+
"type": "function"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"inputs": [
|
|
94
|
+
{
|
|
95
|
+
"internalType": "address",
|
|
96
|
+
"name": "sender",
|
|
97
|
+
"type": "address"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"internalType": "uint256",
|
|
101
|
+
"name": "value",
|
|
102
|
+
"type": "uint256"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"internalType": "bytes",
|
|
106
|
+
"name": "data",
|
|
107
|
+
"type": "bytes"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"internalType": "address[]",
|
|
111
|
+
"name": "addresses",
|
|
112
|
+
"type": "address[]"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"name": "requireTrustline",
|
|
116
|
+
"outputs": [],
|
|
117
|
+
"stateMutability": "nonpayable",
|
|
118
|
+
"type": "function"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"bytecode": "0x",
|
|
122
|
+
"deployedBytecode": "0x",
|
|
123
|
+
"linkReferences": {},
|
|
124
|
+
"deployedLinkReferences": {}
|
|
125
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8;
|
|
3
|
+
|
|
4
|
+
import {IValidationEngine} from "./interfaces/IValidationEngine.sol";
|
|
5
|
+
|
|
6
|
+
/// @title Trustline's Base Contract
|
|
7
|
+
/// @author Trustline
|
|
8
|
+
/// @notice This library provides functions for verifying the trust status of a transaction
|
|
9
|
+
abstract contract Trustlined {
|
|
10
|
+
/// @notice The Trustline ValidationEngine contract address. It must be set before any of the provided functions can be used
|
|
11
|
+
/// @dev Multiple dapps can share the same ValidationEngine contract
|
|
12
|
+
/// @dev This contract is set by the owner and must implement the IValidationOracle interface
|
|
13
|
+
IValidationEngine public validationEngine;
|
|
14
|
+
|
|
15
|
+
/// @dev Both a constructor and initializer functions are defined to support both upgradeable and non-upgradeable deployment scenarios
|
|
16
|
+
constructor(address validationEngine_) {
|
|
17
|
+
__Trustlined_init(validationEngine_);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function __Trustlined_init(address validation_) internal {
|
|
21
|
+
__Trustlined_init_unchained(validation_);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function __Trustlined_init_unchained(address validationEngine_) internal {
|
|
25
|
+
require(address(validationEngine) == address(0), "Already initialized");
|
|
26
|
+
validationEngine = IValidationEngine(validationEngine_);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/// @notice Checks if a transaction is trusted
|
|
30
|
+
/// @param addresses An array of addresses that will be verified by the policy
|
|
31
|
+
function checkTrustlineStatus(address[] memory addresses) internal view returns (bool) {
|
|
32
|
+
return validationEngine.checkTrustlineStatus(msg.sender, msg.value, msg.data, addresses);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// @notice Checks if a transaction is trusted
|
|
36
|
+
function checkComplianceStatus() internal view returns (bool) {
|
|
37
|
+
return validationEngine.checkTrustlineStatus(msg.sender, msg.value, msg.data);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// @notice Requires a trusted transaction
|
|
41
|
+
/// @param addresses An array of addresses that will be verified by the policy
|
|
42
|
+
function requireTrustline(address[] memory addresses) internal {
|
|
43
|
+
validationEngine.requireTrustline(msg.sender, msg.value, msg.data, addresses);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// @notice Requires a trusted transaction
|
|
47
|
+
function requireTrustline() internal {
|
|
48
|
+
validationEngine.requireTrustline(msg.sender, msg.value, msg.data);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8;
|
|
3
|
+
|
|
4
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
|
+
import {Trustlined, IValidationEngine} from "../Trustlined.sol";
|
|
6
|
+
|
|
7
|
+
/// @title PaymentFirewall
|
|
8
|
+
/// @author Trustline
|
|
9
|
+
/// @notice This contract is a firewall ensuring all funds going in and out are compliant
|
|
10
|
+
contract PaymentFirewall is Trustlined {
|
|
11
|
+
constructor(address compliance) Trustlined(compliance) {}
|
|
12
|
+
|
|
13
|
+
/// @notice Pay native ethers to a recipient
|
|
14
|
+
/// @param destination The recipient address
|
|
15
|
+
function payEthers(address payable destination) public payable {
|
|
16
|
+
address[] memory addresses = new address[](2);
|
|
17
|
+
addresses[0] = msg.sender;
|
|
18
|
+
addresses[1] = destination;
|
|
19
|
+
requireTrustline(addresses);
|
|
20
|
+
(bool sent, ) = destination.call{value: msg.value}("");
|
|
21
|
+
require(sent, "Unable to pay ethers");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// @notice Pay ERC20 tokens to a recipient
|
|
25
|
+
/// @param destination The recipient address
|
|
26
|
+
/// @param token The ERC20 token address
|
|
27
|
+
/// @param value The amount of tokens to pay
|
|
28
|
+
function payTokens(address destination, address token, uint256 value) external {
|
|
29
|
+
address[] memory addresses = new address[](2);
|
|
30
|
+
addresses[0] = msg.sender;
|
|
31
|
+
addresses[1] = destination;
|
|
32
|
+
requireTrustline(addresses);
|
|
33
|
+
bool sent = IERC20(token).transferFrom(msg.sender, destination, value);
|
|
34
|
+
require(sent, "Unable to pay tokens");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
|
|
40
|
+
*/
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8;
|
|
3
|
+
|
|
4
|
+
/// @title Trustline's Validation interface
|
|
5
|
+
/// @author Trustline
|
|
6
|
+
/// @notice This interface defines the functions that must be implemented by the validation contract
|
|
7
|
+
/// @dev This interface is used by the Trustlined contract to interact with Trustline's Validation contract
|
|
8
|
+
interface IValidationEngine {
|
|
9
|
+
/// @notice Checks if a transaction is trusted
|
|
10
|
+
/// @param sender The transaction sender
|
|
11
|
+
/// @param value Transaction value in wei
|
|
12
|
+
/// @param data Transaction payload data
|
|
13
|
+
/// @param addresses An array of addresses that will be verified by the policy
|
|
14
|
+
function checkTrustlineStatus(
|
|
15
|
+
address sender,
|
|
16
|
+
uint256 value,
|
|
17
|
+
bytes calldata data,
|
|
18
|
+
address[] memory addresses
|
|
19
|
+
) external view returns (bool);
|
|
20
|
+
|
|
21
|
+
/// @notice Checks if a transaction is trusted
|
|
22
|
+
/// @param sender The transaction sender
|
|
23
|
+
/// @param value Transaction value in wei
|
|
24
|
+
/// @param data Transaction payload data
|
|
25
|
+
function checkTrustlineStatus(
|
|
26
|
+
address sender,
|
|
27
|
+
uint256 value,
|
|
28
|
+
bytes calldata data
|
|
29
|
+
) external view returns (bool);
|
|
30
|
+
|
|
31
|
+
/// @notice Requires a trusted transaction
|
|
32
|
+
/// @dev reverts if the transaction is not compliant
|
|
33
|
+
/// @param sender The transaction sender
|
|
34
|
+
/// @param value Transaction value in wei
|
|
35
|
+
/// @param data Transaction payload data
|
|
36
|
+
/// @param addresses An array of addresses that will be verified by the policy
|
|
37
|
+
function requireTrustline(
|
|
38
|
+
address sender,
|
|
39
|
+
uint256 value,
|
|
40
|
+
bytes calldata data,
|
|
41
|
+
address[] memory addresses
|
|
42
|
+
) external;
|
|
43
|
+
|
|
44
|
+
/// @notice Requires a trusted transaction
|
|
45
|
+
/// @dev reverts if the transaction is not compliant
|
|
46
|
+
/// @param sender The transaction sender
|
|
47
|
+
/// @param value Transaction value in wei
|
|
48
|
+
/// @param data Transaction payload data
|
|
49
|
+
function requireTrustline(
|
|
50
|
+
address sender,
|
|
51
|
+
uint256 value,
|
|
52
|
+
bytes calldata data
|
|
53
|
+
) external;
|
|
54
|
+
}
|
package/dist/bundle.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Trustlined = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
|
+
module.exports={
|
|
3
|
+
"_format": "hh-sol-artifact-1",
|
|
4
|
+
"contractName": "Trustlined",
|
|
5
|
+
"sourceName": "contracts/Trustlined.sol",
|
|
6
|
+
"abi": [
|
|
7
|
+
{
|
|
8
|
+
"inputs": [],
|
|
9
|
+
"name": "validationEngine",
|
|
10
|
+
"outputs": [
|
|
11
|
+
{
|
|
12
|
+
"internalType": "contract IValidationEngine",
|
|
13
|
+
"name": "",
|
|
14
|
+
"type": "address"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"stateMutability": "view",
|
|
18
|
+
"type": "function"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"bytecode": "0x",
|
|
22
|
+
"deployedBytecode": "0x",
|
|
23
|
+
"linkReferences": {},
|
|
24
|
+
"deployedLinkReferences": {}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
},{}],2:[function(require,module,exports){
|
|
28
|
+
const Trustlined = require('./artifacts/contracts/Trustlined.sol/Trustlined.json');
|
|
29
|
+
|
|
30
|
+
module.exports = {
|
|
31
|
+
Trustlined
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
},{"./artifacts/contracts/Trustlined.sol/Trustlined.json":1}]},{},[2])(2)
|
|
35
|
+
});
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@trustline.id/web3sdk",
|
|
3
|
+
"description": "Protects EVM-compatible smart contracts from unauthorized access and malicious transactions",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"compile": "hardhat compile",
|
|
8
|
+
"build": "mkdir -p dist && npm run compile && node build.js",
|
|
9
|
+
"clean": "rm -rf dist artifacts cache"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"artifacts",
|
|
14
|
+
"index.js",
|
|
15
|
+
"contracts"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/TrustLine-id/web3sdk.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"solidity",
|
|
23
|
+
"ethereum",
|
|
24
|
+
"smart",
|
|
25
|
+
"contracts",
|
|
26
|
+
"security",
|
|
27
|
+
"compliance",
|
|
28
|
+
"trustline"
|
|
29
|
+
],
|
|
30
|
+
"author": "Trustline <contact@trustline.id>",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/TrustLine-id/web3sdk/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://www.trustline.id",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@openzeppelin/contracts": "^5.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"browserify": "^17.0.1",
|
|
41
|
+
"hardhat": "^2.22.17",
|
|
42
|
+
"path": "^0.12.7"
|
|
43
|
+
}
|
|
44
|
+
}
|