This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@0x/contracts-zero-ex
: Revamp TransformERC20.
- Loading branch information
1 parent
4bdc220
commit b4c5081
Showing
41 changed files
with
1,148 additions
and
1,183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
contracts/zero-ex/contracts/src/external/AllowanceTarget.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
Copyright 2020 ZeroEx Intl. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
pragma solidity ^0.6.5; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol"; | ||
import "@0x/contracts-utils/contracts/src/v06/AuthorizableV06.sol"; | ||
import "../errors/LibSpenderRichErrors.sol"; | ||
import "./IAllowanceTarget.sol"; | ||
|
||
|
||
/// @dev The allowance target for the TokenSpender feature. | ||
contract AllowanceTarget is | ||
IAllowanceTarget, | ||
AuthorizableV06 | ||
{ | ||
// solhint-disable no-unused-vars,indent,no-empty-blocks | ||
using LibRichErrorsV06 for bytes; | ||
|
||
/// @dev Execute an arbitrary call. Only an authority can call this. | ||
/// @param target The call target. | ||
/// @param callData The call data. | ||
/// @return resultData The data returned by the call. | ||
function execute( | ||
address payable target, | ||
bytes calldata callData | ||
) | ||
external | ||
payable | ||
override | ||
onlyAuthorized | ||
returns (bytes memory resultData) | ||
{ | ||
bool success; | ||
(success, resultData) = target.call(callData); | ||
if (!success) { | ||
resultData.rrevert(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
Copyright 2020 ZeroEx Intl. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
pragma solidity ^0.6.5; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import "@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol"; | ||
|
||
|
||
/// @dev A contract that can execute arbitrary calls from its owner. | ||
interface IPuppet is | ||
IOwnableV06 | ||
{ | ||
/// @dev Execute an arbitrary call. Only an authority can call this. | ||
/// @param target The call target. | ||
/// @param callData The call data. | ||
/// @param value Ether to attach to the call. | ||
/// @return resultData The data returned by the call. | ||
function execute( | ||
address payable target, | ||
bytes calldata callData, | ||
uint256 value | ||
) | ||
external | ||
payable | ||
returns (bytes memory resultData); | ||
|
||
/// @dev Execute an arbitrary delegatecall, in the context of this puppet. | ||
/// Only an authority can call this. | ||
/// @param target The call target. | ||
/// @param callData The call data. | ||
/// @return resultData The data returned by the call. | ||
function executeWith( | ||
address payable target, | ||
bytes calldata callData | ||
) | ||
external | ||
payable | ||
returns (bytes memory resultData); | ||
|
||
/// @dev Allows the puppet to receive ETH. | ||
receive() external payable; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.